artisynth.core.modelbase
Class ModelBaseOld

java.lang.Object
  extended by artisynth.core.modelbase.ModelComponentBase
      extended by artisynth.core.modelbase.CompositeComponentBase
          extended by artisynth.core.modelbase.ModelBaseOld
All Implemented Interfaces:
ComponentChangeListener, CompositeComponent, HasState, IndexedComponentList, Model, ModelComponent, java.lang.Cloneable, HasProperties, HierarchyNode, Disposable, Scannable
Direct Known Subclasses:
RenderableModelBaseOld

public abstract class ModelBaseOld
extends CompositeComponentBase
implements Model

Base class providing some default implementations of the Model interface.


Nested Class Summary
 
Nested classes/interfaces inherited from interface artisynth.core.modelbase.ModelComponent
ModelComponent.NavpanelVisibility
 
Nested classes/interfaces inherited from interface artisynth.core.modelbase.CompositeComponent
CompositeComponent.NavpanelDisplay
 
Field Summary
static PropertyList myProps
           
 
Fields inherited from class artisynth.core.modelbase.ModelComponentBase
enforceUniqueCompositeNames, enforceUniqueNames, myNumber, NULL_OBJ, useCompactPathNames
 
Constructor Summary
ModelBaseOld()
           
ModelBaseOld(java.lang.String name)
           
 
Method Summary
abstract  StepAdjustment advance(double t0, double t1, int flags)
          Advances this object from time t0 to time t1.
 ModelBaseOld copy(java.util.Map<ModelComponent,ModelComponent> copyMap, int flags)
           
 ComponentState createState(ComponentState prevState)
          Factory routine to create a state object for this component, which can then be used as an argument for HasState.setState(artisynth.core.modelbase.ComponentState) and HasState.getState(artisynth.core.modelbase.ComponentState).
 void dispose()
          Called when the model is discarded.
 PropertyList getAllPropertyInfo()
          Returns a list giving static information about all properties exported by this object.
 void getInitialState(ComponentState state)
           
 void getInitialState(ComponentState newstate, ComponentState oldstate)
          Gets an initial state for this component and returns the value in state.
 double getMaxStepSize()
          Returns the maximum step size by which this model should be advanced within a simulation loop.
 void getState(ComponentState state)
          Get the current state of this component.
 boolean hierarchyContainsReferences()
          Returns true if the component hierarchy formed by this component and its descendents is closed with respect to references.
 void initialize(double t)
          Causes this model to initialize itself at time t.
 StepAdjustment preadvance(double t0, double t1, int flags)
          Prepares this object for advance from time t0 to time t1.
 void setInitialState(ComponentState state)
           
 void setMaxStepSize(double sec)
          Sets the maximum step size by which this model should be advanced within a simulation loop.
 void setState(ComponentState state)
          Set the state of this component.
 
Methods inherited from class artisynth.core.modelbase.CompositeComponentBase
componentChanged, copy, findComponent, get, get, getByNumber, getChildren, getNavpanelDisplay, getNumberLimit, hasChildren, hasState, indexOf, iterator, numComponents, postscan, scan, setDisplayMode, updateNameMap
 
Methods inherited from class artisynth.core.modelbase.ModelComponentBase
checkFlag, checkName, checkNameUniqueness, clearFlag, clone, connectToHierarchy, createTempFlag, disconnectFromHierarchy, getGrandParent, getHardReferences, getName, getNameRange, getNavpanelVisibility, getNavpanelVisibility, getNumber, getParent, getProperty, getSoftReferences, isFixed, isMarked, isSelected, isWritable, makeValidName, makeValidName, notifyParentOfChange, printReferences, recursivelyContained, recursivelyContains, removeTempFlag, setFixed, setFlag, setMarked, setName, setNavpanelVisibility, setNavpanelVisibility, setNumber, setParent, setSelected, updateReferences, write
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface artisynth.core.modelbase.ModelComponent
connectToHierarchy, disconnectFromHierarchy, getHardReferences, getName, getNavpanelVisibility, getNumber, getParent, getSoftReferences, hasState, isFixed, isMarked, isSelected, notifyParentOfChange, postscan, scan, setFixed, setMarked, setName, setNumber, setParent, setSelected, updateReferences
 
