gov.nih.nlm.umls.meta.impl
Class StringAttributeImpl

java.lang.Object
  extended bygov.nih.nlm.umls.meta.impl.StringAttributeImpl
All Implemented Interfaces:
Comparable, StringAttribute

public class StringAttributeImpl
extends Object
implements StringAttribute

Default implementation of the StringAttribute interface.

Author:
Brian Carlsen, Deborah Shapiro

Constructor Summary
StringAttributeImpl()
          Instantiates an empty StringAttribute.
StringAttributeImpl(StringAttribute sa)
          Instantiates a StringAttribute from the specified StringAttribute.
 
Method Summary
 void addAttributeContext(AttributeContext ac)
          Adds the specified AttributeContext.
 void clearAttributeContexts()
          Removes all AttributeContexts.
 int compareTo(Object o)
          Compares this StringAttribute to another one.
 boolean equals(Object o)
          Returns true if the specified object is equal to this object.
 AttributeContext[] getAttributeContexts()
          Returns all AttributeContexts.
 List getAttributeContextsAsList()
          Returns all AttributeContexts as a List.
 String getKeyFields()
          Returns a String key which can be used by equals, compareTo, and hashCode methods.
 StringInfo getStringInfo()
          Returns the StringInfo.
 TermAttribute getTermAttribute()
          Returns the TermAttribute that holds this StringAttribute.
 int hashCode()
          Return a hash code based on key fields.
 void removeAttributeContext(AttributeContext ac)
          Removes the specified AttributeContext.
 void setAttributeContexts(AttributeContext[] acs)
          Replaces the AttributeContexts with the ones in the specified array.
 void setAttributeContexts(List acs)
          Replaces the AttributeContexts with the ones in the specified List.
 void setStringInfo(StringInfo si)
          Sets the StringInfo.
 void setTermAttribute(TermAttribute ta)
          Sets the TermAttribute that holds this StringAttribute.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringAttributeImpl

public StringAttributeImpl()
Instantiates an empty StringAttribute.


StringAttributeImpl

public StringAttributeImpl(StringAttribute sa)
Instantiates a StringAttribute from the specified StringAttribute.

Parameters:
sa - StringAttribute to be copied
Method Detail

getTermAttribute

public TermAttribute getTermAttribute()
Returns the TermAttribute that holds this StringAttribute.

Specified by:
getTermAttribute in interface StringAttribute
Returns:
the TermAttribute that holds this StringAttribute

setTermAttribute

public void setTermAttribute(TermAttribute ta)
Sets the TermAttribute that holds this StringAttribute.

Specified by:
setTermAttribute in interface StringAttribute
Parameters:
ta - the TermAttribute that holds this StringAttribute

getStringInfo

public StringInfo getStringInfo()
Returns the StringInfo.

Specified by:
getStringInfo in interface StringAttribute
Returns:
the StringInfo

setStringInfo

public void setStringInfo(StringInfo si)
Sets the StringInfo.

Specified by:
setStringInfo in interface StringAttribute
Parameters:
si - the StringInfo

getAttributeContexts

public AttributeContext[] getAttributeContexts()
Returns all AttributeContexts.

Specified by:
getAttributeContexts in interface StringAttribute
Returns:
a array of AttributeContexts

getAttributeContextsAsList

public List getAttributeContextsAsList()
Returns all AttributeContexts as a List.

Specified by:
getAttributeContextsAsList in interface StringAttribute
Returns:
a List of AttributeContexts

addAttributeContext

public void addAttributeContext(AttributeContext ac)
Adds the specified AttributeContext.

Specified by:
addAttributeContext in interface StringAttribute
Parameters:
ac - the AttributeContext to be added

removeAttributeContext

public void removeAttributeContext(AttributeContext ac)
Removes the specified AttributeContext.

Specified by:
removeAttributeContext in interface StringAttribute
Parameters:
ac - the AttributeContext to be removed

clearAttributeContexts

public void clearAttributeContexts()
Removes all AttributeContexts.

Specified by:
clearAttributeContexts in interface StringAttribute

setAttributeContexts

public void setAttributeContexts(AttributeContext[] acs)
Replaces the AttributeContexts with the ones in the specified array.

Specified by:
setAttributeContexts in interface StringAttribute
Parameters:
acs - a AttributeContext[]

setAttributeContexts

public void setAttributeContexts(List acs)
Replaces the AttributeContexts with the ones in the specified List.

Specified by:
setAttributeContexts in interface StringAttribute
Parameters:
acs - a List of AttributeContexts

getKeyFields

public String getKeyFields()
Returns a String key which can be used by equals, compareTo, and hashCode methods.

Specified by:
getKeyFields in interface StringAttribute
Returns:
a String composed from the cui, aui, sui, versioned source, tty, and code.

hashCode

public int hashCode()
Return a hash code based on key fields.

Returns:
a hash code based on key fields

equals

public boolean equals(Object o)
Returns true if the specified object is equal to this object. The specified object must be an StringAttribute with matching key fields.

Parameters:
o - an Object to compare against
Returns:
boolean true if Object o is equal false otherwise

compareTo

public int compareTo(Object o)
Compares this StringAttribute to another one. Results are indeterminate if the specified parameter is not of the same class.

Specified by:
compareTo in interface Comparable
Parameters:
o - the Object to compare to
Returns:
int representing the relative ordering of this and the compare-to object


Copyright ©2005