|
CubeTwister 2.0alpha141 2011-10-13 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjavax.swing.tree.DefaultMutableTreeNode
ch.randelshofer.rubik.parser.Node
public abstract class Node
Abstract superclass for a Node in the parse tree generated by the Parser.
| Field Summary | |
|---|---|
protected int |
endpos
The end position of the last token in the source code, that is part of this script. |
protected int |
layerCount
|
protected int |
startpos
The start position of the first token in the source code, that is part of this script. |
protected Symbol |
symbol
The Symbol that this node represents. |
| Fields inherited from class javax.swing.tree.DefaultMutableTreeNode |
|---|
allowsChildren, children, EMPTY_ENUMERATION, parent, userObject |
| Constructor Summary | |
|---|---|
Node(Symbol symbol,
int layerCount,
int startpos,
int endpos)
Creates a node which represents a symbol at the indicated position in the source code. |
|
| Method Summary | |
|---|---|
void |
applyTo(Cube cube,
boolean inverse)
Applies the symbol represented by this node to the cube. |
Node |
cloneSubtree()
Returns a deep clone of the subtree starting at this node. |
void |
dumpTree(int depth)
Dumps the subtree starting at this Node node. |
java.util.Enumeration |
enumerateChildrenReversed()
Enumerates the direct children of this node in reverse order. |
int |
getBlockTurnCount()
Gets the block turn count of the subtree starting at this node. |
Node |
getChildAt(int index)
|
int |
getEndPosition()
Returns the end position of the symbol in the source code. |
int |
getFaceTurnCount()
Gets the face turn count of the subtree starting at this node. |
int |
getLayerTurnCount()
Gets the layer turn count of the subtree starting at this node. |
int |
getQuarterTurnCount()
Gets the quarter turn count of the subtree starting at this node. |
int |
getStartPosition()
Returns the start position of the symbol in the source code. |
Symbol |
getSymbol()
Returns the ScriptParser symbol that represents this node. |
void |
inverse()
Inverses the subtree starting at this node. |
void |
overwritePositions(int sp,
int ep)
Overwrite start and end positions of this node and the subtree starting at this node. |
void |
reflect()
Reflects the subtree starting at this node. |
java.util.Enumeration |
resolvedEnumeration(boolean inverse)
Enumerates a resolved version of the subtree starting at this node. |
void |
setEndPosition(int p)
Sets the end position of the symbol in the source code. |
void |
setStartPosition(int p)
Sets the start position of the symbol in the source code. |
java.util.List |
toResolvedList()
|
java.lang.String |
toString()
Returns a string representation of this node. |
java.lang.String |
toString(Notation notation)
Returns a string representation of this node using the specified notation. |
java.lang.String |
toString(Notation notation,
java.util.List<MacroNode> localMacros)
Returns a string representation of this node using the specified notation and the specified local macros. |
void |
transform(int axis,
int layerMask,
int angle)
Transformes the subtree starting at this node by the given move. |
void |
transform(MoveNode move,
boolean inverse)
|
void |
transformOrientation(int cubeOrientation,
boolean inverse)
Transformes the subtree starting at this node by the given cube orientation. |
void |
writeTokens(java.io.PrintWriter w,
Notation n,
java.util.Map<java.lang.String,MacroNode> macroMap)
Writes the token(s) represented by the subtree starting at this node. |
| 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 |
| Field Detail |
|---|
protected int startpos
protected int endpos
protected Symbol symbol
protected int layerCount
| Constructor Detail |
|---|
public Node(Symbol symbol,
int layerCount,
int startpos,
int endpos)
startpos - The start position of the symbol.endpos - The end position of the symbol.| Method Detail |
|---|
public int getStartPosition()
public void setStartPosition(int p)
public int getEndPosition()
public void setEndPosition(int p)
public void overwritePositions(int sp,
int ep)
public void applyTo(Cube cube,
boolean inverse)
cube - A cube to be transformed by this symbol.inverse - If true, the transform will be done in inverse order.public Symbol getSymbol()
public void dumpTree(int depth)
depth - The number of spaces used for indenting.public java.lang.String toString()
toString in class javax.swing.tree.DefaultMutableTreeNode
public final java.lang.String toString(Notation notation)
throws java.io.IOException
java.io.IOException
public final java.lang.String toString(Notation notation,
java.util.List<MacroNode> localMacros)
throws java.io.IOException
java.io.IOException
public void transform(int axis,
int layerMask,
int angle)
public void transform(MoveNode move,
boolean inverse)
public void transformOrientation(int cubeOrientation,
boolean inverse)
public void inverse()
public void reflect()
public java.util.Enumeration resolvedEnumeration(boolean inverse)
All nodes of the enumeration must be temporary, that is are explicitly created for this enumeration.
The enumeration must not be empty!
inverse - Set to true if you wish to get an
inverted enumeration.public java.util.Enumeration enumerateChildrenReversed()
public int getLayerTurnCount()
public int getBlockTurnCount()
public int getFaceTurnCount()
public int getQuarterTurnCount()
public void writeTokens(java.io.PrintWriter w,
Notation n,
java.util.Map<java.lang.String,MacroNode> macroMap)
throws java.io.IOException
w - This is where the tokens are written to.n - The notation which provides the tokens.macroMap - Local macros which are preserved by the translation.
java.io.IOExceptionpublic Node cloneSubtree()
public java.util.List toResolvedList()
public Node getChildAt(int index)
getChildAt in interface javax.swing.tree.TreeNodegetChildAt in class javax.swing.tree.DefaultMutableTreeNode
|
(c) Werner Randelshofer. All rights reserved. |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||