public class Concept extends DefaultMutableTreeNode implements Transferable
Concept is basically a DefaultMutableTreeNode.
Its userObject is its name as a String. It allows
children who can be either a Concept or a word.
Concept instances are transferable.
| Modifier and Type | Field and Description |
|---|---|
static DataFlavor |
DEFAULT_MUTABLE_TREENODE_FLAVOR
The flavor for
DefaultMutableTreeNode |
protected Vector |
subconcepts
The
Concepts that isa this Concept |
protected Vector |
words
The
Words of this Concept |
allowsChildren, children, EMPTY_ENUMERATION, parent, userObject| Constructor and Description |
|---|
Concept(Object conceptName)
Creates a tree node with no children and parent, initialized
with the name
conceptName |
| Modifier and Type | Method and Description |
|---|---|
void |
addConcept(Concept newConcept)
Adds a new
Concept to this Concept. |
void |
addWord(Word newWord)
Adds a new
Word to this Concept. |
Enumeration |
breadthFirstEnumerationOfConcepts()
Creates and returns an enumeration of the
Concepts
in the subtree rooted at this node in breadth-first order. |
Enumeration |
breadthFirstEnumerationOfWords()
Creates and returns an enumeration of the
Words
in the subtree rooted at this node in breadth-first order. |
String |
getName()
Returns the name of this
Concept. |
Concept |
getSubconceptAt(int index)
Returns the subconcept at the specified index in this
Concept's subconcept array. |
int |
getSubconceptCount()
Returns the number of subconcepts of this
Concept. |
Vector |
getSubconcepts()
Returns the vector of the subconcepts of this
Concept. |
Object |
getTransferData(DataFlavor flavor)
This is a
Transferable method. |
DataFlavor[] |
getTransferDataFlavors()
This is a
Transferable method. |
Word |
getWordAt(int index)
Returns the
Word at the specified index in this
Concept's Word array. |
int |
getWordCount()
Returns the number of
Words of this Concept. |
Vector |
getWords()
Returns the vector of the words of this
Concept. |
boolean |
isDataFlavorSupported(DataFlavor flavor)
This is a
Transferable method. |
boolean |
isLeaf()
Overrides the
isLeaf() method in DefaultMutableTreeNode
so that only Words are treated as leaves and Concepts
are always treated as internal nodes. |
void |
removeAllChildren()
Overrides the
removeAllchildren() method
of DefaultMutableTreeNode. |
void |
removeConcept(Concept oldConcept)
Removes a subconcept with its children from this
Concept. |
void |
removeWord(Word oldWord)
Removes a word from this
Concept. |
add, breadthFirstEnumeration, children, clone, depthFirstEnumeration, getAllowsChildren, getChildAfter, getChildAt, getChildBefore, getChildCount, getDepth, getFirstChild, getFirstLeaf, getIndex, getLastChild, getLastLeaf, getLeafCount, getLevel, getNextLeaf, getNextNode, getNextSibling, getParent, getPath, getPathToRoot, getPreviousLeaf, getPreviousNode, getPreviousSibling, getRoot, getSharedAncestor, getSiblingCount, getUserObject, getUserObjectPath, insert, isNodeAncestor, isNodeChild, isNodeDescendant, isNodeRelated, isNodeSibling, isRoot, pathFromAncestorEnumeration, postorderEnumeration, preorderEnumeration, remove, remove, removeFromParent, setAllowsChildren, setParent, setUserObject, toStringprotected Vector subconcepts
Concepts that isa this Conceptprotected Vector words
Words of this Conceptpublic static final DataFlavor DEFAULT_MUTABLE_TREENODE_FLAVOR
DefaultMutableTreeNodepublic Concept(Object conceptName)
conceptName and that allows children.public String getName()
Concept.Conceptpublic boolean isLeaf()
isLeaf() method in DefaultMutableTreeNode
so that only Words are treated as leaves and Concepts
are always treated as internal nodes. This is for the graphical representation
of tree nodes.isLeaf in interface TreeNodeisLeaf in class DefaultMutableTreeNodefalsepublic Vector getSubconcepts()
Concept.Conceptpublic Vector getWords()
Concept.Conceptpublic int getSubconceptCount()
Concept.Conceptpublic int getWordCount()
Words of this Concept.Words of this Conceptpublic Concept getSubconceptAt(int index)
Concept's subconcept array.Concept's subconcept arraypublic Word getWordAt(int index)
Word at the specified index in this
Concept's Word array.Word at the specified index in this
Concept's Word arraypublic void addConcept(Concept newConcept)
Concept to this Concept.newConcept - the new Concept to be added to this
Conceptpublic void addWord(Word newWord)
Word to this Concept.
All the words are listed before all the subconcepts in the vector
children inherited from super.newWord - the new Word to be added to this
Conceptpublic void removeConcept(Concept oldConcept)
Concept.oldConcept - the subconcept to be removed from this
Conceptpublic void removeWord(Word oldWord)
Concept.oldWord - the word to be removed from this Conceptpublic void removeAllChildren()
removeAllchildren() method
of DefaultMutableTreeNode.removeAllChildren in class DefaultMutableTreeNodepublic Enumeration breadthFirstEnumerationOfConcepts()
Concepts
in the subtree rooted at this node in breadth-first order.Concepts in the subtree
rooted at this node in breadth-first orderpublic Enumeration breadthFirstEnumerationOfWords()
Words
in the subtree rooted at this node in breadth-first order.Words in the subtree
rooted at this node in breadth-first orderpublic Object getTransferData(DataFlavor flavor) throws IOException, UnsupportedFlavorException
Transferable method.getTransferData in interface TransferableIOExceptionUnsupportedFlavorExceptionpublic DataFlavor[] getTransferDataFlavors()
Transferable method.getTransferDataFlavors in interface Transferablepublic boolean isDataFlavorSupported(DataFlavor flavor)
Transferable method.isDataFlavorSupported in interface TransferableCopyright © 2016 New York University. All rights reserved.