artisynth.core.modelbase
Interface HasState

All Known Subinterfaces:
Controller, MechSystemModel, Model, ModelAgent, Monitor
All Known Implementing Classes:
AffineNumericInputProbe, ArticulatedBeamBody, ArticulatedDemo, ArticulatedFem, AttachDemo, AttachedBeamDemo, BlockTest, ColoredFemBeam3d, CompliantConstraintDemo, ConstrainedParticle, ControllerBase, ControllerMonitorBase, CoupledSolveDemo, CutPlaneProbe, DoubleArmDemo, FallingSkull, Fem3dBlock, FemBeam3d, FemBeamMech, FemCollision, FemDisplayProbe, FemFrictionBeam, FemModel, FemModel3d, FemMuscleArm, FemMuscleDemo, FemMuscleModel, FemSingleTet, FemSkinDemo, FemSphere, FishDemo, FrameSpringDemo, Hex3dBlock, HexBeam3d, HexFrame, HexIncompress, HexSheet, HydrostatDemo, HydrostatInvDemo, HydrostatModel, HydrostatTubeDemo, ImagePlaneProbe, ImageProbe, InputProbe, LaymanBowl, LaymanDemo, LaymanModel, LockingDemo, LumbarSpringDemo, MassSpringDemo, MechModel, MechModelCollide, MechModelDemo, MechSystemBase, MeshIntersectingProbe, MFreeModel3d, MFreeMuscleModel, ModelAgentBase, ModelBase, ModelBaseOld, MonitorBase, MultiMuscleDemo, MultiSpringDemo, MuscleArm, NetDemo, NumericInputProbe, NumericOutputProbe, NumericProbeBase, OutputProbe, PlanarConnectorDemo, PlaneConstrainedFem, PointForceDemo, PointModel, PointModel1d, PointModel2d, PointModel3d, PointToPointMuscle, PointTracingProbe, Probe, PuddleDemo, PullController, PuppetDemo, QuadFishDemo, RenderableModelBase, RenderableModelBaseOld, RenderProbe, RigidBodyCollision, RigidBodyDemo, RigidTentacle, RigidTransformInputProbe, RobustCube, RollPitchJointDemo, RootModel, SegmentedPlaneDemo, SelfCollision, SheetDemo, SimpleCollide, SingleHex, SinglePyramid, SingleQuadhex, SingleQuadpyramid, SingleQuadtet, SingleQuadwedge, SingleTet, SingleWedge, SkinDemo, SkullParticles, SleepProbe, SphericalJointDemo, SpongeDemo, SpongeModel, SpringMeshDemo, Tentacle, TetBeam3d, TracingProbe, TrackingController, VectorTracingProbe, ViscousBeam, WayPointProbe

public interface HasState

Interface for a model component that can contain state and can save and restore this state to a ComponentState object.


Method Summary
 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.
 

Method Detail

setState

void setState(ComponentState state)
Set the state of this component.

Parameters:
state - state to be copied
Throws:
java.lang.IllegalArgumentException - if the supplied state object is incompatible with this component

getState

void getState(ComponentState state)
Get the current state of this component.

Parameters:
state - receives the state information
Throws:
java.lang.IllegalArgumentException - if the supplied state object is incompatible with this component

getInitialState

void getInitialState(ComponentState state,
                     ComponentState prevstate)
Gets an initial state for this component and returns the value in 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) sub-components.

Parameters:
state - receives the state information
prevstate - previous state information; may be null.
Throws:
java.lang.IllegalArgumentException - if the supplied state object is incompatible with this component

createState

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). 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.

Parameters:
prevState - If non-null, supplies a previous state that was created by this component and which can be used to provide pre-sizing hints.
Returns:
new object for storing this component's state