Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.bdgp.apps.dagedit.datamodel
Class Term  view Term download Term.java

java.lang.Object
  extended byorg.bdgp.apps.dagedit.datamodel.Term
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable, javax.swing.undo.StateEditable

public class Term
extends java.lang.Object
implements javax.swing.undo.StateEditable, java.lang.Cloneable, java.io.Serializable


Field Summary
private static int autoID
           
protected  java.util.Vector categories
           
protected  java.util.Vector children
           
protected  java.lang.String comment
           
protected  java.util.Vector danglingParents
           
private  boolean debug
           
protected  java.lang.String definition
           
protected  java.util.Vector defReferences
           
protected  int depth
           
protected  java.lang.String id
           
private static int idgen
           
protected  java.lang.String idPrefix
           
private  int intid
           
protected  java.util.Vector parents
           
protected  int productCount
           
protected  java.util.Vector references
           
protected  boolean root
           
protected  java.util.Vector synonyms
           
protected  java.lang.String term
           
 
Fields inherited from interface javax.swing.undo.StateEditable
RCSID
 
Constructor Summary
Term(java.lang.String term)
           
Term(java.lang.String term, java.lang.String id)
           
Term(java.lang.String term, java.lang.String id, boolean isRoot)
           
 
Method Summary
 void addCategory(TermCategory category)
           
 void addChild(TermRelationship relation)
           
 void addChild(Term child, TermRelationshipType type)
           
 void addDanglingParent(DanglingRelationship relation)
           
 void addDbxref(Dbxref ref)
           
 void addDefDbxref(Dbxref ref)
           
 void addParent(TermRelationship relation)
           
 void addParent(Term parent, TermRelationshipType type)
           
 void addSynonym(Synonym synonym)
           
 boolean belongsToCategory(TermCategory category)
           
 java.lang.Object clone()
          This method may be called to create a new copy of the Object.
static Term cloneParentTree(Term term)
          Creates a clone of all the nodes down to term.
static Term cloneSubtree(Term in)
           
 int compareTo(java.lang.Object in)
           
 boolean equals(Term other)
           
static java.lang.String formatID(java.lang.String prefix, int id, int length)
           
static java.lang.String formatID(java.lang.String prefix, java.lang.String idStr, int length)
           
 java.util.Enumeration getAllAncestors()
           
 java.util.Enumeration getAllAncestors(boolean includeSelf)
           
 java.util.Hashtable getAllAncestorsHash()
           
 java.util.Hashtable getAllAncestorsHash(boolean includeSelf)
           
 java.util.Enumeration getAllDescendants()
           
 java.util.Enumeration getAllDescendants(boolean includeSelf)
           
 java.util.Hashtable getAllDescendantsHash()
           
 java.util.Hashtable getAllDescendantsHash(boolean includeSelf)
           
 java.util.Vector getCategories()
           
 java.util.Vector getChildren()
           
 java.lang.String getComment()
           
 java.util.Vector getDanglingParents()
           
 java.util.Vector getDbxrefs()
           
 java.util.Vector getDefDbxrefs()
           
 java.lang.String getDefinition()
           
 java.lang.String getID()
           
 java.lang.String getIDPrefix()
           
 java.lang.String getIDSuffix()
           
 java.util.Vector getParents()
           
 javax.swing.tree.TreePath[] getPaths()
           
 java.util.Vector getPathsAsVector()
           
 int getProductCount()
           
 java.util.Vector getRelationshipsForChild(Term in)
           
 java.util.Vector getRelationshipsToParent(Term in)
           
 Term getRoot()
           
 java.util.Vector getSynonyms()
           
 java.lang.String getTerm()
           
private static void getUniqueChildNodesHash(java.util.Hashtable hash, Term term)
           
private static void getUniqueParentNodesHash(java.util.Hashtable hash, Term term)
           
 boolean hasAncestor(Term term)
           
private  boolean hasAncestor(Term term, java.util.HashSet lookedAt)
           
 int hashCode()
          Get a value that represents this Object, as uniquely as possible within the confines of an int.
 boolean isNonTriviallyObsolete()
           
private  boolean isNonTriviallyObsolete(java.util.Hashtable lookedAt)
           
 boolean isObsolete()
           
 boolean isRoot()
           
 void removeAllChildren()
           
 void removeAllParents()
           
 void removeCategory(TermCategory category)
           
 void removeChild(Term child)
           
 void removeChild(TermRelationship relation)
           
 void removeDanglingParent(DanglingRelationship relation)
           
 void removeParent(Term parent)
           
 void removeParent(TermRelationship relation)
           
 void restoreState(java.util.Hashtable in)
          Performs an edit action, taking any editable state information from the specified hash table.
 void setCategories(java.util.Vector categories)
           
 void setChildren(java.util.Vector children)
           
 void setComment(java.lang.String comment)
           
 void setDbxrefs(java.util.Vector refs)
           
 void setDefDbxrefs(java.util.Vector refs)
           
 void setDefinition(java.lang.String definition)
           
 void setID(java.lang.String id)
           
 void setID(java.lang.String prefix, java.lang.String id)
           
 void setIDPrefix(java.lang.String idPrefix)
           
 void setIDSuffix(java.lang.String id)
           
