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

java.lang.Object
  extended bygov.nih.nlm.umls.meta.impl.TermImpl
All Implemented Interfaces:
Comparable, ConceptElement, Term

public class TermImpl
extends Object
implements Term

Default implementation of the Term interface.

Author:
Brian Carlsen, Deborah Shapiro

Constructor Summary
TermImpl()
          Instantiates an empty Term.
TermImpl(Term term)
          Instantiates a Term from the specified Term.
 
Method Summary
 void addTermAttribute(TermAttribute ta)
          Adds the specified TermAttribute.
 void addTermVariant(StringInfo tv)
          Adds the specified term variant.
 void clearTermAttributes()
          Removes all TermAttributes.
 void clearTermVariants()
          Removes all term variants.
 int compareTo(Object o)
          Compares this Term to another one.
 boolean equals(Object o)
          Returns true if the specified object is equal to this object.
 Concept getConcept()
          Returns the Concept that holds this Term.
 String getKeyFields()
          Returns a String key which can be used by equals, compareTo, and hashCode methods.
 Language getLanguage()
          Returns the Language (LAT).
 Language getLat()
          Shorthand for getLanguage().
 String getLui()
          Shorthand for getTermIdentifier().
 String getName()
          Sets the name (STR).
 String getStr()
          Shorthand for getName().
 TermAttribute[] getTermAttributes()
          Returns all TermAttributes.
 List getTermAttributesAsList()
          Returns all TermAttributes as a List.
 String getTermIdentifier()
          Returns the term identifier (LUI).
 TermStatus getTermStatus()
          Returns the TermStatus (TS).
 StringInfo[] getTermVariants()
          Returns all StringInfo term variants.
 List getTermVariantsAsList()
          Returns all StringInfo term variants as a List.
 TermStatus getTs()
          Shorthand for getTermStatus().
 int hashCode()
          Return a hash code based on key fields.
 boolean hasPreferredLui()
          Shorthand for hasPreferredTermIdentifier()
 boolean hasPreferredTermIdentifier()
          Indicates whether or not this Term is the preferred Term of the Concept.
 void removeTermAttribute(TermAttribute ta)
          Removes the specified TermAttribute.
 void removeTermVariant(StringInfo tv)
          Removes the specified term variant.
 void setConcept(Concept concept)
          Sets the Concept that holds this Term.
 void setLanguage(Language lat)
          Sets the Language (LAT).
 void setLat(Language lat)
          Shorthand for setLanguage(Language).
 void setLui(String lui)
          Shorthand for setTermIdentifier(String).
 void setName(String str)
          Sets the name (STR).
 void setStr(String str)
          Shorthand for setName(String).
 void setTermAttributes(List tas)
          Replaces TermAttributes with the specified List
 void setTermAttributes(TermAttribute[] tas)
          Replaces the TermAttributes with the specified TermAttribute objects.
 void setTermIdentifier(String lui)
          Sets the term identifier (LUI).
 void setTermStatus(TermStatus ts)
          Sets the TermStatus (TS).
 void setTermVariants(List tvs)
          Replaces term variants with the specified List
 void setTermVariants(StringInfo[] tvs)
          Replaces term variants with the specified StringInfo objects.
 void setTs(TermStatus ts)
          Shorthand for setTermStatus(TermStatus).
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TermImpl

public TermImpl()
Instantiates an empty Term.


TermImpl

public TermImpl(Term term)
Instantiates a Term from the specified Term.

Parameters:
term - Term to be copied
Method Detail

getLanguage

public Language getLanguage()
Returns the Language (LAT).

Specified by:
getLanguage in interface Term
Returns:
the Language

getLat

public Language getLat()
Shorthand for getLanguage().

Specified by:
getLat in interface Term
Returns:
Language

setLanguage

public void setLanguage(Language lat)
Sets the Language (LAT).

Specified by:
setLanguage in interface Term
Parameters:
lat - the Language

setLat

public void setLat(Language lat)
Shorthand for setLanguage(Language).

Specified by:
setLat in interface Term
Parameters:
lat - the Language

getTermStatus

public TermStatus getTermStatus()
Returns the TermStatus (TS).

Specified by:
getTermStatus in interface Term
Returns:
the TermStatus

getTs

public TermStatus getTs()
Shorthand for getTermStatus().

Specified by:
getTs in interface Term
Returns:
the TermStatus

setTermStatus

public void setTermStatus(TermStatus ts)
Sets the TermStatus (TS).

Specified by:
setTermStatus in interface Term
Parameters:
ts - the TermStatus

setTs

public void setTs(TermStatus ts)
Shorthand for setTermStatus(TermStatus).

Specified by:
setTs in interface Term
Parameters:
ts - the TermStatus

getLui

