Java 2 Platform
v1.3

edu.umich.visualsoar.operatorwindow
Class OperatorWindow

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JTree
                          |
                          +--edu.umich.visualsoar.operatorwindow.OperatorWindow
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, javax.swing.Scrollable, java.io.Serializable

public class OperatorWindow
extends javax.swing.JTree

A class to implement the behavior of the operator window

See Also:
Serialized Form

Nested Class Summary
(package private)  class OperatorWindow.BackupThread
          Responsible for keeping track of the backup project files
(package private)  class OperatorWindow.OWDragGestureListener
          Class used for drag and drop operations
(package private)  class OperatorWindow.OWDragSourceListener
          Class used for drag and drop operations
(package private)  class OperatorWindow.OWDropTargetListener
          Class used for drag and drop operations
 
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
private  OperatorWindow.BackupThread backupThread
           
private  boolean closed
           
(package private)  java.awt.dnd.DragGestureListener dgListener
           
private  java.awt.dnd.DropTarget dropTarget
           
(package private)  java.awt.dnd.DropTargetListener dtListener
           
(package private)  int nextId
           
private  edu.umich.visualsoar.datamap.SoarWorkingMemoryModel WorkingMemory
           
 
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.Container
 
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
private OperatorWindow()
          Private usage only.
  OperatorWindow(java.io.File in_file)
          Opens an OperatorWindow for an existing project
  OperatorWindow(java.lang.String projectName, java.lang.String projectFileName, boolean is_new)
          Creates an Operator Window given a project name.
 
Method Summary
 void addChild(edu.umich.visualsoar.operatorwindow.OperatorNode parent, edu.umich.visualsoar.operatorwindow.OperatorNode child)
           
 void addFile()
          Adds a file object underneath the currently selected node after prompting for the name
 void addImpasse(java.lang.String s)
          Adds an Impasse.
 void addSuboperator()
          This prompts the user for a name for the suboperator, if the user returns a valid name then it inserts a new node into the tree
 java.util.Enumeration breadthFirstEnumeration()
          Returns a breadth first enumeration of the tree
 void breadthFirstTraversal(edu.umich.visualsoar.util.Visitor v)
          This applys the Visitor to every object in the tree according to a breadth first traversal
 void checkChildrenAgainstDataMap()
          For the currently selected node, it will check all the children of this node against the datamap
 void checkProductions(edu.umich.visualsoar.operatorwindow.OperatorNode on, java.util.Vector productions, java.util.List errors)
          Given the associated Operator Node, a vector of parsed soar productions, and a list to put the errors this function will check the productions consistency across the datamap.
 void checkProductionsLog(edu.umich.visualsoar.operatorwindow.OperatorNode on, java.util.Vector productions, java.util.List errors, java.io.FileWriter w)
          Similar to checkProductions(), but writes to a log file
 void closeHierarchy()
          Saves Hierarchy and then closes it.
 edu.umich.visualsoar.operatorwindow.FileNode createFileNode(java.lang.String inName, java.lang.String inFile)
          Creates a new File node in the operator window
 edu.umich.visualsoar.operatorwindow.FileOperatorNode createFileOperatorNode(java.lang.String inName, java.lang.String inFileName)
          Creates a new File Operator Node in the operator window
 edu.umich.visualsoar.operatorwindow.FileOperatorNode createFileOperatorNode(java.lang.String inName, java.lang.String inFileName, java.lang.String inFolderName, int inDataMapIdNumber)
          Creates a high-level File Operator Node in the operator window
 edu.umich.visualsoar.operatorwindow.FileOperatorNode createFileOperatorNode(java.lang.String inName, java.lang.String inFileName, java.lang.String inFolderName, edu.umich.visualsoar.graph.SoarIdentifierVertex inDataMapId)
          Creates a high-level File Operator Node in the operator window
 edu.umich.visualsoar.operatorwindow.FolderNode createFolderNode(java.lang.String inName, java.lang.String inFolderName)
          Creates a new folder node in the operator window
 edu.umich.visualsoar.operatorwindow.ImpasseOperatorNode createImpasseOperatorNode(java.lang.String inName, java.lang.String inFileName)
          Creates a new Impasse Operator Node in the operator window
 edu.umich.visualsoar.operatorwindow.ImpasseOperatorNode createImpasseOperatorNode(java.lang.String inName, java.lang.String inFileName, java.lang.String inFolderName, int inDataMapIdNumber)
          Creates a high level Impassse Operator Node in the operator window
 edu.umich.visualsoar.operatorwindow.ImpasseOperatorNode createImpasseOperatorNode(java.lang.String inName, java.lang.String inFileName, java.lang.String inFolderName, edu.umich.visualsoar.graph.SoarIdentifierVertex inDataMapId)
          Creates a high level Impassse Operator Node in the operator window
 edu.umich.visualsoar.operatorwindow.LinkNode createLinkNode(edu.umich.visualsoar.operatorwindow.SoarOperatorNode inSoarOperatorNode)
          LinkNodes not used in this version of Visual Soar
 edu.umich.visualsoar.operatorwindow.LinkNode createLinkNode(java.lang.String inName, java.lang.String inFileName, int inHighLevelId)
          LinkNodes not used in this version of Visual Soar
 edu.umich.visualsoar.operatorwindow.OperatorRootNode createOperatorRootNode(java.lang.String inName, java.lang.String inFolderName)
          Creates the Root Node of the operator hierarchy.
 edu.umich.visualsoar.operatorwindow.OperatorRootNode createOperatorRootNode(java.lang.String inName, java.lang.String inFullPathStart, java.lang.String inFolderName)
          Creates the Root Node of the operator hierarchy.
 edu.umich.visualsoar.operatorwindow.OperatorOperatorNode createSoarOperatorNode(java.lang.String inName, java.lang.String inFileName)
          Creates a new Soar Operator Node in the operator window
 edu.umich.visualsoar.operatorwindow.OperatorOperatorNode createSoarOperatorNode(java.lang.String inName, java.lang.String inFileName, java.lang.String inFolderName, int inDataMapIdNumber)
          Creates a high level Soar Operator Node in the operator window
 edu.umich.visualsoar.operatorwindow.OperatorOperatorNode createSoarOperatorNode(java.lang.String inName, java.lang.String inFileName, java.lang.String inFolderName, edu.umich.visualsoar.graph.SoarIdentifierVertex inDataMapId)
          Creates a high level Soar Operator Node in the operator window
