org.eclipse.amp.escape.ascape.wrap
Class ScapeWrapperModel

java.lang.Object
  extended by org.eclipse.amp.escape.ascape.wrap.ScapeWrapperModel
All Implemented Interfaces:
ILifecycleNotifier, IModel, IObservationProvider

public class ScapeWrapperModel
extends java.lang.Object
implements IModel

The Class ScapeWrapperModel.


Constructor Summary
ScapeWrapperModel(org.ascape.model.Scape scape)
          Instantiates a new scape wrapper model.
 
Method Summary
 void addListener(org.eclipse.jface.viewers.ILabelProviderListener listener)
          Adds the listener.
 void addModelListener(ILifeCycleListener listener)
          Adds the model listener.
 void dispose()
          Dispose.
 IEngine getEngine()
          Gets the engine.
 java.util.Collection<ILifeCycleListener> getModelListeners()
          Gets the model listeners.
 java.lang.String getName()
          Gets the name.
 int getPeriod()
          Gets the period, encoded as a long value as defined by the IEngine time granularity.
 java.lang.Object getRoot()
          Returns the root object for the model, that is the modeled object itself.
 org.ascape.model.Scape getScape()
          Gets the scape.
 int getStopPeriod()
          Gets the stop period.
 java.lang.String getText(java.lang.Object element)
          Gets the text.
 java.lang.String getTimeDescription()
          Gets the time description.
 boolean isActive()
          Is the model currently active? Any model that has been started and has not stopped is considered active, even if the model is not actively executing (using CPU cycles or advancing from one state to another.)
 boolean isCreated()
          Has the model been created? Should return true if observable start time components have been created.
 boolean isEnded()
          Has model has ended? In general, a model that has ended can never be (re) started.
 boolean isEnding()
          Is the model currently in the process of ending itself? This state gives views a chance to get any final state while the model is still guaranteed to be available and consistent.
 boolean isInitialized()
          Has the model been initialized? Should return true if all time 0 components have been created and initialized.
 boolean isLabelProperty(java.lang.Object element, java.lang.String property)
          Checks if is label property.
 boolean isStarted()
          Has the model been started?
 boolean isStopped()
          Has the model been stopped? When a model has been stopped, it cannot return to active state without being (re) started.
 void removeListener(org.eclipse.jface.viewers.ILabelProviderListener listener)
          Removes the listener.
 void removeModelListener(ILifeCycleListener listener)
          Removes the model listener.
 void setClosed(boolean closed)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScapeWrapperModel

public ScapeWrapperModel(org.ascape.model.Scape scape)
Instantiates a new scape wrapper model.

Parameters:
scape - the scape
Method Detail

getName

public java.lang.String getName()
Description copied from interface: IModel
Gets the name.

Specified by:
getName in interface IModel
Returns:
See Also:
IModel.getName()

getPeriod

public int getPeriod()
Description copied from interface: IModel
Gets the period, encoded as a long value as defined by the IEngine time granularity.

Specified by:
getPeriod in interface IModel
Returns:
See Also:
IModel.getPeriod()

getEngine

public IEngine getEngine()
Description copied from interface: IModel
Gets the engine.

Specified by:
getEngine in interface IModel
Returns:
See Also:
IModel.getEngine()

getRoot

public java.lang.Object getRoot()
Description copied from interface: IModel
Returns the root object for the model, that is the modeled object itself.

Specified by:
getRoot in interface IModel
Returns:
See Also:
IModel.getRoot()

getStopPeriod

public int getStopPeriod()
Description copied from interface: IModel
Gets the stop period.

Specified by:
getStopPeriod in interface IModel
Returns:
See Also:
IModel.getStopPeriod()

getTimeDescription

public java.lang.String getTimeDescription()
Description copied from interface: IModel
Gets the time description.

Specified by:
getTimeDescription in interface IModel
Returns:
See Also:
IModel.getTimeDescription()

addModelListener

public void addModelListener(ILifeCycleListener listener)
Description copied from interface: ILifecycleNotifier
Adds the model listener.

Specified by:
addModelListener in interface ILifecycleNotifier
Parameters:
listener -
See Also:
org.eclipse.amp.axf.core.IObservationProvider#addModelListener(org.eclipse.amp.axf.core.ILifeCycleListener)

getModelListeners

public java.util.Collection<ILifeCycleListener> getModelListeners()
Description copied from interface: ILifecycleNotifier
Gets the model listeners.

Specified by:
getModelListeners in interface ILifecycleNotifier
Returns:
See Also:
org.eclipse.amp.axf.core.IObservationProvider#getModelListeners()

