com.metamatrix.metadata.runtime.model
Class BasicVirtualDatabaseID

java.lang.Object
  extended by com.metamatrix.metadata.runtime.model.BasicMetadataID
      extended by com.metamatrix.metadata.runtime.model.BasicVirtualDatabaseID
All Implemented Interfaces:
MetadataID, VirtualDatabaseID, java.io.Serializable, java.lang.Cloneable, java.lang.Comparable

public class BasicVirtualDatabaseID
extends BasicMetadataID
implements VirtualDatabaseID

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.metamatrix.metadata.runtime.model.BasicMetadataID
DELIMITER, FAKE_NAME, NOT_DEFINED, WILDCARD
 
Constructor Summary
BasicVirtualDatabaseID(java.lang.String fullName, java.lang.String versionName)
          Call constructor to instantiate a VirtualDatabaseID object for the fully qualified Virtual Database name and version.
BasicVirtualDatabaseID(java.lang.String fullName, java.lang.String versionName, long internalUniqueID)
          Call constructor to instantiate a VirtualDatabaseID object for the fully qualified Virtual Database name, version and an internal unique identifier.
 
Method Summary
 int compareTo(java.lang.Object obj)
          Compares this object to another.
 int compareToByName(java.lang.Object obj)
          Compares this object to another lexicographically.
protected  int computeHashCode()
          Return a new hash code value for this instance.
 boolean equals(java.lang.Object obj)
          Returns true if the specified object is semantically equal to this instance.
 java.lang.String getVersion()
          returns the version.
 void setVersion(java.lang.String version)
           
 
Methods inherited from class com.metamatrix.metadata.runtime.model.BasicMetadataID
clone, getFullName, getName, getNameComponent, getNameComponents, getParentFullName, getPath, getUID, hashCode, hasParent, setFullName, setGroupFullName, setModelName, setName, setShortName, setUID, size, toString, updateHashCode
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.metamatrix.metadata.runtime.api.MetadataID
clone, getFullName, getName, getNameComponent, getNameComponents, getParentFullName, getPath, hashCode, size, toString
 

Constructor Detail

BasicVirtualDatabaseID

public BasicVirtualDatabaseID(java.lang.String fullName,
                              java.lang.String versionName,
                              long internalUniqueID)
Call constructor to instantiate a VirtualDatabaseID object for the fully qualified Virtual Database name, version and an internal unique identifier.


BasicVirtualDatabaseID

public BasicVirtualDatabaseID(java.lang.String fullName,
                              java.lang.String versionName)
Call constructor to instantiate a VirtualDatabaseID object for the fully qualified Virtual Database name and version.

Method Detail

getVersion

public java.lang.String getVersion()
returns the version.

Specified by:
getVersion in interface VirtualDatabaseID
Returns:
String

setVersion

public void setVersion(java.lang.String version)

equals

public boolean equals(java.lang.Object obj)
Description copied from class: BasicMetadataID
Returns true if the specified object is semantically equal to this instance. Note: this method is consistent with compareTo().

Specified by:
equals in interface MetadataID
Overrides:
equals in class BasicMetadataID
Parameters:
obj - the object that this instance is to be compared to.
Returns:
whether the object is equal to this object.

compareTo

public int compareTo(java.lang.Object obj)
Description copied from class: BasicMetadataID
Compares this object to another. If the specified object is an instance of the MetadataID class, then this method compares the name; otherwise, it throws a ClassCastException (as instances are comparable only to instances of the same class). Note: this method is consistent with equals(), meaning that (compare(x, y)==0) == (x.equals(y)).

The algorithm that this method follows is based primarily upon the hash code. When two instances of MetadataID, objects A and B, are being compared, this method first compares the (cached) hash code of the two objects. If the two hash codes are not equal, the method returns the difference in the hash codes (namely A.hashCode() - B.hashCode()). If, however, the two hash code values are equivalent, then the two MetadataID instances are potentially equivalent, and the full names of the BaseIDs are compared (ignoring case) to determine actual result.

Specified by:
compareTo in interface MetadataID
Specified by:
compareTo in interface java.lang.Comparable
Overrides:
compareTo in class BasicMetadataID
Parameters:
obj - the object that this instance is to be compared to.
Returns:
a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object, respectively.

compareToByName

public int compareToByName(java.lang.Object obj)
Description copied from class: BasicMetadataID
Compares this object to another lexicographically. If the specified object is an instance of the same class, then this method compares the name; otherwise, it throws a ClassCastException (as instances are comparable only to instances of the same class). Note: this method is consistent with equals().

Specified by:
compareToByName in interface MetadataID
Overrides:
compareToByName in class BasicMetadataID
Parameters:
obj - the object that this instance is to be compared to.
Returns:
a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object, respectively.

computeHashCode

protected int computeHashCode()
Description copied from class: BasicMetadataID
Return a new hash code value for this instance. If subclasses provide additional and non-transient fields, they should override this method using the following template:
 protected int computeHashCode() {
      int result = super.computeHashCode();
      result = HashCodeUtil.hashCode(result, ... );
      result = HashCodeUtil.hashCode(result, ... );
      return result;
 }
 
Any specialized implementation must not rely upon the hashCode method.

Note that this method does not and cannot actually update the hash code value. Rather, this method is called by the updateHashCode method.

Overrides:
computeHashCode in class BasicMetadataID
Returns:
the new hash code for this instance.


Copyright © 2009. All Rights Reserved.