private  javax.swing.tree.DefaultTreeModel defaultProject(java.lang.String projectName, java.io.File projectFile)
          Constructs a DefaultTreeModel exactly the way we decided how to do it Creates a root node named after the project name at the root of the tree.
 void delete()
          removes the selected node from the tree
 void export()
           
 void findInProject(java.lang.String stringToFind, boolean matchCase)
          Searches all files in the project for the specified string and returns a Vector of FindInProjectListObjects of all instances
 void findInProjectAndOpenRule(java.lang.String stringToFind, boolean matchCase)
          Searches all files in the project for the specified string and opens the file containing the first instance of that string.
 void generateProductions(edu.umich.visualsoar.operatorwindow.OperatorNode on, java.util.Vector productions, java.util.List generations, edu.umich.visualsoar.operatorwindow.OperatorNode current)
          Given the associated Operator Node, and a vector of parsed soar productions this function will check the productions consistency across the datamap and fill in missing portions of the datamap as needed.
 int getChildCount()
          Returns the number of children associated with the root node / project node.
 edu.umich.visualsoar.datamap.SoarWorkingMemoryModel getDatamap()
          Returns the SoarWorkingMemoryModel
 int getNextId()
          Returns the next Id used for keeping track of each operator's datamap
private  edu.umich.visualsoar.operatorwindow.OperatorNode getNodeForId(int id)
           
 void importFunc()
           
static boolean isProjectNameValid(java.lang.String theName)
          Checks name entries for illegal values
private  edu.umich.visualsoar.operatorwindow.OperatorNode makeNodeVersionFive(java.util.HashMap linkedToMap, java.util.List linkNodesToRestore, java.io.Reader r, edu.umich.visualsoar.graph.SoarIdentifierVertex parentDataMap)
          Opens a Visual Soar project by creating the appropriate node
private  edu.umich.visualsoar.operatorwindow.OperatorNode makeNodeVersionFour(java.util.HashMap linkedToMap, java.util.List linkNodesToRestore, java.io.Reader r)
          Opens a Visual Soar project by creating the appropriate node
private  edu.umich.visualsoar.operatorwindow.OperatorNode makeNodeVersionOne(java.io.Reader r)
          Opens a Visual Soar project by creating the appropriate node
private  edu.umich.visualsoar.operatorwindow.OperatorNode makeNodeVersionThree(java.util.HashMap linkedToMap, java.util.List linkNodesToRestore, java.io.Reader r)
          Opens a Visual Soar project by creating the appropriate node
private  edu.umich.visualsoar.operatorwindow.OperatorNode makeNodeVersionTwo(java.util.HashMap linkedToMap, java.util.List linkNodesToRestore, java.io.Reader r)
          Opens a Visual Soar project by creating the appropriate node
 void openDataMap()
          Asks the MainFrame class to open the datamap
 void openHierarchy(java.io.File in_file)
          Opens up an existing operator hierarchy
 void openRules()
          Asks the MainFrame class to open a rule editor with the associated file of the node
