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

java.lang.Object
  extended bygov.nih.nlm.umls.meta.impl.ContextImpl
All Implemented Interfaces:
AtomElement, Comparable, ConceptElement, ContentViewElement, Context, SourceElement

public class ContextImpl
extends Object
implements Context

Default implementation of the Context interface.

Author:
Brian Carlsen, Deborah Shapiro

Nested Class Summary
 
Nested classes inherited from class gov.nih.nlm.umls.meta.AtomElement
AtomElement.ByLanguageRestrictor, AtomElement.BySourceRestrictor
 
Nested classes inherited from class gov.nih.nlm.umls.meta.SourceElement
SourceElement.BySourceComparator, SourceElement.BySourceRestrictor
 
Constructor Summary
ContextImpl()
          Instantiates an empty Context.
ContextImpl(Context cxt)
          Instantiates a Context from the specified Context.
 
Method Summary
 void addContextMember(ContextMember cm)
          Adds the specified ContextMember.
 void clearContextMembers()
          Removes all ContextMembers.
 int compareTo(Object o)
          Compares this Source to another one.
 boolean equals(Object o)
          Returns true if the specified object is equal to this object.
 AdditionalRelationshipLabel getAdditionalRelationshipLabel()
          Returns the AdditionalRelationshipLabel (RELA) from the context member to its parent.
 ContextMember[] getAncestorMembers()
          Returns only the ContextMembers that have the context member label (CXL) of "ANC" or self.
 List getAncestorMembersAsList()
          Returns only the ContextMembers that have the context member label (CXL) of "ANC" or self.
 Atom getAtom()
          Returns the Atom this Context is connected to.
 ContextMember[] getChildMembers()
          Returns only the ContextMembers that have the context member label (CXL) of "CHD" or child.
 List getChildMembersAsList()
          Returns only the ContextMembers that have the context member label (CXL) of "CHD" or child.
 Concept getConcept()
          Returns the Concept that holds this Context
 ContentView getContentView()
          Returns tbe ContentView definition for this Context (CVF).
 ContextMember[] getContextMembers()
          Returns all ContextMembers.
 List getContextMembersAsList()
          Returns all ContextMembers as a List.
 int getContextNumber()
          Returns the context number (CXN).
 ContentView getCvf()
          Shorthand for getContentView().
 int getCxn()
          This is a Shorthand for getContextNumber()
 String getHcd()
          Shorthand for getHierarchicalCode().
 String getHierarchicalCode()
          Returns the hierarchical code (HCD).
 String getKeyFields()
          Returns a String key which can be used by equals, compareTo, and hashCode methods.
 String getParentAtomIdentifier()
          Returns the parent atom identifier (PAUI).
 String[] getPathToRoot()
          Returns the path to the root (PTR) as a String[] of AUI values.
 List getPathToRootAsList()
          Returns the path to the root (PTR) as a List of AUI values.
 String getPathToRootAsString()
          Returns the path to the root (PTR) as a "." separated list of AUI values.
 String getPaui()
          Shorthand for getParentAtomIdentifier().
 String getPtr()
          Shorthand for getPathToRootAsString().
 AdditionalRelationshipLabel getRela()
          Shorthand for getAdditionalRelationshipLabel().
 ContextMember getSelfMember()
          Returns the ContextMember that has the context member label (CXL) of "CCP" or self.
 ContextMember[] getSiblingMembers()
          Returns only the ContextMembers that have the context member label (CXL) of "SIB" or self.
 List getSiblingMembersAsList()
          Returns only the ContextMembers that have the context member label (CXL) of "SIB" or self.
 Source getSource()
          Returns the source for this Context.
 int hashCode()
          Return a hash code based on key fields.
 boolean isTopLevel()
          Indicates if context is of the top level.
 void removeContextMember(ContextMember cm)
          Removes the specified ContextMember.
 void setAdditionalRelationshipLabel(AdditionalRelationshipLabel rela)
          Sets the AdditionalRelationshipLabel (RELA) from the context member to its parent.
 void setAtom(Atom atom)
          Sets the Atom this Context is connected to.
 void setConcept(Concept concept)
          Sets the Concept that holds this Context
 void setContentView(ContentView cvf)
          Sets tbe ContentView definition for this Context (CVF).
 void setContextMembers(ContextMember[] cms)
          Replaces the ContextMembers with the ones in the specified array.
 void setContextMembers(List cms)
          Replaces the ContextMembers with the ones in the specified List.
 void setContextNumber(int cxn)
          Sets the context number (CXN).
 void setCvf(ContentView cvf)
          Shorthand for setContentView(ContentView).
 void setCxn(int cxn)
          Shorthand for setContextNumber(int).
 void setHcd(String hcd)
          Shorthand for setHierarchicalCode(String).
 void setHierarchicalCode(String hcd)
          Sets the hierarchical code (HCD).
 void setParentAtomIdentifier(String paui)
          Sets the parent atom identifier (PAUI).
 void setPathToRoot(String ptr)
          Sets the path to the root (PTR) as a "." separated list of AUI values.
 void setPaui(String paui)
          Shorthand for setParentAtomIdentifier(String).
 void setPtr(String ptr)
          Shorthand for setPathToRoot(String).
 void setRela(AdditionalRelationshipLabel rela)
          Shorthand for setAdditionalRelationshipLabel(AdditionalRelationshipLabel).
 void setSource(Source source)
          Sets the source for this Context.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContextImpl

public ContextImpl()
Instantiates an empty Context.


ContextImpl

public ContextImpl(Context cxt)
Instantiates a Context from the specified Context.

Parameters:
cxt - Context to be copied
Method Detail

getAtom

public Atom getAtom()
Returns the Atom this Context is connected to.

Specified by:
getAtom in interface AtomElement
Returns:
the Atom this Context is connected to

setAtom

public void setAtom(Atom atom)
Sets the Atom this Context is connected to.

Specified by:
setAtom in interface AtomElement
Parameters:
atom - the Atom this Context is connected to

getContextNumber

public int getContextNumber()
Returns the context number (CXN).

Specified by:
getContextNumber in interface Context
Returns:
the int context number

setContextNumber

public void setContextNumber(int cxn)
Sets the context number (CXN).

Specified by:
setContextNumber in interface Context
Parameters:
cxn - the int context number

getCxn

public int getCxn()
This is a Shorthand for getContextNumber()

Specified by:
getCxn in interface Context
Returns:
cxn context number int

setCxn

public void setCxn(int cxn)
Shorthand for setContextNumber(int).

Specified by:
setCxn in interface Context
Parameters:
cxn - int context number

getPaui

public String getPaui()
Shorthand for getParentAtomIdentifier().

Specified by:
getPaui in interface Context
Returns:
the PAUI

setPaui

public void setPaui(String paui)
Shorthand for setParentAtomIdentifier(String).

Specified by:
setPaui in interface Context
Parameters:
paui - the PAUI

getParentAtomIdentifier

public String getParentAtomIdentifier()
Returns the parent atom identifier (PAUI).

Specified by:
getParentAtomIdentifier in interface Context
Returns:
the PAUI

setParentAtomIdentifier

public void setParentAtomIdentifier(String paui)
Sets the parent atom identifier (PAUI).

Specified by:
setParentAtomIdentifier in interface Context
Parameters:
paui - the PAUI

getPathToRootAsString

public String getPathToRootAsString()
Returns the path to the root (PTR) as a "." separated list of AUI values.

Specified by:
getPathToRootAsString in interface Context
Returns:
the path to the root

getPathToRootAsList

public List getPathToRootAsList()
Returns the path to the root (PTR) as a List of AUI values.

Specified by:
getPathToRootAsList in interface Context
Returns:
the path to the root as a List of AUI values

getPathToRoot

public String[] getPathToRoot()
Returns the path to the root (PTR) as a String[] of AUI values.

Specified by:
getPathToRoot in interface Context
Returns:
the path to the root as a String[] of AUI values

getPtr

public String getPtr()
Shorthand for getPathToRootAsString().

Specified by:
getPtr in interface Context
Returns:
the path to the root

setPathToRoot

public void setPathToRoot(String ptr)
Sets the path to the root (PTR) as a "." separated list of AUI values.

Specified by:
setPathToRoot in interface Context
Parameters:
ptr - the path to the root

setPtr

public void setPtr(String ptr)
Shorthand for setPathToRoot(String).

Specified by:
setPtr in interface Context
Parameters:
ptr - the path to the root

getContextMembers

public ContextMember[] getContextMembers()
Returns all ContextMembers. These are the ancestors, children, and siblings.

Specified by:
getContextMembers in interface Context
Returns:
a sorted array of ContextMembers

getContextMembersAsList

public List getContextMembersAsList()
Returns all ContextMembers as a List. These are the ancestors, children, and siblings.

Specified by:
getContextMembersAsList in interface Context
Returns:
a sorted List of ContextMembers

addContextMember

public void addContextMember(ContextMember cm)
Adds the specified ContextMember.

Specified by:
addContextMember in interface Context
Parameters:
cm - the ContextMember to be added

removeContextMember

public void removeContextMember(ContextMember cm)
Removes the specified ContextMember.

Specified by:
removeContextMember in interface Context
Parameters:
cm - the ContextMember to be removed

clearContextMembers

public void clearContextMembers()
Removes all ContextMembers.

Specified by:
clearContextMembers in interface Context

setContextMembers

public void setContextMembers(ContextMember[] cms)
Replaces the ContextMembers with the ones in the specified array.

Specified by:
setContextMembers in interface Context
Parameters:
cms - a ContextMember[]

setContextMembers

public void setContextMembers(List cms)
Replaces the ContextMembers with the ones in the specified List.

Specified by:
setContextMembers in interface Context
Parameters:
cms - a List of ContextMembers

getConcept

