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

java.lang.Object
  extended bygov.nih.nlm.umls.meta.impl.SourceContextImpl
All Implemented Interfaces:
AtomElement, Comparable, ContentViewElement, SourceContext

public class SourceContextImpl
extends Object
implements SourceContext

Default implementation fo the SourceContext interface.

Author:
Brian Carlsen, Deborah Shapiro

Nested Class Summary
 
Nested classes inherited from class gov.nih.nlm.umls.meta.AtomElement
AtomElement.ByLanguageRestrictor, AtomElement.BySourceRestrictor
 
Constructor Summary
SourceContextImpl()
          Instantiates an empty SourceContext.
SourceContextImpl(SourceContext sc)
          Instantiates a SourceContext from the specified SourceContext.
 
Method Summary
 void addContextMember(ContextMember cm)
          Adds the specified ContextMember.
 void clearContextMembers()
          Removes all ContextMembers.
 int compareTo(Object o)
          Compares this SourceContext to another one.
 boolean equals(Object o)
          Returns true if the specified object is equal to this object.
 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 SourceContext 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.
 ContentView getContentView()
          Returns tbe ContentView definition for this SourceContext (CVF).
 ContextMember[] getContextMembers()
          Returns the ContextMembers.
 List getContextMembersAsList()
          Returns the ContextMembers.
 int getContextNumber()
          Returns the context number (CXN).
 ContentView getCvf()
          Shorthand for getContentView().
 int getCxn()
          This is a shorthand for getContextNumber()
 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().
 ContextMember[] getSelfMembers()
          Returns only the ContextMembers that have the context member label (CXL) of "CCP" or self.
 List getSelfMembersAsList()
          Returns only the ContextMembers that have 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.
 StringContext getStringContext()
          Returns the StringContext that holds this SourceContext.
 int hashCode()
          Return a hash code based on key fields.
 void removeContextMember(ContextMember cm)
          Removes the specified ContextMember.
 void setAtom(Atom atom)
          Sets the Atom this SourceContext is connected to.
 void setContentView(ContentView cvf)
          Sets tbe ContentView definition for this SourceContext (CVF).
 void setContextMembers(ContextMember[] cms)
          Set the ContextMembers with the ones in the specified array.
 void setContextMembers(List cms)
          Set 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 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 setStringContext(StringContext sc)
          Sets the StringContext that holds this SourceContext.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SourceContextImpl

public SourceContextImpl()
Instantiates an empty SourceContext.


SourceContextImpl

public SourceContextImpl(SourceContext sc)
Instantiates a SourceContext from the specified SourceContext.

Parameters:
sc - SourceContext to be copied
Method Detail

getStringContext

public StringContext getStringContext()
Returns the StringContext that holds this SourceContext.

Specified by:
getStringContext in interface SourceContext
Returns:
the StringContext that holds this SourceContext

setStringContext

public void setStringContext(StringContext sc)
Sets the StringContext that holds this SourceContext.

Specified by:
setStringContext in interface SourceContext
Parameters:
sc - the StringContext that holds this SourceContext

getContextNumber

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

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

setContextNumber

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

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

getCxn

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

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

setCxn

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

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

getPaui

public String getPaui()
Shorthand for getParentAtomIdentifier().

Specified by:
getPaui in interface SourceContext
Returns:
the PAUI

setPaui

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

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

getParentAtomIdentifier

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

Specified by:
getParentAtomIdentifier in interface SourceContext
Returns:
the PAUI

setParentAtomIdentifier

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

Specified by:
setParentAtomIdentifier in interface SourceContext
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 SourceContext
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 SourceContext
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 SourceContext
Returns:
the path to the root as a String[] of AUI values

getPtr

public String getPtr()
Shorthand for getPathToRootAsString().

Specified by:
getPtr in interface SourceContext
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 SourceContext
Parameters:
ptr - the path to the root

setPtr

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

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

getContextMembers

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

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

getContextMembersAsList

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

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

addContextMember

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

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

removeContextMember

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

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

clearContextMembers

public void clearContextMembers()
Removes all ContextMembers.

Specified by:
clearContextMembers in interface SourceContext

setContextMembers

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

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

setContextMembers

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

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

getAtom

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

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

setAtom

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

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

getContentView

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

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

setContentView

public void setContentView(ContentView cvf)
Sets tbe ContentView definition for this SourceContext (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

getSelfMembers

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

Specified by:
getSelfMembers in interface SourceContext
Returns:
ContextMember[] of members with label "CCP"

getSelfMembersAsList

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

Specified by:
getSelfMembersAsList in interface SourceContext
Returns:
List of members 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 SourceContext
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 SourceContext
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 SourceContext
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 SourceContext
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 SourceContext
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 SourceContext
Returns:
ContextMember[] of members with label "SIB"

getKeyFields

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

Specified by:
getKeyFields in interface SourceContext
Returns:
a String composed from the cui and aui.

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