private  void openVersionFive(java.io.FileReader fr, java.lang.String parentPath)
          Opens a Version Five Operator Hierarchy file
private  void openVersionFour(java.io.FileReader fr, java.lang.String parentPath)
          Opens a Version Four Operator Hierarchy file
private  void openVersionOne(java.io.FileReader fr, java.lang.String parentPath)
          Opens a Version One Operator Hierarchy file
private  void openVersionThree(java.io.FileReader fr, java.lang.String parentPath)
          Opens a Version Three Operator Hierarchy file
private  void openVersionTwo(java.io.FileReader fr, java.lang.String parentPath)
          Opens a Version two Operator Hierarchy file
static boolean operatorNameIsValid(java.lang.String theName)
          Checks name entries for illegal values
private  void readVersionFive(java.io.Reader r)
          Reads a Version Five .vsa project file and interprets it to create a Visual Soar project from the the file.
private  void readVersionFour(java.io.Reader r)
          Reads a Version Four .vsa project file and interprets it to create a Visual Soar project from the the file.
private  void readVersionOne(java.io.Reader r)
          Reads a Version One .vsa project file and interprets it to create a Visual Soar project from the the file.
private  void readVersionThree(java.io.Reader r)
          Reads a Version Three .vsa project file and interprets it to create a Visual Soar project from the the file.
private  void readVersionTwo(java.io.Reader r)
          Reads a Version Two .vsa project file and interprets it to create a Visual Soar project from the the file.
private  void reduceWorkingMemory()
          Attempts to reduce Working Memory by finding all vertices that are unreachable from a state and adds them to a list of holes so that they can be recycled for later use
 void removeNode(edu.umich.visualsoar.operatorwindow.OperatorNode operatorNode)
          Removes a node from the operator window
 void rename()
          Renames the selected node
private  void restoreStateIds()
          This is a helper function restores the ids to high-level operators
 void saveHierarchy()
          Save entire Operator Hierarchy (including datamap)
 void saveProjectAs(java.lang.String newName, java.lang.String newPath)
          Saves project as a new project name
 void sendProductions(java.io.Writer w)
           
 void suggestShowContextMenu(int x, int y)
          Checks to see if x,y is a valid location on the screen, if it is then it displays the context menu there
private static boolean treePathSubset(javax.swing.tree.TreePath set, javax.swing.tree.TreePath subset)
           
private  void writeOutAllElabs(java.io.File fileToWriteTo)
          Writes out the default productions in the _all.soar file
 void writeOutHierarchy(java.io.File inFileName, java.io.File inDataMapName)
          Saves the current hierarchy to disk using Version 4 method
 void writeOutHierarchy5(java.io.File inFileName, java.io.File inDataMapName)
          Saves the current hierarchy to disk - Version 5 Not Currently Iimplemented in Visual Soar
private  void writeOutTopStateElabs(java.io.File fileToWriteTo, java.lang.String topStateName)
          Writes out the default productions in the top-state.soar file
 
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
 

Field Detail

nextId

int nextId

dgListener

java.awt.dnd.DragGestureListener dgListener

dtListener

java.awt.dnd.DropTargetListener dtListener

dropTarget

private java.awt.dnd.DropTarget dropTarget

WorkingMemory

private edu.umich.visualsoar.datamap.SoarWorkingMemoryModel WorkingMemory

backupThread

private OperatorWindow.BackupThread backupThread

closed

private boolean closed
Constructor Detail

OperatorWindow

private OperatorWindow()
Private usage only. Default constructor to do common things such as setting up the mouse and keyboard listeners and backup threads

See Also:
OperatorWindow.BackupThread

OperatorWindow

public OperatorWindow(java.lang.String projectName,
                      java.lang.String projectFileName,
                      boolean is_new)
Creates an Operator Window given a project name. Creates a default project tree model and a new WorkingMemory for new projects.

Parameters:
projectName - The name of the project
projectFileName - The full file path of the projects location
is_new - True if it is a new project
See Also:
SoarWorkingMemoryModel, defaultProject(String, File)

OperatorWindow

public OperatorWindow(java.io.File in_file)
               throws java.lang.NumberFormatException,
                      java.io.IOException,
                      java.io.FileNotFoundException
Opens an OperatorWindow for an existing project

Parameters:
in_file - the location of the project to be opened
See Also:
SoarWorkingMemoryModel, openHierarchy(File)
Method Detail

suggestShowContextMenu

public void suggestShowContextMenu(int x,
                                   int y)
Checks to see if x,y is a valid location on the screen, if it is then it displays the context menu there

Parameters:
x - the x coordinate of the screen
y - the y coordinate of the screen

createFolderNode

public edu.umich.visualsoar.operatorwindow.FolderNode createFolderNode(java.lang.String inName,
                                                                       java.lang.String inFolderName)