private  void setIntID(int in)
           
 void setParents(java.util.Vector parents)
           
 void setProductCount(int in)
           
 void setRoot(boolean root)
           
 void setSynonyms(java.util.Vector synonyms)
           
 void setTerm(java.lang.String term)
           
 void storeState(java.util.Hashtable in)
          Stores any editable state information into the specified hash table.
 java.lang.String toString()
          Convert this Object to a human-readable String.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

autoID

private static int autoID

term

protected java.lang.String term

definition

protected java.lang.String definition

comment

protected java.lang.String comment

id

protected java.lang.String id

idPrefix

protected java.lang.String idPrefix

root

protected boolean root

children

protected java.util.Vector children

parents

protected java.util.Vector parents

danglingParents

protected java.util.Vector danglingParents

synonyms

protected java.util.Vector synonyms

references

protected java.util.Vector references

defReferences

protected java.util.Vector defReferences

categories

protected java.util.Vector categories

depth

protected int depth

productCount

protected int productCount

intid

private int intid

idgen

private static int idgen

debug

private boolean debug
Constructor Detail

Term

public Term(java.lang.String term)

Term

public Term(java.lang.String term,
            java.lang.String id)

Term

public Term(java.lang.String term,
            java.lang.String id,
            boolean isRoot)
Method Detail

addCategory

public void addCategory(TermCategory category)

removeCategory

public void removeCategory(TermCategory category)

belongsToCategory

public boolean belongsToCategory(TermCategory category)

getCategories

public java.util.Vector getCategories()

setCategories

public void setCategories(java.util.Vector categories)

setRoot

public void setRoot(boolean root)

isRoot

public boolean isRoot()

getComment

public java.lang.String getComment()

setComment

public void setComment(java.lang.String comment)

formatID

public static java.lang.String formatID(java.lang.String prefix,
                                        int id,
                                        int length)

formatID

public static java.lang.String formatID(java.lang.String prefix,
                                        java.lang.String idStr,
                                        int length)

isObsolete

public boolean isObsolete()

isNonTriviallyObsolete

public boolean isNonTriviallyObsolete()

isNonTriviallyObsolete

private boolean isNonTriviallyObsolete(java.util.Hashtable lookedAt)

getPaths

public javax.swing.tree.TreePath[] getPaths()

getPathsAsVector

public java.util.Vector getPathsAsVector()

getRelationshipsToParent

public java.util.Vector getRelationshipsToParent(Term in)

getRelationshipsForChild

public java.util.Vector getRelationshipsForChild(Term in)

toString

public java.lang.String toString()
Description copied from class: java.lang.Object
Convert this Object to a human-readable String. There are no limits placed on how long this String should be or what it should contain. We suggest you make it as intuitive as possible to be able to place it into System.out.println() 55 and such.

It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.

This method will be called when performing string concatenation with this object. If the result is null, string concatenation will instead use "null".

The default implementation returns getClass().getName() + "@" + Integer.toHexString(hashCode()).


getProductCount

public int getProductCount()

setProductCount

public void setProductCount(int in)

equals

public boolean equals(Term other)

hashCode

public int hashCode()
Description copied from class: java.lang.Object
Get a value that represents this Object, as uniquely as possible within the confines of an int.

There are some requirements on this method which subclasses must follow:

  • Semantic equality implies identical hashcodes. In other words, if a.equals(b) is true, then a.hashCode() == b.hashCode() must be as well. However, the reverse is not necessarily true, and two objects may have the same hashcode without being equal.
  • It must be consistent. Whichever value o.hashCode() returns on the first invocation must be the value returned on all later invocations as long as the object exists. Notice, however, that the result of hashCode may change between separate executions of a Virtual Machine, because it is not invoked on the same object.

