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

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

public class ContextGroupImpl
extends Object
implements ContextGroup

Default implementation of the ContextGroup interface.

Author:
Brian Carlsen, Deborah Shapiro

Constructor Summary
ContextGroupImpl()
          Instantiates an empty ContextGroup.
ContextGroupImpl(ContextGroup cg)
          Instantiates a ContextGroup from the specified ContextGroup.
 
Method Summary
 void addStringContext(StringContext sc)
          Adds the specified StringContext.
 void clearStringContexts()
          Removes all StringContexts.
 int compareTo(Object o)
          Compares this ContextGroup 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 ContextGroup.
 String getKeyFields()
          Returns a String key which can be used by equals, compareTo, and hashCode methods.
 StringContext[] getStringContexts()
          Returns all StringContexts.
 List getStringContextsAsList()
          Returns all StringContexts as a List
 StringInfo getStringInfo()
          Return the StringInfo.
 int hashCode()
          Return a hash code based on key fields.
 void removeStringContext(StringContext sc)
          Removes the specified StringContext.
 void setConcept(Concept concept)
          Sets the Concept that holds this ContextGroup.
 void setStringContexts(List scs)
          replaces the StringContexts with the ones in the specified List.
 void setStringContexts(StringContext[] scs)
          Replaces the StringContexts with the ones in the specified array.
 void setStringInfo(StringInfo string_info)
          Sets the StringInfo.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContextGroupImpl

public ContextGroupImpl()
Instantiates an empty ContextGroup.


ContextGroupImpl

public ContextGroupImpl(ContextGroup cg)
Instantiates a ContextGroup from the specified ContextGroup.

Parameters:
cg - ContextGroup to be copied
Method Detail

getStringInfo

public StringInfo getStringInfo()
Return the StringInfo.

Specified by:
getStringInfo in interface ContextGroup
Returns:
the StringInfo

setStringInfo

public void setStringInfo(StringInfo string_info)
Sets the StringInfo.

Specified by:
setStringInfo in interface ContextGroup
Parameters:
string_info - the StringInfo

getStringContexts

public StringContext[] getStringContexts()
Returns all StringContexts.

Specified by:
getStringContexts in interface ContextGroup
Returns:
an array of StringContexts

getStringContextsAsList

public List getStringContextsAsList()
Returns all StringContexts as a List

Specified by:
getStringContextsAsList in interface ContextGroup
Returns:
a List of StringContexts

addStringContext

public void addStringContext(StringContext sc)
Adds the specified StringContext.

Specified by:
addStringContext in interface ContextGroup
Parameters:
sc - the StringContext to be added

removeStringContext

public void removeStringContext(StringContext sc)
Removes the specified StringContext.

Specified by:
removeStringContext in interface ContextGroup
Parameters:
sc - the StringContext to be removed

clearStringContexts

public void clearStringContexts()
Removes all StringContexts.

Specified by:
clearStringContexts in interface ContextGroup

setStringContexts

public void setStringContexts(StringContext[] scs)
Replaces the StringContexts with the ones in the specified array.

Specified by:
setStringContexts in interface ContextGroup
Parameters:
scs - a StringContext[]

setStringContexts

public void setStringContexts(List scs)
replaces the StringContexts with the ones in the specified List.

Specified by:
setStringContexts in interface ContextGroup
Parameters:
scs - a List of StringContexts

getConcept

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

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

setConcept

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

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

getKeyFields

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

Specified by:
getKeyFields in interface ContextGroup
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 a ContextGroup 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 ContextGroup 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