Java 2 Platform
v1.3

edu.umich.visualsoar.operatorwindow
Class OperatorNode

java.lang.Object
  |
  +--javax.swing.tree.DefaultMutableTreeNode
        |
        +--edu.umich.visualsoar.operatorwindow.TreeNode
              |
              +--edu.umich.visualsoar.operatorwindow.OperatorNode
All Implemented Interfaces:
java.lang.Cloneable, javax.swing.tree.MutableTreeNode, java.io.Serializable, javax.swing.tree.TreeNode
Direct Known Subclasses:
FileNode, FolderNode

public abstract class OperatorNode
extends TreeNode
implements java.io.Serializable

This is the basis class for which all operator nodes are derived

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.tree.DefaultMutableTreeNode
 
Field Summary
protected static javax.swing.JMenuItem addFileItem
           
protected static javax.swing.JMenuItem addSuboperatorItem
           
protected static javax.swing.JMenuItem checkChildrenAgainstDataMapItem
           
protected static javax.swing.JMenuItem conflictImpasseItem
           
protected static javax.swing.JMenuItem constraintImpasseItem
           
protected static javax.swing.JPopupMenu contextMenu
           
protected static javax.swing.JMenuItem deleteItem
           
protected static javax.swing.JMenuItem exportItem
           
protected  int id
           
protected static javax.swing.JMenu impasseSubMenu
           
protected static javax.swing.JMenuItem importItem
           
protected  java.lang.String name
           
protected static javax.swing.JMenuItem openDataMapItem
           
protected static javax.swing.JMenuItem openRulesItem
           
protected static javax.swing.JMenuItem renameItem
           
protected static javax.swing.JMenuItem stateNoChangeImpasseItem
           
protected static javax.swing.JMenuItem tieImpasseItem
           
 
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode
allowsChildren, children, EMPTY_ENUMERATION, parent, userObject
 
Constructor Summary
OperatorNode(java.lang.String inName, int inId)
          Constructor
 
Method Summary
 void addFile(edu.umich.visualsoar.operatorwindow.OperatorWindow operatorWindow, java.lang.String newFileName)
          Overloaded operation
 edu.umich.visualsoar.operatorwindow.OperatorNode addFileOperator(edu.umich.visualsoar.operatorwindow.OperatorWindow operatorWindow, edu.umich.visualsoar.datamap.SoarWorkingMemoryModel swmm, java.lang.String newFileName)
          If the node supports this operation it should be overloaded in the subclass if this function gets called it means that the node did not properly overload the function, so the user just told the program to do something that it cannot all this function does is print out an error message to that effect
 edu.umich.visualsoar.operatorwindow.OperatorNode addImpasseOperator(edu.umich.visualsoar.operatorwindow.OperatorWindow operatorWindow, edu.umich.visualsoar.datamap.SoarWorkingMemoryModel swmm, java.lang.String newOperatorName)
          If the node supports this operation it should be overloaded in the subclass if this function gets called it means that the node did not properly overload the function, so the user just told the program to do something that it cannot all this function does is print out an error message to that effect
 void addLink(edu.umich.visualsoar.operatorwindow.OperatorWindow operatorWindow, edu.umich.visualsoar.operatorwindow.LinkNode inLinkNode)
           
 edu.umich.visualsoar.operatorwindow.OperatorNode addSuboperator(edu.umich.visualsoar.operatorwindow.OperatorWindow operatorWindow, edu.umich.visualsoar.datamap.SoarWorkingMemoryModel swmm, java.lang.String newOperatorName)
          If the node supports this operation it should be overloaded in the subclass if this function gets called it means that the node did not properly overload the function, so the user just told the program to do something that it cannot all this function does is print out an error message to that effect
 void checkChildrenAgainstDataMap(edu.umich.visualsoar.datamap.SoarWorkingMemoryModel swmm)
          Overloaded operation
 void clearRuleEditor()
          This is the default implementation of what a node should do when the associated rule editor is cleared - nothing
abstract  void copyStructures(java.io.File folderToWriteTo)
           
 void delete(edu.umich.visualsoar.operatorwindow.OperatorWindow operatorWindow)
          If the node supports this operation it should be overloaded in the subclass if this function gets called it means that the node did not properly overload the function, so the user just told the program to do something that it cannot all this function does is print out an error message to that effect
 void export(java.io.File fileName)
          Exports the operator and sub operators to a .vse file
abstract  void exportDataMap(java.io.Writer w)
           
abstract  void exportDesc(java.io.Writer w)
           
abstract  void exportFile(java.io.Writer w, int id)
           
abstract  void exportType(java.io.Writer w)
           
 java.lang.String getFileName()
          This is a getter method for the file name if the node supports this operation it returns the true path if it doesn't this returns null
 java.lang.String getFolderName()
          This is a getter method for the folder name if the node supports this operation it returns the true path if it doesn't this returns null
