|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JTree
Jet.Concepts.ConceptHierarchy
A ConceptHierarchy is an extended JTree. It consists of
Concepts and Words as its tree nodes. Besides
the tree data structure, it also has four hashtables to store references
to the data, making searching faster. These hashtables are only accessible
from within the packet though. One doesn't need to know the roles of
these hashtables in order to use the ConceptHierarchy.
ConceptHierarchy has a default root "UNIVERSE" which is
invisible. User defined hierarchy either read from a file or entered
from a ConceptHierarchyWindow is added to "UNIVERSE".
Thus a ConceptHierarchy can be a forest with the
underlined tree structure.
ConceptHierarchy should be called within a Component
in order to have its error message shown properly. See the constructors.
| Nested Class Summary |
| Nested classes inherited from class javax.swing.JTree |
javax.swing.JTree.AccessibleJTree, javax.swing.JTree.DynamicUtilTreeNode, javax.swing.JTree.EmptySelectionModel, javax.swing.JTree.TreeModelHandler, javax.swing.JTree.TreeSelectionRedirector |
| Nested classes inherited from class javax.swing.JComponent |
javax.swing.JComponent.AccessibleJComponent |
| Nested classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
| Nested classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
| Field Summary |
| Fields inherited from class javax.swing.JTree |
ANCHOR_SELECTION_PATH_PROPERTY, CELL_EDITOR_PROPERTY, CELL_RENDERER_PROPERTY, cellEditor, cellRenderer, editable, EDITABLE_PROPERTY, EXPANDS_SELECTED_PATHS_PROPERTY, INVOKES_STOP_CELL_EDITING_PROPERTY, invokesStopCellEditing, LARGE_MODEL_PROPERTY, largeModel, LEAD_SELECTION_PATH_PROPERTY, ROOT_VISIBLE_PROPERTY, rootVisible, ROW_HEIGHT_PROPERTY, rowHeight, SCROLLS_ON_EXPAND_PROPERTY, scrollsOnExpand, SELECTION_MODEL_PROPERTY, selectionModel, selectionRedirector, SHOWS_ROOT_HANDLES_PROPERTY, showsRootHandles, TOGGLE_CLICK_COUNT_PROPERTY, toggleClickCount, TREE_MODEL_PROPERTY, treeModel, treeModelListener, VISIBLE_ROW_COUNT_PROPERTY, visibleRowCount |
| Fields inherited from class javax.swing.JComponent |
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
| Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
ConceptHierarchy()
Creates a ConceptHierarchy with only the default root
UNIVERSE. |
|
ConceptHierarchy(java.io.File file)
Creates a ConceptHierarchy from the file fileName. |
|
| Method Summary | |
boolean |
addConcept(Concept newConcept,
Concept parent)
Adds a new Concept to this ConceptHierarchy as
a child of the node parent. |
boolean |
addWord(Word newWord,
Concept parent)
Adds a new Word to this ConceptHierarchy as a
child of the node parent.All the Words of Concept parent are listed before
all the Concepts that isa parent. |
void |
clear()
Removes all the nodes from the hierarchy except the default root UNIVERSE. |
void |
dragDropEnd(java.awt.dnd.DragSourceDropEvent dsde)
Method of DragSourceListener interface |
void |
dragEnter(java.awt.dnd.DragSourceDragEvent dsde)
Method of DragSourceListener interface |
void |
dragEnter(java.awt.dnd.DropTargetDragEvent e)
Method of DropTaregetListener interface |
void |
dragExit(java.awt.dnd.DragSourceEvent dsde)
Method of DragSourceListener interface |
void |
dragExit(java.awt.dnd.DropTargetEvent e)
Method of DropTaregetListener interface |
void |
dragGestureRecognized(java.awt.dnd.DragGestureEvent dge)
Method of DragGestureListener interface |
void |
dragOver(java.awt.dnd.DragSourceDragEvent dsde)
Method of DragSourceListener interface |
void |
dragOver(java.awt.dnd.DropTargetDragEvent e)
Method of DropTaregetListener interface |
void |
drop(java.awt.dnd.DropTargetDropEvent e)
Method of DropTargetListener interface |
void |
dropActionChanged(java.awt.dnd.DragSourceDragEvent dsde)
Method of DragSourceListener interface |
void |
dropActionChanged(java.awt.dnd.DropTargetDragEvent e)
Method of DropTaregetListener interface |
Concept |
getConceptByName(java.lang.String conceptName)
Returns the Concept named conceptName or
null if no Concept has conceptName. |
Concept |
getConceptByNameIgnoreCase(java.lang.String conceptName)
Returns the Concept named conceptName (ignoring case)
or null if no Concept has conceptName. |
Concept |
getConceptFor(java.lang.String word)
Returns the Concept of the word word or
null if no Concept has word. |
Word |
getWordByName(java.lang.String wordName)
Returns the Word named wordName or
null if no Word has wordName. |
Word |
getWordByNameIgnoreCase(java.lang.String wordName)
Returns the Word named wordName (ignoring case)
or null if no Word has wordName. |
static boolean |
isa(Concept concept1,
Concept concept2)
Returns true if concept1 isa concept2,
i.e. concept2 is the parent of concept1
in the concept hierarchy. |
static boolean |
isaStar(Concept concept1,
Concept concept2)
Returns true if concept1 isa* concept2,
i.e. concept2 is concept1 itself or
an ancestor of concept1 in the concept hierarchy. |
boolean |
isDuplicateConcept(Concept concept)
Checks if concept is already in the hierarchy, if so,
pop up an error message. |
boolean |
isDuplicateWord(Word word)
Checks if word is already in the hierarchy, if so,
pop up an error message. |
void |
newConcept(Concept selectedConcept)
Makes a new Concept and adds it to selectedConcept
in the hierarchy. |
void |
newWord(Concept selectedConcept)
Makes a new Word and adds it to selectedConcept
in the hierarchy. |
void |
readHierarchy(java.io.File file)
Re-create this ConceptHierarchy from the file
fileName. |
void |
removeConcept(Concept oldConcept)
Removes a Concept from the hierarchy with all its children. |
void |
removeWord(Word oldWord)
Removes a Word from the hierarchy. |
void |
setOwner(java.awt.Component owner)
|
void |
writeHierarchy(java.io.File file)
Write this ConceptHierarchy to the file fileName. |
| Methods inherited from class javax.swing.JTree |
addSelectionInterval, addSelectionPath, addSelectionPaths, addSelectionRow, addSelectionRows, addTreeExpansionListener, addTreeSelectionListener, addTreeWillExpandListener, cancelEditing, clearSelection, clearToggledPaths, collapsePath, collapseRow, convertValueToText, createTreeModel, createTreeModelListener, expandPath, expandRow, fireTreeCollapsed, fireTreeExpanded, fireTreeWillCollapse, fireTreeWillExpand, fireValueChanged, getAccessibleContext, getAnchorSelectionPath, getCellEditor, getCellRenderer, getClosestPathForLocation, getClosestRowForLocation, getDefaultTreeModel, getDescendantToggledPaths, getDragEnabled, getEditingPath, getExpandedDescendants, getExpandsSelectedPaths, getInvokesStopCellEditing, getLastSelectedPathComponent, getLeadSelectionPath, getLeadSelectionRow, getMaxSelectionRow, getMinSelectionRow, getModel, getNextMatch, getPathBetweenRows, getPathBounds, getPathForLocation, getPathForRow, getPreferredScrollableViewportSize, getRowBounds, getRowCount, getRowForLocation, getRowForPath, getRowHeight, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getScrollsOnExpand, getSelectionCount, getSelectionModel, getSelectionPath, getSelectionPaths, getSelectionRows, getShowsRootHandles, getToggleClickCount, getToolTipText, getTreeExpansionListeners, getTreeSelectionListeners, getTreeWillExpandListeners, getUI, getUIClassID, getVisibleRowCount, hasBeenExpanded, isCollapsed, isCollapsed, isEditable, isEditing, isExpanded, isExpanded, isFixedRowHeight, isLargeModel, isPathEditable, isPathSelected, isRootVisible, isRowSelected, isSelectionEmpty, isVisible, makeVisible, paramString, removeDescendantSelectedPaths, removeDescendantToggledPaths, removeSelectionInterval, removeSelectionPath, removeSelectionPaths, removeSelectionRow, removeSelectionRows, removeTreeExpansionListener, removeTreeSelectionListener, removeTreeWillExpandListener, scrollPathToVisible, scrollRowToVisible, setAnchorSelectionPath, setCellEditor, setCellRenderer, setDragEnabled, setEditable, setExpandedState, setExpandsSelectedPaths, setInvokesStopCellEditing, setLargeModel, setLeadSelectionPath, setModel, setRootVisible, setRowHeight, setScrollsOnExpand, setSelectionInterval, setSelectionModel, setSelectionPath, setSelectionPaths, setSelectionRow, setSelectionRows, setShowsRootHandles, setToggleClickCount, setUI, setVisibleRowCount, startEditingAtPath, stopEditing, treeDidChange, updateUI |
| Methods inherited from class javax.swing.JComponent |
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
| Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
| Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public ConceptHierarchy()
ConceptHierarchy with only the default root
UNIVERSE.
public ConceptHierarchy(java.io.File file)
ConceptHierarchy from the file fileName.
file - the file from which the concept hierarchy data is to be read| Method Detail |
public void setOwner(java.awt.Component owner)
public Concept getConceptByName(java.lang.String conceptName)
Concept named conceptName or
null if no Concept has conceptName.
Suppose there are no two Concepts in the same hierarchy
with the same name.
conceptName - the name of the Concept
Concept named conceptNamepublic Concept getConceptByNameIgnoreCase(java.lang.String conceptName)
Concept named conceptName (ignoring case)
or null if no Concept has conceptName.
Suppose there are no two Concepts in the same hierarchy
with the same name.
conceptName - the name of the Concept
Concept named conceptNamepublic Concept getConceptFor(java.lang.String word)
Concept of the word word or
null if no Concept has word.
Suppose there are no two Words in the same hierarchy
with the same name.
word - the word whose Concept is to be looked up
Concept of the word wordpublic Word getWordByName(java.lang.String wordName)
Word named wordName or
null if no Word has wordName.
Suppose there are no two Words in the same hierarchy
with the same name.
wordName - the name of the Word
Word named wordNamepublic Word getWordByNameIgnoreCase(java.lang.String wordName)
Word named wordName (ignoring case)
or null if no Word has wordName.
Suppose there are no two Words in the same hierarchy
with the same name.
wordName - the name of the Word
Word named wordName
public static boolean isa(Concept concept1,
Concept concept2)
concept1 isa concept2,
i.e. concept2 is the parent of concept1
in the concept hierarchy.
concept2 is the parent of concept1,
else fase
public static boolean isaStar(Concept concept1,
Concept concept2)
concept1 isa* concept2,
i.e. concept2 is concept1 itself or
an ancestor of concept1 in the concept hierarchy.
concept2 is concept1 itself or
an ancestor of concept1, else false
public boolean addConcept(Concept newConcept,
Concept parent)
Concept to this ConceptHierarchy as
a child of the node parent.
If newConcept is already in the hierarchy, show error message.
newConcept - the new Concept to be addedparent - the Concept to which newConcept
is to be added
public boolean addWord(Word newWord,
Concept parent)
Word to this ConceptHierarchy as a
child of the node parent.Words of Concept parent are listed before
all the Concepts that isa parent.
If newWord is already in the hierarchy, show error message.
newWord - the new Word to be addedparent - the Concept to which newWord
is to be added
public void newConcept(Concept selectedConcept)
Concept and adds it to selectedConcept
in the hierarchy. The default name of the new Concept is
New Concept.
public void newWord(Concept selectedConcept)
Word and adds it to selectedConcept
in the hierarchy. The default name of the new Word is
New Word.
public void removeConcept(Concept oldConcept)
Concept from the hierarchy with all its children.
oldConcept - the Concept to be removedpublic void removeWord(Word oldWord)
Word from the hierarchy.
oldWord - the Word to be removedpublic void clear()
public boolean isDuplicateConcept(Concept concept)
concept is already in the hierarchy, if so,
pop up an error message.
concept - the concept to be checked
concept is already in the hierarchy,
false otherwisepublic boolean isDuplicateWord(Word word)
word is already in the hierarchy, if so,
pop up an error message.
word - the word to be checked
word is already in the hierarchy,
false otherwisepublic void readHierarchy(java.io.File file)
ConceptHierarchy from the file
fileName. The current hierarchy is replaced.
File format is defined elsewhere with the constraint that all concepts
and words are listed such that all the nodes appear after their direct
ancestors appear, e.g. in Breadth-First order, Depth-First order, etc.
public void writeHierarchy(java.io.File file)
ConceptHierarchy to the file fileName.
Previous content of the file is replaced.
public void dragGestureRecognized(java.awt.dnd.DragGestureEvent dge)
dragGestureRecognized in interface java.awt.dnd.DragGestureListenerpublic void dragDropEnd(java.awt.dnd.DragSourceDropEvent dsde)
dragDropEnd in interface java.awt.dnd.DragSourceListenerpublic void dragEnter(java.awt.dnd.DragSourceDragEvent dsde)
dragEnter in interface java.awt.dnd.DragSourceListenerpublic void dragOver(java.awt.dnd.DragSourceDragEvent dsde)
dragOver in interface java.awt.dnd.DragSourceListenerpublic void dropActionChanged(java.awt.dnd.DragSourceDragEvent dsde)
dropActionChanged in interface java.awt.dnd.DragSourceListenerpublic void dragExit(java.awt.dnd.DragSourceEvent dsde)
dragExit in interface java.awt.dnd.DragSourceListenerpublic void drop(java.awt.dnd.DropTargetDropEvent e)
drop in interface java.awt.dnd.DropTargetListenerpublic void dragEnter(java.awt.dnd.DropTargetDragEvent e)
dragEnter in interface java.awt.dnd.DropTargetListenerpublic void dragOver(java.awt.dnd.DropTargetDragEvent e)
dragOver in interface java.awt.dnd.DropTargetListenerpublic void dragExit(java.awt.dnd.DropTargetEvent e)
dragExit in interface java.awt.dnd.DropTargetListenerpublic void dropActionChanged(java.awt.dnd.DropTargetDragEvent e)
dropActionChanged in interface java.awt.dnd.DropTargetListener
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||