Creates a new folder node in the operator window

Parameters:
inName - Name given to new node
inFolderName - same as inName, name of created folder
See Also:
FolderNode

createFileNode

public edu.umich.visualsoar.operatorwindow.FileNode createFileNode(java.lang.String inName,
                                                                   java.lang.String inFile)
Creates a new File node in the operator window

Parameters:
inName - name of file node
inFile - name of created rule editor file, same as inName
See Also:
FileNode

createImpasseOperatorNode

public edu.umich.visualsoar.operatorwindow.ImpasseOperatorNode createImpasseOperatorNode(java.lang.String inName,
                                                                                         java.lang.String inFileName)
Creates a new Impasse Operator Node in the operator window

Parameters:
inName - name of node
inFileName - name of created rule editor file, same as inName
See Also:
ImpasseOperatorNode

createImpasseOperatorNode

public edu.umich.visualsoar.operatorwindow.ImpasseOperatorNode createImpasseOperatorNode(java.lang.String inName,
                                                                                         java.lang.String inFileName,
                                                                                         java.lang.String inFolderName,
                                                                                         edu.umich.visualsoar.graph.SoarIdentifierVertex inDataMapId)
Creates a high level Impassse Operator Node in the operator window

Parameters:
inName - name of node
inFileName - name of created rule editor file, same as inName
inFolderName - name of created folder, same as inName
inDataMapId - SoarIdentifierVertex corresponding to node's datamap
See Also:
ImpasseOperatorNode, SoarIdentifierVertex

createImpasseOperatorNode

public edu.umich.visualsoar.operatorwindow.ImpasseOperatorNode createImpasseOperatorNode(java.lang.String inName,
                                                                                         java.lang.String inFileName,
                                                                                         java.lang.String inFolderName,
                                                                                         int inDataMapIdNumber)
Creates a high level Impassse Operator Node in the operator window

Parameters:
inName - name of node
inFileName - name of created rule editor file, same as inName
inFolderName - name of created folder, same as inName
inDataMapIdNumber - integer corresponding to node's datamap
See Also:
ImpasseOperatorNode

createFileOperatorNode

public edu.umich.visualsoar.operatorwindow.FileOperatorNode createFileOperatorNode(java.lang.String inName,
                                                                                   java.lang.String inFileName)
Creates a new File Operator Node in the operator window

Parameters:
inName - name of node
inFileName - name of created rule editor file, same as inName
See Also:
FileOperatorNode

createFileOperatorNode

public edu.umich.visualsoar.operatorwindow.FileOperatorNode createFileOperatorNode(java.lang.String inName,
                                                                                   java.lang.String inFileName,
                                                                                   java.lang.String inFolderName,
                                                                                   edu.umich.visualsoar.graph.SoarIdentifierVertex inDataMapId)
Creates a high-level File Operator Node in the operator window

Parameters:
inName - name of node
inFileName - name of created rule editor file, same as inName
inFolderName - name of created folder, same as inName
inDataMapId - SoarIdentifierVertex corresponding to node's datamap
See Also:
FileOperatorNode, SoarIdentifierVertex

createFileOperatorNode

public edu.umich.visualsoar.operatorwindow.FileOperatorNode createFileOperatorNode(java.lang.String inName,
                                                                                   java.lang.String inFileName,
                                                                                   java.lang.String inFolderName,
                                                                                   int inDataMapIdNumber)
Creates a high-level File Operator Node in the operator window

Parameters:
inName - name of node
inFileName - name of created rule editor file, same as inName
inFolderName - name of created folder, same as inName
inDataMapIdNumber - integer corresponding to node's datamap
See Also:
FileOperatorNode

createSoarOperatorNode

public edu.umich.visualsoar.operatorwindow.OperatorOperatorNode createSoarOperatorNode(java.lang.String inName,
                                                                                       java.lang.String inFileName)
Creates a new Soar Operator Node in the operator window

Parameters:
inName - name of the node
inFileName - name of created rule editor file, same as inName
See Also:
OperatorOperatorNode

createSoarOperatorNode

public edu.umich.visualsoar.operatorwindow.OperatorOperatorNode createSoarOperatorNode(java.lang.String inName,
                                                                                       java.lang.String inFileName,
                                                                                       java.lang.String inFolderName,
                                                                                       edu.umich.visualsoar.graph.SoarIdentifierVertex inDataMapId)
Creates a high level Soar Operator Node in the operator window

Parameters:
inName - name of the node
inFileName - name of created rule editor file, same as inName
inFolderName - name of created folder, same as inName
inDataMapId - SoarIdentifierVertex corresponding to node's datamap
See Also:
OperatorOperatorNode, SoarIdentifierVertex

