CubeTwister 2.0alpha141 2011-10-13

ch.randelshofer.rubik.parser
Interface Notation

All Known Implementing Classes:
CubeMarkupNotation, DefaultNotation, NotationModel

public interface Notation

Notation describes the tokens and syntax used by the Parser.

Version:
5.02 2008-06-22 Migraded from JDK 1.4 to 1.5. Added method getMacroModels.
4.0 2008-01-03 Migrated from JDK 1.1 to 1.4.
3.0 2007-06-16 Renamed "twist" to "move".
2.0 2005-01-31 Reworked.
1.0 31 January 2005 Created.
Author:
Werner Randelshofer

Method Summary
 void configureMoveFromToken(MoveNode move, java.lang.String twistToken)
          Configures a MoveNode from the specified move token.
 java.lang.String getEquivalentMacro(Cube cube, java.util.Map localMacros)
          Returns a macro which performs the same transformation as the cube parameter.
 int getLayerCount()
          Returns the number of layers supported by this notation.
 java.util.List<MacroNode> getMacros()
          Returns the macros defined by this notation.
 Symbol getSymbolFor(java.lang.String token, Symbol compositeSymbol)
          Returns a symbol for the specified token.
 Syntax getSyntax(Symbol s)
          Returns the syntax for the specified symbol.
 java.lang.String getToken(Move s)
          Returns a token for the specified move.
 java.lang.String getToken(Symbol s)
          Returns a token for the specified symbol.
 boolean isSupported(Symbol s)
          Returns true, if this notation supports the specified symbol.
 boolean isToken(java.lang.String token)
          Returns true, if the specified String is a token of this notation.
 boolean isTokenFor(java.lang.String token, Symbol symbol)
          Returns true, if the specified String is a token for the specified symbol.
 void writeToken(java.io.PrintWriter w, int axis, int layerMask, int angle)
          Writes a token for the specified transformation to the print writer.
 void writeToken(java.io.PrintWriter w, Symbol symbol)
          Writes a token for the specified symbol to the print writer.
 

Method Detail

getLayerCount

int getLayerCount()
Returns the number of layers supported by this notation.


getEquivalentMacro

java.lang.String getEquivalentMacro(Cube cube,
                                    java.util.Map localMacros)
Returns a macro which performs the same transformation as the cube parameter. Returns null if no macro is available.

Parameters:
cube - A transformed cube.
localMacros - A Map with local macros.

getMacros

java.util.List<MacroNode> getMacros()
Returns the macros defined by this notation.

Returns:
macros.

writeToken

void writeToken(java.io.PrintWriter w,
                Symbol symbol)
                throws java.io.IOException
Writes a token for the specified symbol to the print writer.

Throws:
java.io.IOException - If the symbol is not supported by the notation, and if no alternative symbols could be found.

writeToken

void writeToken(java.io.PrintWriter w,
                int axis,
                int layerMask,
                int angle)
                throws java.io.IOException
Writes a token for the specified transformation to the print writer.

Throws:
java.io.IOException

isSupported

boolean isSupported(Symbol s)
Returns true, if this notation supports the specified symbol.


getSyntax

Syntax getSyntax(Symbol s)
Returns the syntax for the specified symbol. Note: This makes only sense for composite symbols.


isToken

boolean isToken(java.lang.String token)
Returns true, if the specified String is a token of this notation.


isTokenFor

boolean isTokenFor(java.lang.String token,
                   Symbol symbol)
Returns true, if the specified String is a token for the specified symbol.


getToken

java.lang.String getToken(Symbol s)
Returns a token for the specified symbol. If the symbol has more than one token, the first token is returned. Returns null, if symbol is not supported.


getToken

java.lang.String getToken(Move s)
Returns a token for the specified move. If the move has more than one token, the first token is returned. Returns null, if move is not supported.


getSymbolFor

Symbol getSymbolFor(java.lang.String token,
                    Symbol compositeSymbol)
Returns a symbol for the specified token. The compositeSymbol must be specified do disambiguate tokens. If the compositeSymbol is null, then the token must be unambiguous. Returns null, if the token is not a token for the specified compositeSymbol.


configureMoveFromToken

void configureMoveFromToken(MoveNode move,
                            java.lang.String twistToken)
Configures a MoveNode from the specified move token.


(c) Werner Randelshofer.
All rights reserved.