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

java.lang.Object
  extended bygov.nih.nlm.umls.meta.impl.StringInfoImpl
All Implemented Interfaces:
Comparable, StringInfo, TermElement

public class StringInfoImpl
extends Object
implements StringInfo

Default implementation of the StringInfo interface.

Author:
Brian Carlsen, Deborah Shapiro

Constructor Summary
StringInfoImpl()
          Instantiates an empty StringInfo.
StringInfoImpl(StringInfo si)
          Instantiates a StringInfo from the specified StringInfo.
 
Method Summary
 void addAtom(Atom atom)
          Adds the specified Atom.
 void clearAtoms()
          Removes all Atoms.
 int compareTo(Object o)
          Compares this StringInfo to another one.
 boolean equals(Object o)
          Returns true if the specified object is equal to this object.
 Atom[] getAtoms()
          Returns all Atoms.
 List getAtomsAsList()
          Returns all Atoms as a List.
 String getKeyFields()
          Returns a String key which can be used by equals, compareTo, and hashCode methods.
 String getName()
          Sets the name (STR).
 String getStr()
          Shorthand for getName().
 String getStringIdentifier()
          Return the string identifier (SUI).
 StringType getStringType()
          Returns the StringType (STT).
 StringType getStt()
          Shorthand for getStringType().
 String getSui()
          Shorthand for getStringIdentifier().
 Term getTerm()
          Returns the parent Term.
 int hashCode()
          Return a hash code based on key fields.
 boolean hasPreferredStringIdentifier()
          Indicates whether or not this has the preferred string identifier of the Term it is part of.
 boolean hasPreferredSui()
          Shorthand for hasPreferredStringIdentifier().
 void removeAtom(Atom atom)
          Removes the specified Atom.
 void setAtoms(Atom[] l_atoms)
          Replaces the Atoms with those in the specified array.
 void setAtoms(List atoms)
          Replaces the Atoms with those in the specified List
 void setName(String str)
          Sets the name (STR).
 void setStr(String str)
          Shorthand for setName(String).
 void setStringIdentifier(String sui)
          Sets the string identifier (SUI).
 void setStringType(StringType stt)
          Sets the StringType (STT).
 void setStt(StringType stt)
          Shorthand for setStringType(StringType).
 void setSui(String sui)
          Shorthand for setStringIdentifier(String).
 void setTerm(Term term)
          Sets the parent Term.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringInfoImpl

public StringInfoImpl()
Instantiates an empty StringInfo.


StringInfoImpl

public StringInfoImpl(StringInfo si)
Instantiates a StringInfo from the specified StringInfo.

Parameters:
si - StringInfo to be copied
Method Detail

getTerm

public Term getTerm()
Returns the parent Term.

Specified by:
getTerm in interface TermElement
Returns:
the parent Term

setTerm

public void setTerm(Term term)
Sets the parent Term.

Specified by:
setTerm in interface TermElement
Parameters:
term - the parent Term

getStringType

public StringType getStringType()
Returns the StringType (STT).

Specified by:
getStringType in interface StringInfo
Returns:
the StringType

getStt

public StringType getStt()
Shorthand for getStringType().

Specified by:
getStt in interface StringInfo
Returns:
the StringType

setStringType

public void setStringType(StringType stt)
Sets the StringType (STT).

Specified by:
setStringType in interface StringInfo
Parameters:
stt - the STT

setStt

public void setStt(StringType stt)
Shorthand for setStringType(StringType).

Specified by:
setStt in interface StringInfo
Parameters:
stt - the STT

getSui

public String getSui()
Shorthand for getStringIdentifier().

Specified by:
getSui in interface StringInfo
Returns:
the SUI

setSui

public void setSui(String sui)
Shorthand for setStringIdentifier(String).

Specified by:
setSui in interface StringInfo
Parameters:
sui - the SUI

getStringIdentifier

public String getStringIdentifier()
Return the string identifier (SUI).

Specified by:
getStringIdentifier in interface StringInfo
Returns:
the SUI

setStringIdentifier

public void setStringIdentifier(String sui)
Sets the string identifier (SUI).

Specified by:
setStringIdentifier in interface StringInfo
Parameters:
sui - the SUI

getName

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

Specified by:
getName in interface StringInfo
Returns:
the name

getStr

public String getStr()
Shorthand for getName().

Specified by:
getStr in interface StringInfo
Returns:
the name

setName

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

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

setStr

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

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

getAtoms

public Atom[] getAtoms()
Returns all Atoms.

Specified by:
getAtoms in interface StringInfo
Returns:
an array of Atoms

getAtomsAsList

public List getAtomsAsList()
Returns all Atoms as a List.

Specified by:
getAtomsAsList in interface StringInfo
Returns:
all Atoms as a List

addAtom

public void addAtom(Atom atom)
Adds the specified Atom.

Specified by:
addAtom in interface StringInfo
Parameters:
atom - the Atom to add

removeAtom

public void removeAtom(Atom atom)
Removes the specified Atom.

Specified by:
removeAtom in interface StringInfo
Parameters:
atom - the Atom to remove

clearAtoms

public void clearAtoms()
Removes all Atoms.

Specified by:
clearAtoms in interface StringInfo

setAtoms

public void setAtoms(Atom[] l_atoms)
Replaces the Atoms with those in the specified array.

Specified by:
setAtoms in interface StringInfo
Parameters:
l_atoms - an array of Atoms

setAtoms

public void setAtoms(List atoms)
Replaces the Atoms with those in the specified List

Specified by:
setAtoms in interface StringInfo
Parameters:
atoms - a List of Atoms

getKeyFields

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

Specified by:
getKeyFields in interface StringInfo
Returns:
a String composed from the sui.

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

hasPreferredStringIdentifier

public boolean hasPreferredStringIdentifier()
Indicates whether or not this has the preferred string identifier of the Term it is part of. In other words, does this StringInfo have the same SUI as the preferred StringInfo of the Term.

Specified by:
hasPreferredStringIdentifier in interface StringInfo
Returns:
true if so, false otherwise

hasPreferredSui

public boolean hasPreferredSui()
Shorthand for hasPreferredStringIdentifier().

Specified by:
hasPreferredSui in interface StringInfo
Returns:
true if so, false otherwise


Copyright ©2005