protected abstract  java.lang.String getFullPathName()
           
 int getId()
           
 edu.umich.visualsoar.graph.SoarIdentifierVertex getStateIdVertex()
           
 java.lang.String getUniqueName()
          Returns a unique name based of the path of the node in the operator hierarchy.
 void importFunc(java.io.Reader r, edu.umich.visualsoar.operatorwindow.OperatorWindow operatorWindow, edu.umich.visualsoar.datamap.SoarWorkingMemoryModel swmm)
           
 boolean isDragOk(int action)
           
 java.awt.datatransfer.DataFlavor isDropOk(int action, java.awt.datatransfer.DataFlavor[] dataFlavor)
           
 boolean move(edu.umich.visualsoar.operatorwindow.OperatorWindow operatorWindow, edu.umich.visualsoar.operatorwindow.OperatorNode newParent)
           
 void notifyDeletionOfChild(edu.umich.visualsoar.operatorwindow.OperatorWindow operatorWindow, edu.umich.visualsoar.operatorwindow.OperatorNode child)
          Tell the parent that a node has been deleted a node should do when a child is deleted - nothing
 void notifyRenameOfAncestor(java.lang.String oldFilePath, java.lang.String newFilePath)
          An ancestor has been renamed
 boolean okayToCreate(java.io.File newFile)
          This method is called by subclasses when they want to add files or folders This performs a check for conflicts and prompts the user appropriately
 boolean okayToCreate(java.io.File newFile, boolean creatingHLOp)
          Similar to okayToCreate, but does necessary checks for a high level operator
 boolean okayToCreateReplace(java.io.File newFile)
          This method is called when operator window is requested to add a file.
 void openDataMap(edu.umich.visualsoar.datamap.SoarWorkingMemoryModel swmm, edu.umich.visualsoar.MainFrame pw)
          Overloaded operation
 void openRules(edu.umich.visualsoar.MainFrame pw)
          If the node supports this operation it should be overloaded in the subclass if this function gets called it means that the node did not properly overload the function, so the user just told the program to do something that it cannot all this function does is print out an error message to that effect
 void openRules(edu.umich.visualsoar.MainFrame pw, int line)
          If the node supports this operation it should be overloaded in the subclass if this function gets called it means that the node did not properly overload the function, so the user just told the program to do something that it cannot all this function does is print out an error message to that effect
 java.util.Vector parseProductions()
          overloaded by subclasses
(package private) static void recursiveDelete(java.io.File theFile)
          Recoursively Deletes the operator and any children it may have
 void rename(edu.umich.visualsoar.operatorwindow.OperatorWindow operatorWindow, java.lang.String newName)
          If the node supports this operation it should be overloaded in the subclass if this function gets called it means that the node did not properly overload the function, so the user just told the program to do something that it cannot all this function does is print out an error message to that effect
protected  void renameToDeleted(java.io.File oldFile)
           
abstract  void showContextMenu(java.awt.Component c, int x, int y)
          This is an abstract method that must be implemented by every concrete subclass, this method enables and disables methods on the context menu depending on whether or not the node clicked upon supports that operation
abstract  void source(java.io.Writer w)
           
abstract  void sourceChildren()
           
abstract  void sourceRecursive()
           
 java.lang.String toString()
          just returns the name of the node
 
Methods inherited from class edu.umich.visualsoar.operatorwindow.TreeNode
write
 
Methods inherited from class javax.swing.tree.DefaultMutableTreeNode
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, isLeaf, isNodeAncestor, isNodeChild, isNodeDescendant, isNodeRelated, isNodeSibling, isRoot, pathFromAncestorEnumeration, postorderEnumeration, preorderEnumeration, remove, remove, removeAllChildren, removeFromParent, setAllowsChildren, setParent, setUserObject
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

contextMenu

protected static javax.swing.JPopupMenu contextMenu

addSuboperatorItem

protected static javax.swing.JMenuItem addSuboperatorItem

addFileItem

protected static javax.swing.JMenuItem addFileItem

impasseSubMenu

protected static javax.swing.JMenu impasseSubMenu

tieImpasseItem

protected static javax.swing.JMenuItem tieImpasseItem

conflictImpasseItem

protected static javax.swing.JMenuItem conflictImpasseItem

constraintImpasseItem

protected static javax.swing.JMenuItem constraintImpasseItem

stateNoChangeImpasseItem

protected static javax.swing.JMenuItem stateNoChangeImpasseItem

openRulesItem

protected static javax.swing.JMenuItem openRulesItem

openDataMapItem

protected static javax.swing.JMenuItem openDataMapItem

