|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.hdcookbook.grin.commands.Command com.hdcookbook.grin.commands.ActivatePartCommand
public class ActivatePartCommand
A GRIN command to activate a part within an assembly.
Field Summary | |
---|---|
protected Assembly |
assembly
|
protected Feature |
part
|
Fields inherited from class com.hdcookbook.grin.commands.Command |
---|
show |
Constructor Summary | |
---|---|
ActivatePartCommand(Show show)
|
|
ActivatePartCommand(Show show,
Assembly assembly,
Feature part)
Constructor for use by xlets that want to change the state of an assembly |
Method Summary | |
---|---|
Command |
cloneIfNeeded(java.util.HashMap featureClones)
Return this command, or if needed, a copy of this command. |
void |
execute()
Execute the command. |
Assembly |
getAssembly()
|
Feature |
getPart()
|
void |
readInstanceData(GrinDataInputStream in,
int length)
Reads in this node information from the binary file format. |
Methods inherited from class com.hdcookbook.grin.commands.Command |
---|
deferNextCommands, execute, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected Assembly assembly
protected Feature part
Constructor Detail |
---|
public ActivatePartCommand(Show show, Assembly assembly, Feature part)
public ActivatePartCommand(Show show)
Method Detail |
---|
public Command cloneIfNeeded(java.util.HashMap featureClones)
Most commands don't have any data members that contain mutable state, that is, data memebers whose values are modified (e.g. when the command is executed). Also, most commands don't refer to part of a scene graph. For this reason, when a subtree of a scene graph is cloned, most of the cloned features can just re-use the same Command objects in their endCommands arrays.
However, some commands to contain references to features. If a command in a subtree being cloned refers to a feature in that subtree, then the cloned command should refer to the cloned feature. Commands that do this should override this method to provide a copy of the command, with the feature references mapeped over.
Further, it's possible that a command subclass might contain a data member that gets modified, e.g. during command execution. This is probably bad form, and none of the GRIN commands do this, but if you make a command subclass that does, you should override this method so that cloned commands get a new instance of your command subclass.
The default implementation of this method returns the current instances.
cloneIfNeeded
in class Command
featureClones
- HashMappublic Assembly getAssembly()
public Feature getPart()
public void execute()
Command
execute
in class Command
public void readInstanceData(GrinDataInputStream in, int length) throws java.io.IOException
Node
An implementation of this method is recommended to call in.readSuperClassData(this) as the first line of the method to read in information that is defined in the base class of this Node type.
This should only be called while initializing this object.
readInstanceData
in interface Node
in
- InputStream to read data from.length
- the number of bytes that this node's information occupies
in the InputStream. The implementation of this method is expected to
read exactly this number of bytes from the stream. This can be used
for a debugging purpose.
java.io.IOException
- if error occurs.GrinDataInputStream.readSuperClassData(Feature)
,
GrinDataInputStream.readSuperClassData(RCHandler)
,
GrinDataInputStream.readSuperClassData(Segment)
,
GrinDataInputStream.readSuperClassData(Command)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |