CubeTwister 2.0alpha142 2012-02-11

ch.randelshofer.cubetwister.doc
Class ScriptModel

java.lang.Object
  extended by javax.swing.tree.DefaultMutableTreeNode
      extended by ch.randelshofer.cubetwister.doc.EntityModel
          extended by ch.randelshofer.cubetwister.doc.InfoModel
              extended by ch.randelshofer.cubetwister.doc.ScriptModel
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.EventListener, javax.swing.event.UndoableEditListener, javax.swing.tree.MutableTreeNode, javax.swing.tree.TreeNode

public class ScriptModel
extends InfoModel

Holds a Script and its attributes.

Version:
2.2.1 2010-04-05 Removed dependencies to IBM Unicode normalizer.
2.2 Normalize script to Unicode NFKC before parsing.
2.1 2007-08-11 Moved "name" property into superclass.
1.3 2006-09-24 Reworked.
1.2.2 2004-07-31 Variable parseException was not properly assigned in method check().
1.2.1 2003-03-05 ProProgressPanelst not be cloned.
1.2 2002-12-26 Method translateInto(NotatationModel) improved.
1.1.2 2002-11-20 Set the notationModel property to getDocument.getDefaultNotation(), when the notationModel is removed from the document.
1.1.1 2002-02-03 TranslateInto and change of Notation could not be undone.
Author:
Werner Randelshofer, Hausmatt 10, CH-6405 Immensee, Switzerland.
See Also:
Serialized Form

Field Summary
static java.lang.String CHECKED_PROPERTY
           
static java.lang.String CUBE_PROPERTY
           
static int MODE_RECORD
           
static int MODE_STICKER
           
static int MODE_TWIST
           
static java.lang.String NOTATION_PROPERTY
           
static java.lang.String PROP_CUBE_3D
           
static java.lang.String PROP_INTERACTION_MODE
           
static java.lang.String PROP_IS_GENERATOR
           
static java.lang.String PROP_NAME
           
static java.lang.String PROP_SCRIPT
           
static java.lang.String PROP_SCRIPT_MODEL
           
static java.lang.String PROP_SOLVER_MODEL
           
static java.lang.String PROP_STATE_INFO
           
 
Fields inherited from class ch.randelshofer.cubetwister.doc.InfoModel
author, date, description, name, PROP_AUTHOR, PROP_DATE, PROP_DESCRIPTION
 
Fields inherited from class ch.randelshofer.cubetwister.doc.EntityModel
PROP_CHILD_COUNT
 
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode
allowsChildren, children, EMPTY_ENUMERATION, parent, userObject
 
Constructor Summary
ScriptModel()
          Creates new CubeScript
 
Method Summary
 void addNotify(EntityModel m)
           
 void basicSetScript(java.lang.String value)
           
 void check()
           
 void clearParseException()
           
 java.lang.Object clone()
          Returns a shallow copy of this model.
 Cube getCube()
           
 Cube3D getCube3D()
           
 CubeModel getCubeModel()
           
 int getInteractionMode()
           
 javax.swing.tree.DefaultMutableTreeNode getMacroModels()
           
 java.util.List<MacroNode> getMacros()
           
 NotationModel getNotationModel()
           
 SequenceNode getParsedScript()
          Returns a parsed version of the script.
 ParseException getParseException()
           
 ScriptParser getParser()
           
 ScriptPlayer getPlayer()
           
 ProgressObserver getProgressView()
          Gets the progress view of a running solver that writes its results into this script model.
 java.lang.String getScript()
           
 javax.swing.text.StyledDocument getScriptDocument()
           
 SolverModel getSolverModel()
           
 java.lang.String getStateInfo()
           
 boolean isChecked()
           
 boolean isGenerator()
           
 boolean isRemovable()
          Returns true if the node may be removed from its parent.
 boolean isUsingDefaultCube()
           
 boolean isUsingDefaultNotation()
           
 void removeNotify(EntityModel m)
           
 void reset()
           
 void scramble()
           
 void setCubeModel(CubeModel value)
           
 void setGenerator(boolean value)
           
 void setNotationModel(NotationModel value)
           
 void setProgressView(ProgressObserver view)
          Sets the progress view of a running solver that writes its results into this script model.
 void setScript(java.lang.String value)
           
 void translateInto(NotationModel n)
           
 void uncheck()
           
 
Methods inherited from class ch.randelshofer.cubetwister.doc.InfoModel
basicSetAuthor, basicSetDate, basicSetDescription, basicSetName, dispose, getAuthor, getAuthorDocument, getDate, getDateDocument, getDescription, getDescriptionDocument, getName, getNameDocument, getUserObject, setAuthor, setDate, setDescription, setName, setUserObject, toString, undoableEditHappened
 