Methods inherited from interface maspack.properties.HasProperties
getProperty
 
Methods inherited from interface maspack.properties.HierarchyNode
getChildren, hasChildren
 
Methods inherited from interface maspack.util.Scannable
isWritable, write
 

Field Detail

myProps

public static PropertyList myProps
Constructor Detail

ModelBaseOld

public ModelBaseOld(java.lang.String name)

ModelBaseOld

public ModelBaseOld()
Method Detail

getAllPropertyInfo

public PropertyList getAllPropertyInfo()
Description copied from interface: HasProperties
Returns a list giving static information about all properties exported by this object.

Specified by:
getAllPropertyInfo in interface HasProperties
Overrides:
getAllPropertyInfo in class ModelComponentBase
Returns:
static information for all exported properties

setState

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

Specified by:
setState in interface HasState
Parameters:
state - state to be copied

getState

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

Specified by:
getState in interface HasState
Parameters:
state - receives the state information

setInitialState

public void setInitialState(ComponentState state)

getInitialState

public void getInitialState(ComponentState state)

getInitialState

public void getInitialState(ComponentState newstate,
                            ComponentState oldstate)
Description copied from interface: HasState
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.

Specified by:
getInitialState in interface HasState
Parameters:
newstate - receives the state information
oldstate - previous state information; may be null.

initialize

public void initialize(double t)
Causes this model to initialize itself at time t. This method will be called at the very beginning of the simulation (with t = 0), or immediately after the model's state has been reset using HasState.setState(artisynth.core.modelbase.ComponentState), in which case t may have an arbitrary value.

Specified by:
initialize in interface Model
Parameters:
t - initialization time (seconds)

preadvance

public StepAdjustment preadvance(double t0,
                                 double t1,
                                 int flags)
Prepares this object for advance from time t0 to time t1. Often this method does nothing; it is provided in case a model needs to update internal state at the very beginning a step before input probes and controllers are applied.

If the method determines that the step size should be reduced, it can return a StepAdjustment object indicating the recommended reduction. Otherwise, the method may return null

Specified by:
preadvance in interface Model
Parameters:
t0 - current time (seconds)
t1 - new time to advance to (seconds)
flags - reserved for future use
Returns:
null, or a step adjustment recommendation

advance

public abstract StepAdjustment advance(double t0,
                                       double t1,
                                       int flags)
Advances this object from time t0 to time t1.

If the method determines that the step size should be reduced, it can return a StepAdjustment object indicating the recommended reduction. Otherwise, the method may return null

Specified by:
advance in interface Model
Parameters:
t0 - current time (seconds)
t1 - new time to advance to (seconds)
flags - reserved for future use
Returns:
null, or a step adjustment recommendation

getMaxStepSize

public double getMaxStepSize()
Returns the maximum step size by which this model should be advanced within a simulation loop.

Specified by:
getMaxStepSize in interface Model
Returns:
maximum step size (seconds)

setMaxStepSize

public void setMaxStepSize(double sec)
Sets the maximum step size by which this model should be advanced within a simulation loop.

Parameters:
sec - maximum step size (seconds)

createState

public ComponentState createState(ComponentState prevState)
Factory routine to create a state object for this component, which can then be used as an argument for HasState.setState(artisynth.core.modelbase.ComponentState) and HasState.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.

Specified by:
createState in interface HasState
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

dispose

public void dispose()
Called when the model is discarded. Disposes of any resources used.

Specified by:
dispose in interface Model
Specified by:
dispose in interface Disposable

hierarchyContainsReferences

public boolean hierarchyContainsReferences()
Returns true if the component hierarchy formed by this component and its descendents is closed with respect to references. In other words, all components referenced by components within the hierarchy are themselves components within the hierarchy.

In particular, this means that one does not need to search outside the hierarchy when looking for dependencies.

Specified by:
hierarchyContainsReferences in interface CompositeComponent
Overrides:
hierarchyContainsReferences in class CompositeComponentBase
Returns:
true if this component's hierarchy is closed with respect to references.

copy

public ModelBaseOld copy(java.util.Map<ModelComponent,ModelComponent> copyMap,
                         int flags)