com.hdcookbook.grin
Class SEGrinXHelper

java.lang.Object
  extended by com.hdcookbook.grin.commands.Command
      extended by com.hdcookbook.grin.GrinXHelper
          extended by com.hdcookbook.grin.SEGrinXHelper
All Implemented Interfaces:
Node, SENode
Direct Known Subclasses:
SECommandList, SESegmentDoneCommand, SESyncDisplayCommand

public abstract class SEGrinXHelper
extends GrinXHelper
implements SENode

This is an abstract superclass of the built-in GRIN commands that are implemented at runtime as direct instances of GrinXHelper. Note that the java_command structure produces commands that are instances of a subclass of GrinXHelper, but on the SE side these are represented using ShowCommand.


Field Summary
 
Fields inherited from class com.hdcookbook.grin.GrinXHelper
COMMAND_LIST, commandNumber, MOUSE_CLICK, MOUSE_MOVE, SEGMENT_DONE, subCommands, SYNC_DISPLAY
 
Fields inherited from class com.hdcookbook.grin.commands.Command
show
 
Constructor Summary
SEGrinXHelper(SEShow show)
           
 
Method Summary
 void changeFeatureReference(Feature from, Feature to)
          Change a feature reference from one feature to a new one.
 boolean equals(java.lang.Object other)
          Override of equals and hashCode to make canonicalization work
 java.lang.String getRuntimeClassName()
          Returns the class that should be constructed at Show runtime to represent this SENode.
 int hashCode()
          Override of equals and hashCode to make canonicalization work
 void postProcess(ShowBuilder builder)
          Do any needed post-processing in this show.
 void writeInstanceData(GrinDataOutputStream out)
          Record this node information to the binary file format.
 
Methods inherited from class com.hdcookbook.grin.GrinXHelper
execute, execute, getInstanceOf, readInstanceData, runSubCommand, setCommandNumber, setCommandObject, setSubCommands, toString
 
Methods inherited from class com.hdcookbook.grin.commands.Command
cloneIfNeeded, deferNextCommands
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.hdcookbook.grin.SENode
accept
 

Constructor Detail

SEGrinXHelper

public SEGrinXHelper(SEShow show)
Method Detail

writeInstanceData

public void writeInstanceData(GrinDataOutputStream out)
                       throws java.io.IOException
Description copied from interface: SENode
Record this node information to the binary file format. An implementation of this method is recommended to call out.writeSuperClassData(this) as the first line of the method to write out data defined in the base class of this Node type.

Specified by:
writeInstanceData in interface SENode
Parameters:
out - The stream to write out.
Throws:
java.io.IOException - if error occurs.
See Also:
GrinDataOutputStream.writeSuperClassData(Feature), GrinDataOutputStream.writeSuperClassData(RCHandler), GrinDataOutputStream.writeSuperClassData(Segment), GrinDataOutputStream.writeSuperClassData(Command)

equals

public boolean equals(java.lang.Object other)
Override of equals and hashCode to make canonicalization work

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Override of equals and hashCode to make canonicalization work

Overrides:
hashCode in class java.lang.Object

getRuntimeClassName

public java.lang.String getRuntimeClassName()
Description copied from interface: SENode
Returns the class that should be constructed at Show runtime to represent this SENode.

Specified by:
getRuntimeClassName in interface SENode
Returns:
String A fully qualified classname of a Node at xlet runtime.

postProcess

public void postProcess(ShowBuilder builder)
                 throws java.io.IOException
Do any needed post-processing in this show. The grin compiler works as follows:

During the post-process phase, a node can add new features to the show, by calling ShowBuilder.addSyntheticFeature(), and it can insert a new feature as the parent of a given feature, by calling ShowBuilder.injectParent(). It can also add segments and handlers by calling the appropriate builder methods.

When a parent is injected, the ShowBuilder calls postProcess() on all nodes automatically, including nodes that are created during the execution of postProcess() in another node.

Specified by:
postProcess in interface SENode
Parameters:
builder - The builder that holds state for the show
Throws:
java.io.IOException - if an error is encountered
See Also:
ShowBuilder.addSyntheticFeature(Feature), ShowBuilder.injectParent(Feature, Feature)

changeFeatureReference

public void changeFeatureReference(Feature from,
                                   Feature to)
                            throws java.io.IOException
Change a feature reference from one feature to a new one. If your node has a reference to the feature from, it should be changed to refer to to. This is called for every node in an SEShow when SENode.injectParent is used.

The ShowBuilder calls changeFeatureReference() on all nodes automatically, including nodes that are created during the execution of postProcess().

Specified by:
changeFeatureReference in interface SENode
Throws:
java.io.IOException - If the operation can't be completed
See Also:
SENode.changeFeatureReference(Feature, Feature)