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

java.lang.Object
  extended bygov.nih.nlm.umls.meta.impl.ContextMemberImpl
All Implemented Interfaces:
Comparable, ContextMember, RelatedAtomElement, RelatedConceptElement

public class ContextMemberImpl
extends Object
implements ContextMember

Default implementation of the ContextMember interface.

Author:
Brian Carlsen, Deborah Shapiro

Field Summary
protected  String key_fields
           
protected  boolean key_fields_flag
           
 
Constructor Summary
ContextMemberImpl()
          Instantiates an empty ContextMember.
ContextMemberImpl(ContextMember cm)
          Instantiates a ContextMember from the specified ContextMember.
 
Method Summary
 int compareTo(Object o)
          Compares this ContextMember 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.
 String getCxl()
          Shorthand for getLabel().
 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 getLabel()
          Returns the label for this ContextMember (CXL).
 int getRank()
          Returns the rank (RNK) if the member is an ancestor.
 AdditionalRelationshipLabel getRela()
          Shorthand for getAdditionalRelationshipLabel().
 Atom getRelatedAtom()
          Returns the related Atom of the ancestor, sibling, or child.
 Concept getRelatedConcept()
          Returns the related concept of the ancestor, sibling, or child.
 String getXc()
          Returns the "has child flag" value (XC).
 boolean hasChild()
          Indicates whether or not this context member has children.
 int hashCode()
          Return a hash code based on key fields.
 void setAdditionalRelationshipLabel(AdditionalRelationshipLabel rela)
          Sets the AdditionalRelationshipLabel (RELA) from the context member to its parent.
 void setCxl(String cxl)
          Shorthand for setLabel(String).
 void setHasChild(boolean xc)
          Sets the flag indicating whether or not this ContextMember has a child.
 void setHcd(String hcd)
          Shorthand for setHierarchicalCode(String).
 void setHierarchicalCode(String hcd)
          Sets the hierarchical code (HCD).
 void setLabel(String cxl)
          Sets the label for this ContextMember.
 void setRank(int rnk)
          Sets the rank (RNK) if the member is an ancestor
 void setRela(AdditionalRelationshipLabel rela)
          Shorthand for setAdditionalRelationshipLabel(AdditionalRelationshipLabel).
 void setRelatedAtom(Atom related_atom)
          Sets the related atom of the ancestor, sibling, or child.
 void setRelatedConcept(Concept related_concept)
          Sets the related concept of the ancestor, sibling, or child.
 void setXc(String xc)
          Sets the "has child flag" value (XC).
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

key_fields_flag

protected boolean key_fields_flag

key_fields

protected String key_fields
Constructor Detail

ContextMemberImpl

public ContextMemberImpl()
Instantiates an empty ContextMember.


ContextMemberImpl

public ContextMemberImpl(ContextMember cm)
Instantiates a ContextMember from the specified ContextMember.

Parameters:
cm - ContextMember to be copied
Method Detail

getRank

public int getRank()
Returns the rank (RNK) if the member is an ancestor.

Specified by:
getRank in interface ContextMember
Returns:
the int rank

setRank

public void setRank(int rnk)
Sets the rank (RNK) if the member is an ancestor

Specified by:
setRank in interface ContextMember
Parameters:
rnk - the int rank

getRelatedConcept

public Concept getRelatedConcept()
Returns the related concept of the ancestor, sibling, or child.

Specified by:
getRelatedConcept in interface RelatedConceptElement
Returns:
the related concept of the ancestor, sibling, or child

setRelatedConcept

public void setRelatedConcept(Concept related_concept)
Sets the related concept of the ancestor, sibling, or child.

Specified by:
setRelatedConcept in interface RelatedConceptElement
Parameters:
related_concept - the related concept of the ancestor, sibling, or child

getRelatedAtom

public Atom getRelatedAtom()
Returns the related Atom of the ancestor, sibling, or child.

Specified by:
getRelatedAtom in interface RelatedAtomElement
Returns:
the related Atom of the ancestor, sibling, or child

setRelatedAtom

public void setRelatedAtom(Atom related_atom)
Sets the related atom of the ancestor, sibling, or child.

Specified by:
setRelatedAtom in interface RelatedAtomElement
Parameters:
related_atom - the related atom of the ancestor, sibling, or child

getHierarchicalCode

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

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

getHcd

public String getHcd()
Shorthand for getHierarchicalCode().

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

setHierarchicalCode

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

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

setHcd

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

Specified by:
setHcd in interface ContextMember
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 ContextMember
Returns:
the AdditionalRelationshipLabel

getRela

public AdditionalRelationshipLabel getRela()
Shorthand for getAdditionalRelationshipLabel().

Specified by:
getRela in interface ContextMember
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 ContextMember
Parameters:
rela - the AdditionalRelationshipLabel

setRela

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

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

getXc

public String getXc()
Returns the "has child flag" value (XC).

Specified by:
getXc in interface ContextMember
Returns:
the "has child flag" value

setXc

public void setXc(String xc)
Sets the "has child flag" value (XC).

Specified by:
setXc in interface ContextMember
Parameters:
xc - the "has child flag" value

hasChild

public boolean hasChild()
Indicates whether or not this context member has children.

Specified by:
hasChild in interface ContextMember
Returns:
true if ContextMember has a child, false if ContextMember does not have a child

setHasChild

public void setHasChild(boolean xc)
Sets the flag indicating whether or not this ContextMember has a child.

Specified by:
setHasChild in interface ContextMember
Parameters:
xc - true if ContextMember has a child, false if ContextMember does not have a child

getLabel

public String getLabel()
Returns the label for this ContextMember (CXL).

Specified by:
getLabel in interface ContextMember
Returns:
the label for this ContextMember

getCxl

public String getCxl()
Shorthand for getLabel().

Specified by:
getCxl in interface ContextMember
Returns:
the label for this ContextMember

setLabel

public void setLabel(String cxl)
Sets the label for this ContextMember.

Specified by:
setLabel in interface ContextMember
Parameters:
cxl - context label

setCxl

public void setCxl(String cxl)
Shorthand for setLabel(String).

Specified by:
setCxl in interface ContextMember
Parameters:
cxl - the label for this ContextMember

getKeyFields

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

Specified by:
getKeyFields in interface ContextMember
Returns:
a String composed from the cxl, rank, str cui2, and aui2.

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