createSoarOperatorNode

public edu.umich.visualsoar.operatorwindow.OperatorOperatorNode createSoarOperatorNode(java.lang.String inName,
                                                                                       java.lang.String inFileName,
                                                                                       java.lang.String inFolderName,
                                                                                       int inDataMapIdNumber)
Creates a high level Soar Operator Node in the operator window

Parameters:
inName - name of the node
inFileName - name of created rule editor file, same as inName
inFolderName - name of created folder, same as inName
inDataMapIdNumber - integer corresponding to node's datamap
See Also:
OperatorOperatorNode

createOperatorRootNode

public edu.umich.visualsoar.operatorwindow.OperatorRootNode createOperatorRootNode(java.lang.String inName,
                                                                                   java.lang.String inFullPathStart,
                                                                                   java.lang.String inFolderName)
Creates the Root Node of the operator hierarchy. From here all sub operators branch. This is the method called when a new project is created

Parameters:
inName - name of the root node, should be the same as the project name
inFullPathStart - full path of the project
inFolderName - created folder name, same as project name
See Also:
OperatorRootNode

createOperatorRootNode

public edu.umich.visualsoar.operatorwindow.OperatorRootNode createOperatorRootNode(java.lang.String inName,
                                                                                   java.lang.String inFolderName)
Creates the Root Node of the operator hierarchy. From here all sub operators branch. This is the root node method called when opening an existing project.

Parameters:
inName - name of the node, same as the name of the project
inFolderName - name of the root operator's folder, same as inName
See Also:
OperatorRootNode

createLinkNode

public edu.umich.visualsoar.operatorwindow.LinkNode createLinkNode(edu.umich.visualsoar.operatorwindow.SoarOperatorNode inSoarOperatorNode)
LinkNodes not used in this version of Visual Soar

See Also:
LinkNode

createLinkNode

public edu.umich.visualsoar.operatorwindow.LinkNode createLinkNode(java.lang.String inName,
                                                                   java.lang.String inFileName,
                                                                   int inHighLevelId)
LinkNodes not used in this version of Visual Soar

See Also:
LinkNode

removeNode

public void removeNode(edu.umich.visualsoar.operatorwindow.OperatorNode operatorNode)
Removes a node from the operator window

Parameters:
operatorNode - the node that is to be removed
See Also:
DefaultTreeModel#removeNodeFromParent(OperatorNode)

getNextId

public final int getNextId()
Returns the next Id used for keeping track of each operator's datamap


getChildCount

public int getChildCount()
Returns the number of children associated with the root node / project node.


addChild

public void addChild(edu.umich.visualsoar.operatorwindow.OperatorNode parent,
                     edu.umich.visualsoar.operatorwindow.OperatorNode child)

operatorNameIsValid

public static boolean operatorNameIsValid(java.lang.String theName)
Checks name entries for illegal values

Parameters:
theName - the name entered
Returns:
true if a valid name false otherwise

isProjectNameValid

public static boolean isProjectNameValid(java.lang.String theName)
Checks name entries for illegal values

Parameters:
theName - the name entered
Returns:
true if a valid name false otherwise

addSuboperator

public void addSuboperator()
This prompts the user for a name for the suboperator, if the user returns a valid name then it inserts a new node into the tree

Throws:
java.lang.Exception - invalid name given

export

public void export()

importFunc

public void importFunc()

rename

public void rename()
Renames the selected node

Throws:
java.lang.Exception - invalid name
See Also:
NameDialog

addFile

public void addFile()
Adds a file object underneath the currently selected node after prompting for the name

Throws:
java.lang.Exception - Invalid name

addImpasse

public void addImpasse(java.lang.String s)
Adds an Impasse. An impasse is similar to a Soar Operator Node on all accounts except for user cannot name an impasse, impasses are automatically named based on Soar Convention. Adds a SoarOperatorNode object underneath the currently selected node.

Parameters:
s - impasse type string chosen from file menu, given as name of node

checkProductions

public void checkProductions(edu.umich.visualsoar.operatorwindow.OperatorNode on,
                             java.util.Vector productions,
                             java.util.List errors)
Given the associated Operator Node, a vector of parsed soar productions, and a list to put the errors this function will check the productions consistency across the datamap.

See Also:
SoarProduction, SoarWorkingMemoryModel.checkProduction(SoarIdentifierVertex, SoarProduction)

checkProductionsLog

public void checkProductionsLog(edu.umich.visualsoar.operatorwindow.OperatorNode on,
                                java.util.Vector productions,
                                java.util.List errors,
                                java.io.FileWriter w)
Similar to checkProductions(), but writes to a log file


generateProductions