Methods inherited from class ch.randelshofer.cubetwister.doc.EntityModel
addPropertyChangeListener, children, fireNodeChanged, fireNodeStructureChanged, firePropertyChange, firePropertyChange, firePropertyChange, fireUndoableEditHappened, getDocument, hasPropertyListeners, insert, isDefaultCube, isDefaultNotation, remove, removePropertyChangeListener, setRemovable
 
Methods inherited from class javax.swing.tree.DefaultMutableTreeNode
add, breadthFirstEnumeration, 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, getUserObjectPath, isLeaf, isNodeAncestor, isNodeChild, isNodeDescendant, isNodeRelated, isNodeSibling, isRoot, pathFromAncestorEnumeration, postorderEnumeration, preorderEnumeration, remove, removeAllChildren, removeFromParent, setAllowsChildren, setParent
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PROP_NAME

public static final java.lang.String PROP_NAME
See Also:
Constant Field Values

PROP_SCRIPT

public static final java.lang.String PROP_SCRIPT
See Also:
Constant Field Values

NOTATION_PROPERTY

public static final java.lang.String NOTATION_PROPERTY
See Also:
Constant Field Values

CHECKED_PROPERTY

public static final java.lang.String CHECKED_PROPERTY
See Also:
Constant Field Values

PROP_STATE_INFO

public static final java.lang.String PROP_STATE_INFO
See Also:
Constant Field Values

CUBE_PROPERTY

public static final java.lang.String CUBE_PROPERTY
See Also:
Constant Field Values

PROP_IS_GENERATOR

public static final java.lang.String PROP_IS_GENERATOR
See Also:
Constant Field Values

PROP_SOLVER_MODEL

public static final java.lang.String PROP_SOLVER_MODEL
See Also:
Constant Field Values

PROP_SCRIPT_MODEL

public static final java.lang.String PROP_SCRIPT_MODEL
See Also:
Constant Field Values

PROP_INTERACTION_MODE

public static final java.lang.String PROP_INTERACTION_MODE
See Also:
Constant Field Values

PROP_CUBE_3D

public static final java.lang.String PROP_CUBE_3D
See Also:
Constant Field Values

MODE_TWIST

public static final int MODE_TWIST
See Also:
Constant Field Values

MODE_STICKER

public static final int MODE_STICKER
See Also:
Constant Field Values

MODE_RECORD

public static final int MODE_RECORD
See Also:
Constant Field Values
Constructor Detail

ScriptModel

public ScriptModel()
Creates new CubeScript

Method Detail

getCubeModel

public CubeModel getCubeModel()

isUsingDefaultCube

public boolean isUsingDefaultCube()

setCubeModel

public void setCubeModel(CubeModel value)

getScript

public java.lang.String getScript()

getScriptDocument

public javax.swing.text.StyledDocument getScriptDocument()

setScript

public void setScript(java.lang.String value)

basicSetScript

public void basicSetScript(java.lang.String value)

getNotationModel

public NotationModel getNotationModel()

isUsingDefaultNotation

public boolean isUsingDefaultNotation()

setNotationModel

public void setNotationModel(NotationModel value)

addNotify

public void addNotify(EntityModel m)

removeNotify

public void removeNotify(EntityModel m)

getParser

public ScriptParser getParser()

getParseException

public ParseException getParseException()

clearParseException

public void clearParseException()

check

public void check()
           throws ParseException
Throws:
ParseException

isChecked

public boolean isChecked()

isGenerator

public boolean isGenerator()

setGenerator

public void setGenerator(boolean value)

uncheck

public void uncheck()

getStateInfo

public java.lang.String getStateInfo()

getParsedScript

public SequenceNode getParsedScript()
Returns a parsed version of the script. Returns an empty script, if the parsing failed - never returns null.


getMacros

public java.util.List<MacroNode> getMacros()

getMacroModels

public javax.swing.tree.DefaultMutableTreeNode getMacroModels()

translateInto

public void translateInto(NotationModel n)
                   throws java.io.IOException
Throws:
java.io.IOException

clone

public java.lang.Object clone()
Description copied from class: InfoModel
Returns a shallow copy of this model. All references to other models are maintained. The new model has no parent or children and no property change listeners.

Overrides:
clone in class InfoModel

setProgressView

public void setProgressView(ProgressObserver view)
Sets the progress view of a running solver that writes its results into this script model.


getProgressView

public ProgressObserver getProgressView()
Gets the progress view of a running solver that writes its results into this script model.


isRemovable

public boolean isRemovable()
Returns true if the node may be removed from its parent.

Overrides:
isRemovable in class EntityModel

getInteractionMode

public int getInteractionMode()

getPlayer

public ScriptPlayer getPlayer()

getCube

public Cube getCube()

getCube3D

public Cube3D getCube3D()

getSolverModel

public SolverModel getSolverModel()

reset

public void reset()

scramble

public void scramble()

(c) Werner Randelshofer.
All rights reserved.