gov.sandia.cognition.framework
Interface SemanticIdentifier

All Superinterfaces:
Comparable<SemanticIdentifier>, Serializable
All Known Implementing Classes:
AbstractSemanticIdentifier, DefaultSemanticIdentifier

public interface SemanticIdentifier
extends Serializable, Comparable<SemanticIdentifier>

The SemanticIdentifier class holds a SemanticLabel along with the unique integer that can be used to identify the SemanticLabel within a model. It is used so that dealing with SemanticLabels can be done really quickly by using an integer rather than using a String or more complex data structure. This is especially important in the hashCode and equals functions. Only developers implementing a new Cognitive Model type would should be concerned with implementing this interface. Developers using a model or developing a module should create SemanticIdentifiers through the model's SemanticIdentifierMap.

Since:
1.0
Author:
Justin Basilico, Kevin R. Dixon

Method Summary
 int compareTo(SemanticIdentifier o)
          
 boolean equals(Object other)
          Determines if this identifier is equal to another Object.
 boolean equals(SemanticIdentifier other)
          Determines if this identifier is equal to the given one by comparing the identifier number only.
 int getIdentifier()
          Gets the integer identifier for the SemanticLabel
 SemanticLabel getLabel()
          Gets the SemanticLabel.
 int hashCode()
          Computes the hash-code for the SemanticIdentifier, which should be equal to a call to getIdentifier.
 

Method Detail

hashCode

int hashCode()
Computes the hash-code for the SemanticIdentifier, which should be equal to a call to getIdentifier.

Overrides:
hashCode in class Object
Returns:
The hash code of the identifier, which is the identifier number.

compareTo

int compareTo(SemanticIdentifier o)

Specified by:
compareTo in interface Comparable<SemanticIdentifier>
Parameters:
o -
Returns:

equals

boolean equals(Object other)
Determines if this identifier is equal to another Object. If that Object is a SemanticIdentifier then the two are equal if the identifier numbers are the same.

Overrides:
equals in class Object
Parameters:
other - The Object to test equality with.
Returns:
True if this is equal to the given Object.

equals

boolean equals(SemanticIdentifier other)
Determines if this identifier is equal to the given one by comparing the identifier number only. This comparison is invalid if the two identifiers come from different models.

Parameters:
other - The other SemanticIdentifier to compare to.
Returns:
True if the two semantic identifiers are equal.

getLabel

SemanticLabel getLabel()
Gets the SemanticLabel.

Returns:
The SemanticLabel

getIdentifier

int getIdentifier()
Gets the integer identifier for the SemanticLabel

Returns:
The unique identifier for the label