public void generateProductions(edu.umich.visualsoar.operatorwindow.OperatorNode on,
                                java.util.Vector productions,
                                java.util.List generations,
                                edu.umich.visualsoar.operatorwindow.OperatorNode current)
Given the associated Operator Node, and a vector of parsed soar productions this function will check the productions consistency across the datamap and fill in missing portions of the datamap as needed.

See Also:
SoarProduction, SoarWorkingMemoryModel.checkGenerateProduction(SoarIdentifierVertex, SoarProduction, OperatorNode)

openRules

public void openRules()
Asks the MainFrame class to open a rule editor with the associated file of the node


openDataMap

public void openDataMap()
Asks the MainFrame class to open the datamap


getDatamap

public edu.umich.visualsoar.datamap.SoarWorkingMemoryModel getDatamap()
Returns the SoarWorkingMemoryModel

See Also:
SoarWorkingMemoryModel

delete

public void delete()
removes the selected node from the tree


checkChildrenAgainstDataMap

public void checkChildrenAgainstDataMap()
For the currently selected node, it will check all the children of this node against the datamap

Throws:
java.lang.Exception - unable to check productions due to parse error
See Also:
checkProductions(OperatorNode, Vector, java.util.List)

openHierarchy

public void openHierarchy(java.io.File in_file)
                   throws java.io.FileNotFoundException,
                          java.io.IOException,
                          java.lang.NumberFormatException
Opens up an existing operator hierarchy

Throws:
java.lang.Exception - Invalid version number, must be version number 1-5
java.io.FileNotFoundException
java.io.IOException
java.lang.NumberFormatException
See Also:
openVersionFour(FileReader, String)

openVersionOne

private void openVersionOne(java.io.FileReader fr,
                            java.lang.String parentPath)
                     throws java.io.IOException,
                            java.lang.NumberFormatException
Opens a Version One Operator Hierarchy file

java.io.IOException
java.lang.NumberFormatException
See Also:
#readVersionOne(FileReader), SoarWorkingMemoryReader.read(SoarWorkingMemoryModel, Reader, Reader)

openVersionTwo

private void openVersionTwo(java.io.FileReader fr,
                            java.lang.String parentPath)
                     throws java.io.IOException,
                            java.lang.NumberFormatException
Opens a Version two Operator Hierarchy file

java.io.IOException
java.lang.NumberFormatException
See Also:
#readVersionTwo(FileReader), SoarWorkingMemoryReader.read(SoarWorkingMemoryModel, Reader, Reader)

openVersionThree

private void openVersionThree(java.io.FileReader fr,
                              java.lang.String parentPath)
                       throws java.io.IOException,
                              java.lang.NumberFormatException
Opens a Version Three Operator Hierarchy file

java.io.IOException
java.lang.NumberFormatException
See Also:
#readVersionThree(FileReader), SoarWorkingMemoryReader.read(SoarWorkingMemoryModel, Reader, Reader)

openVersionFour

private void openVersionFour(java.io.FileReader fr,
                             java.lang.String parentPath)
                      throws java.io.IOException,
                             java.lang.NumberFormatException
Opens a Version Four Operator Hierarchy file

java.io.IOException
java.lang.NumberFormatException
See Also:
#readVersionFour(FileReader), SoarWorkingMemoryReader.read(SoarWorkingMemoryModel, Reader, Reader)

openVersionFive

private void openVersionFive(java.io.FileReader fr,
                             java.lang.String parentPath)
                      throws java.io.IOException,
                             java.lang.NumberFormatException
Opens a Version Five Operator Hierarchy file

java.io.IOException
java.lang.NumberFormatException
See Also:
#readVersionOne(FileReader), SoarWorkingMemoryReader.read(SoarWorkingMemoryModel, Reader, Reader)

restoreStateIds

private void restoreStateIds()
This is a helper function restores the ids to high-level operators


breadthFirstEnumeration

public java.util.Enumeration breadthFirstEnumeration()
Returns a breadth first enumeration of the tree


breadthFirstTraversal

public void breadthFirstTraversal(edu.umich.visualsoar.util.Visitor v)
This applys the Visitor to every object in the tree according to a breadth first traversal


saveProjectAs

public void saveProjectAs(java.lang.String newName,
                          java.lang.String newPath)
Saves project as a new project name

Parameters:
newName - the new name of the project
newPath - the new file path of the project
See Also:
saveHierarchy(), OperatorRootNode.renameAndBackup(OperatorWindow,String,String)

writeOutHierarchy5

public void writeOutHierarchy5(java.io.File inFileName,
                               java.io.File inDataMapName)
Saves the current hierarchy to disk - Version 5 Not Currently Iimplemented in Visual Soar