public Concept getConcept()
Returns the Concept that holds this Context

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

setConcept

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

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

getSource

public Source getSource()
Returns the source for this Context.

Specified by:
getSource in interface SourceElement
Returns:
Source

setSource

public void setSource(Source source)
Sets the source for this Context.

Specified by:
setSource in interface SourceElement
Parameters:
source - Source

getContentView

public ContentView getContentView()
Returns tbe ContentView definition for this Context (CVF).

Specified by:
getContentView in interface ContentViewElement
Returns:
tbe ContentView definition

setContentView

public void setContentView(ContentView cvf)
Sets tbe ContentView definition for this Context (CVF).

Specified by:
setContentView in interface ContentViewElement
Parameters:
cvf - the ContentView definition

getCvf

public ContentView getCvf()
Shorthand for getContentView().

Specified by:
getCvf in interface ContentViewElement
Returns:
tbe ContentView definition

setCvf

public void setCvf(ContentView cvf)
Shorthand for setContentView(ContentView).

Specified by:
setCvf in interface ContentViewElement
Parameters:
cvf - the ContentView definition

getHierarchicalCode

public String getHierarchicalCode()
Returns the hierarchical code (HCD).

Specified by:
getHierarchicalCode in interface Context
Returns:
the hierarchical code

getHcd

public String getHcd()
Shorthand for getHierarchicalCode().

Specified by:
getHcd in interface Context
Returns:
the hierarchical code

setHierarchicalCode

public void setHierarchicalCode(String hcd)
Sets the hierarchical code (HCD).

Specified by:
setHierarchicalCode in interface Context
Parameters:
hcd - the hierarchical code

setHcd

public void setHcd(String hcd)
Shorthand for setHierarchicalCode(String).

Specified by:
setHcd in interface Context
Parameters:
hcd - the hierarchical code

getAdditionalRelationshipLabel

public AdditionalRelationshipLabel getAdditionalRelationshipLabel()
Returns the AdditionalRelationshipLabel (RELA) from the context member to its parent.

Specified by:
getAdditionalRelationshipLabel in interface Context
Returns:
the AdditionalRelationshipLabel

getRela

public AdditionalRelationshipLabel getRela()
Shorthand for getAdditionalRelationshipLabel().

Specified by:
getRela in interface Context
Returns:
the AdditionalRelationshipLabel

setAdditionalRelationshipLabel

public void setAdditionalRelationshipLabel(AdditionalRelationshipLabel rela)
Sets the AdditionalRelationshipLabel (RELA) from the context member to its parent.

Specified by:
setAdditionalRelationshipLabel in interface Context
Parameters:
rela - the AdditionalRelationshipLabel

setRela

public void setRela(AdditionalRelationshipLabel rela)
Shorthand for setAdditionalRelationshipLabel(AdditionalRelationshipLabel).

Specified by:
setRela in interface Context
Parameters:
rela - the AdditionalRelationshipLabel

getSelfMember

public ContextMember getSelfMember()
Returns the ContextMember that has the context member label (CXL) of "CCP" or self.

Specified by:
getSelfMember in interface Context
Returns:
ContextMember with label "CCP"

getChildMembers

public ContextMember[] getChildMembers()
Returns only the ContextMembers that have the context member label (CXL) of "CHD" or child.

Specified by:
getChildMembers in interface Context
Returns:
ContextMember[] of members with label "CHD"

getChildMembersAsList

public List getChildMembersAsList()
Returns only the ContextMembers that have the context member label (CXL) of "CHD" or child.

Specified by:
getChildMembersAsList in interface Context
Returns:
ContextMember[] of members with label "CHD"

getAncestorMembers

public ContextMember[] getAncestorMembers()
Returns only the ContextMembers that have the context member label (CXL) of "ANC" or self.

Specified by:
getAncestorMembers in interface Context
Returns:
ContextMember[] of members with label "ANC"

getAncestorMembersAsList

public List getAncestorMembersAsList()
Returns only the ContextMembers that have the context member label (CXL) of "ANC" or self.

Specified by:
getAncestorMembersAsList in interface Context
Returns:
ContextMember[] of members with label "ANC"

getSiblingMembers

public ContextMember[] getSiblingMembers()
Returns only the ContextMembers that have the context member label (CXL) of "SIB" or self.

Specified by:
getSiblingMembers in interface Context
Returns:
ContextMember[] of members with label "SIB"

getSiblingMembersAsList

public List getSiblingMembersAsList()
Returns only the ContextMembers that have the context member label (CXL) of "SIB" or self.

Specified by:
getSiblingMembersAsList in interface Context
Returns:
ContextMember[] of members with label "SIB"

isTopLevel

public boolean isTopLevel()
Indicates if context is of the top level.

Specified by:
isTopLevel in interface Context
Returns:
boolean true if top level false if otherwise

getKeyFields

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

Specified by:
getKeyFields in interface Context
Returns:
a String composed from the cui, aui, sui, versioned source, cxn, 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 Context 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 Source 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