removeModelListener

public void removeModelListener(ILifeCycleListener listener)
Description copied from interface: ILifecycleNotifier
Removes the model listener.

Specified by:
removeModelListener in interface ILifecycleNotifier
Parameters:
listener -
See Also:
org.eclipse.amp.axf.core.IObservationProvider#removeModelListener(org.eclipse.amp.axf.core.ILifeCycleListener)

isInitialized

public boolean isInitialized()
Description copied from interface: IObservationProvider
Has the model been initialized? Should return true if all time 0 components have been created and initialized. It is up to implementation to define semantics of when a model is created vs. when it is initialized, but the following guidelines are recommended to ensure good model repeatability and performance. To be considered initialized, a model ideally has:
 1. All model components necessary for running the model forward have been created and had initial state set.
 2. Model state should be recoverable to initialized state after stopping and (re) starting without passing through created state.
 3. For a given set of inputs, under (2) this state should be be consistent, regardless of whether the model has been newly created or repeatedly returned to initialized state.
 
Note a very important consequence of the above guidelines for initialized state. No random decisions affecting model state should occur before the model leaves the start state and enters the initializing state as those decisions would make it impossible to consistently re-enter the same state.

Specified by:
isInitialized in interface IObservationProvider
Returns:
See Also:
IObservationProvider.isInitialized()

getScape

public org.ascape.model.Scape getScape()
Gets the scape.

Returns:
the scape

getText

public java.lang.String getText(java.lang.Object element)
Gets the text.

Parameters:
element - the element
Returns:
the text

addListener

public void addListener(org.eclipse.jface.viewers.ILabelProviderListener listener)
Adds the listener.

Parameters:
listener - the listener

dispose

public void dispose()
Dispose.


isLabelProperty

public boolean isLabelProperty(java.lang.Object element,
                               java.lang.String property)
Checks if is label property.

Parameters:
element - the element
property - the property
Returns:
true, if is label property

removeListener

public void removeListener(org.eclipse.jface.viewers.ILabelProviderListener listener)
Removes the listener.

Parameters:
listener - the listener

isActive

public boolean isActive()
Description copied from interface: IObservationProvider
Is the model currently active? Any model that has been started and has not stopped is considered active, even if the model is not actively executing (using CPU cycles or advancing from one state to another.)

Specified by:
isActive in interface IObservationProvider
Returns:
See Also:
IObservationProvider.isActive()

isCreated

public boolean isCreated()
Description copied from interface: IObservationProvider
Has the model been created? Should return true if observable start time components have been created. It is up to implementation to define semantics of when a model is created vs. when it is initialized, but the following guidelines are recommended to ensure good model repeatability and performance. To be considered created, a model needs:
 1. Internally consistent state.
 2. Consistent start state across invocations with same input sets.
 3. Consistent (and ideally, useful and complete!) external state through all supplied providers.
 4. Accurately updated life cycle state.
 5. In general, all basic component structure constructed.
 
A good way to think of this state is as having all scaffolding in place. As outlined in #isInitialized, there should be no calls to random functions before the model has passed through this state. It is up to the implementation to decide (and seems generally reasonable) whether to allow a model to be re-created, and clients should generally handle this situation gracefully.

Specified by:
isCreated in interface IObservationProvider
Returns:
See Also:
IObservationProvider.isCreated()

isEnded

public boolean isEnded()
Description copied from interface: IObservationProvider
Has model has ended? In general, a model that has ended can never be (re) started. It is up to implementations to define whether model state is consistent and stable following the transition to ended state.

Specified by:
isEnded in interface IObservationProvider
Returns:
See Also:
IObservationProvider.isEnded()

isEnding

public boolean isEnding()
Description copied from interface: IObservationProvider
Is the model currently in the process of ending itself? This state gives views a chance to get any final state while the model is still guaranteed to be available and consistent.

Specified by:
isEnding in interface IObservationProvider
Returns:
See Also:
IObservationProvider.isEnding()

isStarted

public boolean isStarted()
Description copied from interface: IObservationProvider
Has the model been started?

Specified by:
isStarted in interface IObservationProvider
Returns:
See Also:
IObservationProvider.isStarted()

isStopped

public boolean isStopped()
Description copied from interface: IObservationProvider
Has the model been stopped? When a model has been stopped, it cannot return to active state without being (re) started.

Specified by:
isStopped in interface IObservationProvider
Returns:
See Also:
IObservationProvider.isStopped()

setClosed

public void setClosed(boolean closed)
Parameters:
closed - the closed to set