deleteItem

protected static javax.swing.JMenuItem deleteItem

renameItem

protected static javax.swing.JMenuItem renameItem

exportItem

protected static javax.swing.JMenuItem exportItem

importItem

protected static javax.swing.JMenuItem importItem

checkChildrenAgainstDataMapItem

protected static javax.swing.JMenuItem checkChildrenAgainstDataMapItem

name

protected java.lang.String name

id

protected int id
Constructor Detail

OperatorNode

public OperatorNode(java.lang.String inName,
                    int inId)
Constructor

Parameters:
inName - the name of the operator
inId - the unique id associated with this operator
Method Detail

getFileName

public java.lang.String getFileName()
This is a getter method for the file name if the node supports this operation it returns the true path if it doesn't this returns null

Returns:
null

getId

public final int getId()
Returns:
the unique id associated with this operator

parseProductions

public java.util.Vector parseProductions()
                                  throws ParseException,
                                         java.io.IOException
overloaded by subclasses

ParseException
java.io.IOException

isDragOk

public boolean isDragOk(int action)

isDropOk

public java.awt.datatransfer.DataFlavor isDropOk(int action,
                                                 java.awt.datatransfer.DataFlavor[] dataFlavor)

getFolderName

public java.lang.String getFolderName()
This is a getter method for the folder name if the node supports this operation it returns the true path if it doesn't this returns null

Returns:
null

getUniqueName

public java.lang.String getUniqueName()
Returns a unique name based of the path of the node in the operator hierarchy.

Returns:
a String that is a unique name

showContextMenu

public abstract void showContextMenu(java.awt.Component c,
                                     int x,
                                     int y)
This is an abstract method that must be implemented by every concrete subclass, this method enables and disables methods on the context menu depending on whether or not the node clicked upon supports that operation

Parameters:
c - the component that owns the menu
x - the horizontal position on the screen where the context menu should be displayed
y - the vertical position on the screen where the context menu should be displayed

toString

public java.lang.String toString()
just returns the name of the node

Overrides:
toString in class javax.swing.tree.DefaultMutableTreeNode
Returns:
the name of the node

recursiveDelete

static void recursiveDelete(java.io.File theFile)
Recoursively Deletes the operator and any children it may have


renameToDeleted

protected void renameToDeleted(java.io.File oldFile)

okayToCreate

public boolean okayToCreate(java.io.File newFile)
This method is called by subclasses when they want to add files or folders This performs a check for conflicts and prompts the user appropriately

Returns:
true if the file or folder can be created, otherwise return false

okayToCreateReplace

public boolean okayToCreateReplace(java.io.File newFile)
                            throws java.io.IOException
This method is called when operator window is requested to add a file. Method checks to see if a file with that name already exists. If so, allows the user to use the existing file or create a new file.

Returns:
true if the file can be created, otherwise return false
java.io.IOException

okayToCreate

public boolean okayToCreate(java.io.File newFile,
                            boolean creatingHLOp)
Similar to okayToCreate, but does necessary checks for a high level operator


addSuboperator

public edu.umich.visualsoar.operatorwindow.OperatorNode addSuboperator(edu.umich.visualsoar.operatorwindow.OperatorWindow operatorWindow,
                                                                       edu.umich.visualsoar.datamap.SoarWorkingMemoryModel swmm,
                                                                       java.lang.String newOperatorName)
                                                                throws java.io.IOException
If the node supports this operation it should be overloaded in the subclass if this function gets called it means that the node did not properly overload the function, so the user just told the program to do something that it cannot all this function does is print out an error message to that effect

Parameters:
newOperatorName - the name of the new operator to add
java.io.IOException

addImpasseOperator

public edu.umich.visualsoar.operatorwindow.OperatorNode addImpasseOperator(edu.umich.visualsoar.operatorwindow.OperatorWindow operatorWindow,
                                                                           edu.umich.visualsoar.datamap.SoarWorkingMemoryModel swmm,
                                                                           java.lang.String newOperatorName)
                                                                    throws java.io.IOException
If the node supports this operation it should be overloaded in the subclass if this function gets called it means that the node did not properly overload the function, so the user just told the program to do something that it cannot all this function does is print out an error message to that effect

Parameters:
newOperatorName - the name of the new operator to add
java.io.IOException

addFileOperator

public edu.umich.visualsoar.operatorwindow.OperatorNode addFileOperator(edu.umich.visualsoar.operatorwindow.OperatorWindow operatorWindow,
                                                                        edu.umich.visualsoar.datamap.SoarWorkingMemoryModel swmm,
                                                                        java.lang.String newFileName)
                                                                 throws java.io.IOException
If the node supports this operation it should be overloaded in the subclass if this function gets called it means that the node did not properly overload the function, so the user just told the program to do something that it cannot all this function does is print out an error message to that effect