public String getLui()
Shorthand for getTermIdentifier().

Specified by:
getLui in interface Term
Returns:
the LUI

setLui

public void setLui(String lui)
Shorthand for setTermIdentifier(String).

Specified by:
setLui in interface Term
Parameters:
lui - the LUI

getTermIdentifier

public String getTermIdentifier()
Returns the term identifier (LUI).

Specified by:
getTermIdentifier in interface Term
Returns:
the LUI

setTermIdentifier

public void setTermIdentifier(String lui)
Sets the term identifier (LUI).

Specified by:
setTermIdentifier in interface Term
Parameters:
lui - the LUI

getName

public String getName()
Sets the name (STR).

Specified by:
getName in interface Term
Returns:
the name

getStr

public String getStr()
Shorthand for getName().

Specified by:
getStr in interface Term
Returns:
the name

setName

public void setName(String str)
Sets the name (STR).

Specified by:
setName in interface Term
Parameters:
str - the name

setStr

public void setStr(String str)
Shorthand for setName(String).

Specified by:
setStr in interface Term
Parameters:
str - the name

getTermVariants

public StringInfo[] getTermVariants()
Returns all StringInfo term variants.

Specified by:
getTermVariants in interface Term
Returns:
an array of StringInfo objects

getTermVariantsAsList

public List getTermVariantsAsList()
Returns all StringInfo term variants as a List.

Specified by:
getTermVariantsAsList in interface Term
Returns:
all StringInfo term variants as a List

addTermVariant

public void addTermVariant(StringInfo tv)
Adds the specified term variant.

Specified by:
addTermVariant in interface Term
Parameters:
tv - a StringInfo term variant to add

clearTermVariants

public void clearTermVariants()
Removes all term variants.

Specified by:
clearTermVariants in interface Term

removeTermVariant

public void removeTermVariant(StringInfo tv)
Removes the specified term variant.

Specified by:
removeTermVariant in interface Term
Parameters:
tv - a StringInfo term variant to remove

setTermVariants

public void setTermVariants(StringInfo[] tvs)
Replaces term variants with the specified StringInfo objects.

Specified by:
setTermVariants in interface Term
Parameters:
tvs - an array of StringInfo objects

setTermVariants

public void setTermVariants(List tvs)
Replaces term variants with the specified List

Specified by:
setTermVariants in interface Term
Parameters:
tvs - a List of StringInfo objects

getTermAttributes

public TermAttribute[] getTermAttributes()
Returns all TermAttributes.

Specified by:
getTermAttributes in interface Term
Returns:
an array of TermAttribute objects

getTermAttributesAsList

public List getTermAttributesAsList()
Returns all TermAttributes as a List.

Specified by:
getTermAttributesAsList in interface Term
Returns:
all TermAttributes as a List

addTermAttribute

public void addTermAttribute(TermAttribute ta)
Adds the specified TermAttribute.

Specified by:
addTermAttribute in interface Term
Parameters:
ta - a TermAttribute to add

clearTermAttributes

public void clearTermAttributes()
Removes all TermAttributes.

Specified by:
clearTermAttributes in interface Term

removeTermAttribute

public void removeTermAttribute(TermAttribute ta)
Removes the specified TermAttribute.

Specified by:
removeTermAttribute in interface Term
Parameters:
ta - the TermAttribute to remove

setTermAttributes

public void setTermAttributes(TermAttribute[] tas)
Replaces the TermAttributes with the specified TermAttribute objects.

Specified by:
setTermAttributes in interface Term
Parameters:
tas - an array of TermAttribute objects

setTermAttributes

public void setTermAttributes(List tas)
Replaces TermAttributes with the specified List

Specified by:
setTermAttributes in interface Term
Parameters:
tas - a List of TermAttribute objects

getConcept

public Concept getConcept()
Returns the Concept that holds this Term.

Specified by:
getConcept in interface ConceptElement
Returns:
the Concept that holds this Term

setConcept

public void setConcept(Concept concept)
Sets the Concept that holds this Term.

Specified by:
setConcept in interface ConceptElement
Parameters:
concept - the Concept that holds this Term

getKeyFields

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

Specified by:
getKeyFields in interface Term
Returns:
a String composed from the cui and lui.

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 Term 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 Term 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

hasPreferredTermIdentifier

public boolean hasPreferredTermIdentifier()
Indicates whether or not this Term is the preferred Term of the Concept. In other words, does this Term have the same LUI as the preferred Term of the Concept.

Specified by:
hasPreferredTermIdentifier in interface Term
Returns:
true if so, false otherwise

hasPreferredLui

public boolean hasPreferredLui()
Shorthand for hasPreferredTermIdentifier()

Specified by:
hasPreferredLui in interface Term
Returns:
true if so, false otherwise


Copyright ©2005