| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.backends.jeb; |
| | | |
| | |
| | | */ |
| | | public class EntryID implements Comparable<EntryID> |
| | | { |
| | | /** |
| | | * The identifier integer value. |
| | | */ |
| | | private final Long id; |
| | | |
| | | /** |
| | | * The value in database format, created when necessary. |
| | | */ |
| | | private DatabaseEntry data = null; |
| | | /** The identifier integer value. */ |
| | | private final long id; |
| | | /** The value in database format, created when necessary. */ |
| | | private DatabaseEntry data; |
| | | |
| | | /** |
| | | * Create a new entry ID object from a given long value. |
| | |
| | | } |
| | | |
| | | /** |
| | | * Create a new entry ID object from a given Long value. |
| | | * @param id the Long value of the ID. |
| | | */ |
| | | public EntryID(Long id) |
| | | { |
| | | this.id = id; |
| | | } |
| | | |
| | | /** |
| | | * Create a new entry ID object from a value in database format. |
| | | * @param databaseEntry The database value of the ID. |
| | | */ |
| | |
| | | * @throws ClassCastException if the specified object's type prevents it |
| | | * from being compared to this Object. |
| | | */ |
| | | @Override |
| | | public int compareTo(EntryID that) throws ClassCastException |
| | | { |
| | | return this.id.compareTo(that.id); |
| | | final long result = this.id - that.id; |
| | | if (result < 0) |
| | | { |
| | | return -1; |
| | | } |
| | | else if (result > 0) |
| | | { |
| | | return 1; |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | /** |
| | |
| | | * @see #hashCode() |
| | | * @see java.util.Hashtable |
| | | */ |
| | | @Override public boolean equals(Object that) |
| | | @Override |
| | | public boolean equals(Object that) |
| | | { |
| | | if (that == null) |
| | | { |
| | | return false; |
| | | } |
| | | if (this == that) |
| | | { |
| | | return true; |
| | |
| | | { |
| | | return false; |
| | | } |
| | | return this.id.equals(((EntryID)that).id); |
| | | return this.id == ((EntryID) that).id; |
| | | } |
| | | |
| | | /** |
| | |
| | | * @see java.lang.Object#equals(java.lang.Object) |
| | | * @see java.util.Hashtable |
| | | */ |
| | | @Override public int hashCode() |
| | | @Override |
| | | public int hashCode() |
| | | { |
| | | return (int)id.longValue(); |
| | | return (int) id; |
| | | } |
| | | |
| | | /** |
| | | * Get a string representation of this object. |
| | | * @return A string representation of this object. |
| | | */ |
| | | @Override |
| | | public String toString() |
| | | { |
| | | return id.toString(); |
| | | return Long.toString(id); |
| | | } |
| | | } |