CubeTwister 2.0alpha142 2012-02-11

ch.randelshofer.rubik.parser
Class MacroNode

java.lang.Object
  extended by javax.swing.tree.DefaultMutableTreeNode
      extended by ch.randelshofer.rubik.parser.Node
          extended by ch.randelshofer.rubik.parser.MacroNode
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, javax.swing.tree.MutableTreeNode, javax.swing.tree.TreeNode

public class MacroNode
extends Node

A MacroNode holds a macro identifier and an unparsed script String. The MacroNode can be expanded to hold the macro script as its child A. The side effect of a macro node is A.

Version:
6.0 2007-11-15 Upgraded to Java 1.4.
5.0 2005-01-31 Reworked.
1.0.1 2002-02-25 During expansion the expanded nodes did not always get the right start and end positions.
1.0 2001-07-22 Created.
Author:
werni
See Also:
Serialized Form

Field Summary
 
Fields inherited from class ch.randelshofer.rubik.parser.Node
endpos, layerCount, startpos, symbol
 
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode
allowsChildren, children, EMPTY_ENUMERATION, parent, userObject
 
Constructor Summary
MacroNode(int layerCount, java.lang.String identifier, java.lang.String script, int startpos, int endpos)
          Creates new MacroNode
 
Method Summary
 void expand(ScriptParser parser)
           
 java.lang.String getIdentifier()
           
 void transform(int axis, int layerMask, int angle)
          Transformes the subtree starting at this node by the given ScriptParserAWT.symbol constant.
 void writeTokens(java.io.PrintWriter w, Notation p, java.util.Map<java.lang.String,MacroNode> macroMap)
          Writes the token(s) represented by the subtree starting at this node.
 
Methods inherited from class ch.randelshofer.rubik.parser.Node
applyTo, cloneSubtree, dumpTree, enumerateChildrenReversed, getBlockTurnCount, getChildAt, getChildren, getEndPosition, getFaceTurnCount, getLayerTurnCount, getQuarterTurnCount, getStartPosition, getSymbol, inverse, overwritePositions, reflect, resolvedEnumeration, setEndPosition, setStartPosition, toResolvedList, toString, toString, toString, transform, transformOrientation
 
Methods inherited from class javax.swing.tree.DefaultMutableTreeNode
add, breadthFirstEnumeration, children, clone, depthFirstEnumeration, getAllowsChildren, getChildAfter, 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
 

Constructor Detail

MacroNode

public MacroNode(int layerCount,
                 java.lang.String identifier,
                 java.lang.String script,
                 int startpos,
                 int endpos)
Creates new MacroNode

Method Detail

transform

public void transform(int axis,
                      int layerMask,
                      int angle)
Transformes the subtree starting at this node by the given ScriptParserAWT.symbol constant. Does nothing if the transformation can not be done.

Overrides:
transform in class Node

getIdentifier

public java.lang.String getIdentifier()

expand

public void expand(ScriptParser parser)
            throws java.io.IOException
Throws:
java.io.IOException

writeTokens

public void writeTokens(java.io.PrintWriter w,
                        Notation p,
                        java.util.Map<java.lang.String,MacroNode> macroMap)
                 throws java.io.IOException
Description copied from class: Node
Writes the token(s) represented by the subtree starting at this node. The syntax and the string representations of the tokens are provided by the parser.

Overrides:
writeTokens in class Node
Parameters:
w - This is where the tokens are written to.
p - The notation which provides the tokens.
macroMap - Local macros which are preserved by the translation.
Throws:
java.io.IOException

(c) Werner Randelshofer.
All rights reserved.