Notice that since hashCode is used in java.util.Hashtable and other hashing classes, a poor implementation will degrade the performance of hashing (so don't blindly implement it as returning a constant!). Also, if calculating the hash is time-consuming, a class may consider caching the results.

The default implementation returns System.identityHashCode(this)


getTerm

public java.lang.String getTerm()

setTerm

public void setTerm(java.lang.String term)

getDefinition

public java.lang.String getDefinition()

setDefinition

public void setDefinition(java.lang.String definition)

getIDPrefix

public java.lang.String getIDPrefix()

setIDPrefix

public void setIDPrefix(java.lang.String idPrefix)

getID

public java.lang.String getID()

setID

public void setID(java.lang.String prefix,
                  java.lang.String id)

setID

public void setID(java.lang.String id)

getIDSuffix

public java.lang.String getIDSuffix()

setIDSuffix

public void setIDSuffix(java.lang.String id)

getChildren

public java.util.Vector getChildren()

setChildren

public void setChildren(java.util.Vector children)

setParents

public void setParents(java.util.Vector parents)

addChild

public void addChild(Term child,
                     TermRelationshipType type)

addChild

public void addChild(TermRelationship relation)

removeChild

public void removeChild(Term child)

removeChild

public void removeChild(TermRelationship relation)

removeParent

public void removeParent(Term parent)

removeParent

public void removeParent(TermRelationship relation)

addParent

public void addParent(Term parent,
                      TermRelationshipType type)

addParent

public void addParent(TermRelationship relation)

getParents

public java.util.Vector getParents()

removeAllParents

public void removeAllParents()

addDanglingParent

public void addDanglingParent(DanglingRelationship relation)

removeDanglingParent

public void removeDanglingParent(DanglingRelationship relation)

getDanglingParents

public java.util.Vector getDanglingParents()

removeAllChildren

public void removeAllChildren()

getSynonyms

public java.util.Vector getSynonyms()

addSynonym

public void addSynonym(Synonym synonym)

setSynonyms

public void setSynonyms(java.util.Vector synonyms)

getDbxrefs

public java.util.Vector getDbxrefs()

addDbxref

public void addDbxref(Dbxref ref)

setDbxrefs

public void setDbxrefs(java.util.Vector refs)

getDefDbxrefs

public java.util.Vector getDefDbxrefs()

addDefDbxref

public void addDefDbxref(Dbxref ref)

setDefDbxrefs

public void setDefDbxrefs(java.util.Vector refs)

hasAncestor

public boolean hasAncestor(Term term)

hasAncestor

private boolean hasAncestor(Term term,
                            java.util.HashSet lookedAt)

storeState

public void storeState(java.util.Hashtable in)
Description copied from interface: javax.swing.undo.StateEditable
Stores any editable state information into the specified hash table.

Specified by:
storeState in interface javax.swing.undo.StateEditable

setIntID

private void setIntID(int in)

clone

public java.lang.Object clone()
Description copied from class: java.lang.Object
This method may be called to create a new copy of the Object. The typical behavior is as follows:
  • o == o.clone() is false
  • o.getClass() == o.clone().getClass() is true
  • o.equals(o) is true

However, these are not strict requirements, and may be violated if necessary. Of the three requirements, the last is the most commonly violated, particularly if the subclass does not override Object.equals(Object)>Object.equals(Object) 55 .

If the Object you call clone() on does not implement java.lang.Cloneable (which is a placeholder interface), then a CloneNotSupportedException is thrown. Notice that Object does not implement Cloneable; this method exists as a convenience for subclasses that do.

Object's implementation of clone allocates space for the new Object using the correct class, without calling any constructors, and then fills in all of the new field values with the old field values. Thus, it is a shallow copy. However, subclasses are permitted to make a deep copy.

All array types implement Cloneable, and override this method as follows (it should never fail):

 public Object clone()
 {
   try
     {
       super.clone();
     }
   catch (CloneNotSupportedException e)
     {
       throw new InternalError(e.getMessage());
     }
 }
 


restoreState

public void restoreState(java.util.Hashtable in)
Description copied from interface: javax.swing.undo.StateEditable
Performs an edit action, taking any editable state information from the specified hash table.

Note to implementors of this interface: To increase efficiency, the StateEdit class StateEdit.removeRedundantState()>StateEdit.removeRedundantState() 55 removes redundant state information. Therefore, implementations of this interface must be prepared for the case where certain keys were stored into the table by StateEditable.storeState(java.util.Hashtable)>StateEditable.storeState(java.util.Hashtable) 55 , but are not present anymore when the restoreState method gets called.

Specified by:
restoreState in interface javax.swing.undo.StateEditable

getRoot

public Term getRoot()

getAllDescendants

public java.util.Enumeration getAllDescendants()

getAllDescendants

public java.util.Enumeration getAllDescendants(boolean includeSelf)

getUniqueChildNodesHash

private static void getUniqueChildNodesHash(java.util.Hashtable hash,
                                            Term term)

getAllDescendantsHash

public java.util.Hashtable getAllDescendantsHash()

getAllDescendantsHash

public java.util.Hashtable getAllDescendantsHash(boolean includeSelf)

getAllAncestors

public java.util.Enumeration getAllAncestors()

getAllAncestors

public java.util.Enumeration getAllAncestors(boolean includeSelf)

getUniqueParentNodesHash

private static void getUniqueParentNodesHash(java.util.Hashtable hash,
                                             Term term)

getAllAncestorsHash

public java.util.Hashtable getAllAncestorsHash()

getAllAncestorsHash

public java.util.Hashtable getAllAncestorsHash(boolean includeSelf)

cloneParentTree

public static Term cloneParentTree(Term term)
Creates a clone of all the nodes down to term. The leaves of the cloned tree are term, NOT a clone of term. This means that even though the cloned parents of term refer to term, term does not contain a reference to those parents


cloneSubtree

public static Term cloneSubtree(Term in)

compareTo

public int compareTo(java.lang.Object in)