public interface HasState
Modifier and Type | Method and Description |
---|---|
ComponentState |
createState(ComponentState prevState)
Factory routine to create a state object for this component, which can
then be used as an argument for
setState(artisynth.core.modelbase.ComponentState) and getState(artisynth.core.modelbase.ComponentState) . |
void |
getInitialState(ComponentState state,
ComponentState prevstate)
Gets an initial state for this component and returns the value in
state . |
void |
getState(ComponentState state)
Get the current state of this component.
|
void |
setState(ComponentState state)
Set the state of this component.
|
void setState(ComponentState state)
state
- state to be copiedjava.lang.IllegalArgumentException
- if the supplied state object is incompatible with this componentvoid getState(ComponentState state)
state
- receives the state informationjava.lang.IllegalArgumentException
- if the supplied state object is incompatible with this componentvoid getInitialState(ComponentState state, ComponentState prevstate)
state
. If prevstate
is non-null, then it is
assumed to contain a previous initial state value returned by this
method, and state
should be set to be as consistent with
this previous state as possible. For example, suppose that this component
currently contains subcomponents A, B, and C, while the
prevstate
contains the state from a previous time when it
had components B, C, and D. Then state
should contain
substate values for B and C that are taken from
prevstate
. To facilitate this, the information returned in
state
should contain additional information such as the
identities of all the (current) subcomponents.state
- receives the state informationprevstate
- previous state information; may be null
.java.lang.IllegalArgumentException
- if the supplied state object is incompatible with this componentComponentState createState(ComponentState prevState)
setState(artisynth.core.modelbase.ComponentState)
and getState(artisynth.core.modelbase.ComponentState)
. The state object does not have to be set to the component's
current state. If the component does not have any state information,
this method should return an instance of
EmptyState
.prevState
- If non-null, supplies a previous state that
was created by this component and which can be used to provide
pre-sizing hints.