Parameters:
inFileName - name of the file to be saved - .vsa file
inDataMapName - name of the datamapfile - .dm file
Throws:
java.lang.Exception - i/o exception
See Also:
reduceWorkingMemory(), TreeFileWriter#write(FileWriter,DefaultTreeModel), SoarWorkingMemoryModel#write(FileWriter), SoarWorkingMemoryModel#writeComments(FileWriter)

writeOutHierarchy

public void writeOutHierarchy(java.io.File inFileName,
                              java.io.File inDataMapName)
Saves the current hierarchy to disk using Version 4 method

Parameters:
inFileName - name of the file to be saved - .vsa file
inDataMapName - name of the datamapfile - .dm file
Throws:
java.lang.Exception - i/o exception
See Also:
reduceWorkingMemory(), TreeFileWriter#write(FileWriter,DefaultTreeModel), SoarWorkingMemoryModel#write(FileWriter), SoarWorkingMemoryModel#writeComments(FileWriter)

saveHierarchy

public void saveHierarchy()
Save entire Operator Hierarchy (including datamap)

See Also:
writeOutHierarchy(File,File)

closeHierarchy

public void closeHierarchy()
Saves Hierarchy and then closes it.

See Also:
saveHierarchy()

reduceWorkingMemory

private void reduceWorkingMemory()
Attempts to reduce Working Memory by finding all vertices that are unreachable from a state and adds them to a list of holes so that they can be recycled for later use

See Also:
SoarWorkingMemoryModel.reduce(java.util.List)

defaultProject

private javax.swing.tree.DefaultTreeModel defaultProject(java.lang.String projectName,
                                                         java.io.File projectFile)
Constructs a DefaultTreeModel exactly the way we decided how to do it Creates a root node named after the project name at the root of the tree. Children of that are an 'all' foldernode, a tcl file node called '_firstload' and an 'elaborations' foldernode. Children of the elaborations folder include two file operator nodes called '_all' and 'top-state'. Also created is the datamap file called + '.dm'

Parameters:
projectName - name of the project
projectFile - name of project's .vsa file
Throws:
java.lang.Exception - io exception
See Also:
OperatorRootNode, FileOperatorNode, FolderNode

findInProject

public void findInProject(java.lang.String stringToFind,
                          boolean matchCase)
Searches all files in the project for the specified string and returns a Vector of FindInProjectListObjects of all instances


findInProjectAndOpenRule

public void findInProjectAndOpenRule(java.lang.String stringToFind,
                                     boolean matchCase)
Searches all files in the project for the specified string and opens the file containing the first instance of that string.


sendProductions

public void sendProductions(java.io.Writer w)
                     throws java.io.IOException
java.io.IOException

readVersionOne

private void readVersionOne(java.io.Reader r)
                     throws java.io.IOException,
                            java.io.FileNotFoundException,
                            java.lang.NumberFormatException
Reads a Version One .vsa project file and interprets it to create a Visual Soar project from the the file.

Parameters:
r - the Reader of the .vsa project file
java.io.IOException
java.io.FileNotFoundException
java.lang.NumberFormatException
See Also:
makeNodeVersionOne(Reader)

readVersionFive

private void readVersionFive(java.io.Reader r)
                      throws java.io.IOException,
                             java.io.FileNotFoundException,
                             java.lang.NumberFormatException
Reads a Version Five .vsa project file and interprets it to create a Visual Soar project from the the file. This version reads the unique Id's which are strings consisting of concatenation of parent names as a value. This method ensures that every id is unique.

Parameters:
r - the Reader of the .vsa project file
java.io.IOException
java.io.FileNotFoundException
java.lang.NumberFormatException
See Also:
makeNodeVersionFive(HashMap, java.util.List,Reader, SoarIdentifierVertex)

readVersionFour

private void readVersionFour(java.io.Reader r)
                      throws java.io.IOException,
                             java.io.FileNotFoundException,
                             java.lang.NumberFormatException
Reads a Version Four .vsa project file and interprets it to create a Visual Soar project from the the file.

Parameters:
r - the Reader of the .vsa project file
java.io.IOException
java.io.FileNotFoundException
java.lang.NumberFormatException
See Also:
makeNodeVersionFour(HashMap,java.util.List, Reader)

readVersionThree

private void readVersionThree(java.io.Reader r)
                       throws java.io.IOException,
                              java.io.FileNotFoundException,
                              java.lang.NumberFormatException
Reads a Version Three .vsa project file and interprets it to create a Visual Soar project from the the file.

Parameters:
r - the Reader of the .vsa project file
java.io.IOException
java.io.FileNotFoundException
java.lang.NumberFormatException
See Also:
makeNodeVersionThree(HashMap,java.util.List, Reader)

readVersionTwo

private void readVersionTwo(java.io.Reader r)
                     throws java.io.IOException,
                            java.io.FileNotFoundException,
                            java.lang.NumberFormatException
Reads a Version Two .vsa project file and interprets it to create a Visual Soar project from the the file.

Parameters:
r - the Reader of the .vsa project file
java.io.IOException
java.io.FileNotFoundException
java.lang.NumberFormatException
See Also:
makeNodeVersionTwo(HashMap,java.util.List, Reader)

makeNodeVersionFive

private edu.umich.visualsoar.operatorwindow.OperatorNode makeNodeVersionFive(java.util.HashMap linkedToMap,
                                                                             java.util.List linkNodesToRestore,
                                                                             java.io.Reader r,
                                                                             edu.umich.visualsoar.graph.SoarIdentifierVertex parentDataMap)
                                                                      throws java.io.IOException,
                                                                             java.lang.NumberFormatException
Opens a Visual Soar project by creating the appropriate node

Parameters:
linkedToMap - hashmap used to keep track of linked nodes, not used
linkNodesToRestore - list of linked nodes needed to restore, not used
r - .vsa file that is being read to open project
parentDataMap - parent of created nodes datamap id
Returns:
the created OperatorNode
java.io.IOException
java.lang.NumberFormatException
See Also:
OperatorNode, readVersionFive(Reader)

makeNodeVersionFour

private edu.umich.visualsoar.operatorwindow.OperatorNode makeNodeVersionFour(java.util.HashMap linkedToMap,
                                                                             java.util.List linkNodesToRestore,
                                                                             java.io.Reader r)
                                                                      throws java.io.IOException,
                                                                             java.lang.NumberFormatException
Opens a Visual Soar project by creating the appropriate node

Parameters:
linkedToMap - hashmap used to keep track of linked nodes, not used
linkNodesToRestore - list of linked nodes needed to restore, not used
r - .vsa file that is being read to open project
Returns:
the created OperatorNode
java.io.IOException
java.lang.NumberFormatException
See Also:
OperatorNode, readVersionFour(Reader)

makeNodeVersionThree

private edu.umich.visualsoar.operatorwindow.OperatorNode makeNodeVersionThree(java.util.HashMap linkedToMap,
                                                                              java.util.List linkNodesToRestore,
                                                                              java.io.Reader r)
                                                                       throws java.io.IOException,
                                                                              java.lang.NumberFormatException
Opens a Visual Soar project by creating the appropriate node

Parameters:
linkedToMap - hashmap used to keep track of linked nodes, not used
linkNodesToRestore - list of linked nodes needed to restore, not used
r - .vsa file that is being read to open project
Returns:
the created OperatorNode
java.io.IOException
java.lang.NumberFormatException
See Also:
OperatorNode, readVersionThree(Reader)

makeNodeVersionTwo

private edu.umich.visualsoar.operatorwindow.OperatorNode makeNodeVersionTwo(java.util.HashMap linkedToMap,
                                                                            java.util.List linkNodesToRestore,
                                                                            java.io.Reader r)
                                                                     throws java.io.IOException,
                                                                            java.lang.NumberFormatException
Opens a Visual Soar project by creating the appropriate node

Parameters:
linkedToMap - hashmap used to keep track of linked nodes, not used
linkNodesToRestore - list of linked nodes needed to restore, not used
r - .vsa file that is being read to open project
Returns:
the created OperatorNode
java.io.IOException
java.lang.NumberFormatException
See Also:
OperatorNode, readVersionTwo(Reader)

makeNodeVersionOne

private edu.umich.visualsoar.operatorwindow.OperatorNode makeNodeVersionOne(java.io.Reader r)
                                                                     throws java.io.IOException,
                                                                            java.lang.NumberFormatException
Opens a Visual Soar project by creating the appropriate node

Parameters:
r - .vsa file that is being read to open project
Returns:
the created OperatorNode
java.io.IOException
java.lang.NumberFormatException
See Also:
OperatorNode, readVersionOne(Reader)

treePathSubset

private static boolean treePathSubset(javax.swing.tree.TreePath set,
                                      javax.swing.tree.TreePath subset)

getNodeForId

private edu.umich.visualsoar.operatorwindow.OperatorNode getNodeForId(int id)

writeOutTopStateElabs

private void writeOutTopStateElabs(java.io.File fileToWriteTo,
                                   java.lang.String topStateName)
                            throws java.io.IOException
Writes out the default productions in the top-state.soar file

Parameters:
fileToWriteTo - the top-state.soar file
topStateName - the name of the project/top state
java.io.IOException

writeOutAllElabs

private void writeOutAllElabs(java.io.File fileToWriteTo)
                       throws java.io.IOException
Writes out the default productions in the _all.soar file

Parameters:
fileToWriteTo - the _all.soar file
java.io.IOException

Java 2 Platform
v1.3