java.io.IOException

addFile

public void addFile(edu.umich.visualsoar.operatorwindow.OperatorWindow operatorWindow,
                    java.lang.String newFileName)
             throws java.io.IOException
Overloaded operation

java.io.IOException

addLink

public void addLink(edu.umich.visualsoar.operatorwindow.OperatorWindow operatorWindow,
                    edu.umich.visualsoar.operatorwindow.LinkNode inLinkNode)

delete

public void delete(edu.umich.visualsoar.operatorwindow.OperatorWindow operatorWindow)
If the node supports this operation it should be overloaded in the subclass if this function gets called it means that the node did not properly overload the function, so the user just told the program to do something that it cannot all this function does is print out an error message to that effect


notifyDeletionOfChild

public void notifyDeletionOfChild(edu.umich.visualsoar.operatorwindow.OperatorWindow operatorWindow,
                                  edu.umich.visualsoar.operatorwindow.OperatorNode child)
Tell the parent that a node has been deleted a node should do when a child is deleted - nothing


notifyRenameOfAncestor

public void notifyRenameOfAncestor(java.lang.String oldFilePath,
                                   java.lang.String newFilePath)
An ancestor has been renamed

Parameters:
oldFilePath - the ancestor's old File path
newFilePath - the ancestor's new File path

openRules

public void openRules(edu.umich.visualsoar.MainFrame pw)
If the node supports this operation it should be overloaded in the subclass if this function gets called it means that the node did not properly overload the function, so the user just told the program to do something that it cannot all this function does is print out an error message to that effect

Parameters:
pw - the MainFrame

openDataMap

public void openDataMap(edu.umich.visualsoar.datamap.SoarWorkingMemoryModel swmm,
                        edu.umich.visualsoar.MainFrame pw)
Overloaded operation


checkChildrenAgainstDataMap

public void checkChildrenAgainstDataMap(edu.umich.visualsoar.datamap.SoarWorkingMemoryModel swmm)
Overloaded operation


openRules

public void openRules(edu.umich.visualsoar.MainFrame pw,
                      int line)
If the node supports this operation it should be overloaded in the subclass if this function gets called it means that the node did not properly overload the function, so the user just told the program to do something that it cannot all this function does is print out an error message to that effect

Parameters:
pw - the Project window
line - the line number to place the caret on

clearRuleEditor

public void clearRuleEditor()
This is the default implementation of what a node should do when the associated rule editor is cleared - nothing


rename

public void rename(edu.umich.visualsoar.operatorwindow.OperatorWindow operatorWindow,
                   java.lang.String newName)
            throws java.io.IOException
If the node supports this operation it should be overloaded in the subclass if this function gets called it means that the node did not properly overload the function, so the user just told the program to do something that it cannot all this function does is print out an error message to that effect

Parameters:
newName - the new name that the user wants this node to be called
java.io.IOException

getStateIdVertex

public edu.umich.visualsoar.graph.SoarIdentifierVertex getStateIdVertex()

getFullPathName

protected abstract java.lang.String getFullPathName()

export

public void export(java.io.File fileName)
            throws java.io.IOException
Exports the operator and sub operators to a .vse file

java.io.IOException

move

public boolean move(edu.umich.visualsoar.operatorwindow.OperatorWindow operatorWindow,
                    edu.umich.visualsoar.operatorwindow.OperatorNode newParent)

exportDesc

public abstract void exportDesc(java.io.Writer w)
                         throws java.io.IOException
java.io.IOException

exportFile

public abstract void exportFile(java.io.Writer w,
                                int id)
                         throws java.io.IOException
java.io.IOException

exportDataMap

public abstract void exportDataMap(java.io.Writer w)
                            throws java.io.IOException
java.io.IOException

exportType

public abstract void exportType(java.io.Writer w)
                         throws java.io.IOException
java.io.IOException

importFunc

public void importFunc(java.io.Reader r,
                       edu.umich.visualsoar.operatorwindow.OperatorWindow operatorWindow,
                       edu.umich.visualsoar.datamap.SoarWorkingMemoryModel swmm)
                throws java.io.IOException,
                       java.lang.NumberFormatException
java.io.IOException
java.lang.NumberFormatException

copyStructures

public abstract void copyStructures(java.io.File folderToWriteTo)
                             throws java.io.IOException
java.io.IOException

source

public abstract void source(java.io.Writer w)
                     throws java.io.IOException
java.io.IOException

sourceChildren

public abstract void sourceChildren()
                             throws java.io.IOException
java.io.IOException

sourceRecursive

public abstract void sourceRecursive()
                              throws java.io.IOException
java.io.IOException

Java 2 Platform
v1.3