public class CompositeState extends java.lang.Object implements ComponentState
Constructor and Description |
---|
CompositeState() |
CompositeState(boolean annotated) |
CompositeState(int capacity) |
Modifier and Type | Method and Description |
---|---|
void |
addState(ComponentState state) |
void |
clear() |
CompositeState |
duplicate()
Create a duplicate of this state which can be used for storing this
state's values.
|
boolean |
equals(ComponentState state,
java.lang.StringBuilder msg)
Returns true if this state equals another component state.
|
ComponentState |
getState(int i) |
java.util.Iterator<ComponentState> |
getStates() |
boolean |
isAnnotated()
Queries whether or not this state is annotated.
|
boolean |
isWritable()
Returns
true if this component should in fact be written to
secondary storage. |
int |
numSubStates() |
void |
printState(int indent)
Debugging method to print the structure of a composite state
|
void |
readBinary(java.io.DataInputStream dis)
Read this state (in binary format) from a data input stream.
|
void |
removeState(ComponentState state) |
void |
scan(ReaderTokenizer rtok,
java.lang.Object ref)
Scans this element from a ReaderTokenizer.
|
void |
set(ComponentState stateToCopy)
Sets this state by copying the value from an existing state object.
|
void |
set(CompositeState state) |
void |
setAnnotated(boolean annotated)
Requests that this state be annotated.
|
void |
write(java.io.PrintWriter pw,
NumberFormat fmt,
java.lang.Object ref)
Writes a text description of this element to a PrintWriter.
|
void |
writeBinary(java.io.DataOutputStream dos)
Writes this state (in binary format) to a data output stream.
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
equals
public CompositeState()
public CompositeState(boolean annotated)
public CompositeState(int capacity)
public java.util.Iterator<ComponentState> getStates()
public ComponentState getState(int i)
public void addState(ComponentState state)
public void removeState(ComponentState state)
public int numSubStates()
public void clear()
public boolean equals(ComponentState state, java.lang.StringBuilder msg)
equals
in interface ComponentState
state
- state to compare tomsg
- If not null
, can be used to append diagnostic
information if the states are not equal.public void writeBinary(java.io.DataOutputStream dos) throws java.io.IOException
ComponentState
writeBinary
in interface ComponentState
dos
- output stream to write model tojava.io.IOException
- if an I/O error occurredpublic void readBinary(java.io.DataInputStream dis) throws java.io.IOException
ComponentState
readBinary
in interface ComponentState
dis
- input stream to read model fromjava.io.IOException
- if an I/O error occurred or if the input is incompatible with the current
state configuration.public boolean isWritable()
Scannable
true
if this component should in fact be written to
secondary storage. This gives subclasses control over whether or
not they are actually written out.isWritable
in interface Scannable
true
if this component should be written to
secondary storage.public void write(java.io.PrintWriter pw, NumberFormat fmt, java.lang.Object ref) throws java.io.IOException
Scannable
scan
and complete
enough to allow full reconstruction of the element.public void scan(ReaderTokenizer rtok, java.lang.Object ref) throws java.io.IOException
Scannable
write
.public void set(ComponentState stateToCopy)
ComponentState
set
in interface ComponentState
stateToCopy
- state object to copypublic void set(CompositeState state)
public CompositeState duplicate()
ComponentState
duplicate
in interface ComponentState
public void printState(int indent)
public boolean isAnnotated()
msg
argument to
equals(state,msg)
.isAnnotated
in interface ComponentState
true
if this state is annotated.public void setAnnotated(boolean annotated)
ComponentState.isAnnotated()
for more details.
Support for this method is optional. Applications should
check isAnnotated()
to determine if the request has been
honored.
setAnnotated
in interface ComponentState
annotated
- if true
, requests that this state be annotated.