ConForM.CoopnTools.CoKer.ScenarioMgr
Class TrueState

java.lang.Object
  |
  +--ConForM.CoopnTools.CoKer.ScenarioMgr.ScenarioElement
        |
        +--ConForM.CoopnTools.CoKer.ScenarioMgr.State
              |
              +--ConForM.CoopnTools.CoKer.ScenarioMgr.TrueState
All Implemented Interfaces:
java.lang.Cloneable, CoopnSyntacticElement, java.io.Serializable

public class TrueState
extends State

States in the CO-OPN semantics.

See Also:
Serialized Form

Constructor Summary
TrueState(CoopnWorkspace spec)
          Build a new empty state for a workspace (and therefore for a specification).
 
Method Summary
 CoopnType actualObjectType(CoopnTerm oid)
          Get the actual type of an object, or null iff oid not konwn.
 void addCoid(CoopnTerm coid)
          Add a coid.
 void addContextState(ContextState state)
          Add a context state, with its objects.
 CoopnTerm cloid(CoopnType type)
          Return the set of current last object odentifier of a type.
 java.lang.Object clone()
          Create a clone of a state.
 java.util.Set coids()
           
 java.lang.String compactString()
          Return a compact identifier for the state, based on hashCode.
 java.util.Set contexts()
          Get the set of all copntexts enclosed in this state.
 void createContext(CoopnModuleName context)
          Creates a context.
 CoopnTerm createObject(CoopnObjectSymbol object, CoopnModuleName context)
          Create a new static object of a particular type, and place it into its context.
 CoopnTerm createObject(CoopnType type, CoopnModuleName context)
          Create a new object of a particular type, and place it into its context.
 boolean equals(java.lang.Object o)
          Equality method.
static CoopnGeneratorSymbol firstObjectIdentifierOf(CoopnType type)
          Get the public generator corresponding to a first OID for a particular type.
 int hashCode()
          Hashcode method.
 ScenarioElement interpret(CoopnSubstitution sigma)
          Interpretation of this element according to a substitution.
 java.util.Set loids()
           
static CoopnGeneratorSymbol nextObjectIdentifierOf(CoopnType type)
          Get the public generator corresponding to a next OID for a particular type.
 void removeObject(CoopnTerm oid)
           
 void setLoid(CoopnTerm loid)
          Set a loid.
 ContextState stateOf(CoopnModuleName context)
          Return the state of an enclosed context.
 java.lang.String toCompleteString(CoopnEnv env, int indent)
          String conversion method.
 java.lang.String toString(CoopnEnv env, int indent)
          String conversion method.
 
Methods inherited from class ConForM.CoopnTools.CoKer.ScenarioMgr.ScenarioElement
cloneScenarioElement, toCompleteString, toCompleteString, toCompleteString, toString, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TrueState

public TrueState(CoopnWorkspace spec)
Build a new empty state for a workspace (and therefore for a specification).
Method Detail

interpret

public ScenarioElement interpret(CoopnSubstitution sigma)
Interpretation of this element according to a substitution.
Overrides:
interpret in class ScenarioElement
Parameters:
sigma - the substitution; cannot be null
Returns:
a new ScenarioElement object, corresponding to the interpretation.

compactString

public java.lang.String compactString()
Return a compact identifier for the state, based on hashCode.
Overrides:
compactString in class State

equals

public boolean equals(java.lang.Object o)
Description copied from class: ScenarioElement
Equality method. Must be defined in the inherited classes.
Overrides:
equals in class ScenarioElement
Following copied from class: ConForM.CoopnTools.CoKer.ScenarioMgr.ScenarioElement
Parameters:
obj - the object to compare
Returns:
true iff this object and the parameter are equals.

hashCode

public int hashCode()
Description copied from class: ScenarioElement
Hashcode method. Must be defined in the inherited classes.
Overrides:
hashCode in class ScenarioElement
Following copied from class: ConForM.CoopnTools.CoKer.ScenarioMgr.ScenarioElement
Returns:
the hash code.

toString

public java.lang.String toString(CoopnEnv env,
                                 int indent)
Description copied from class: ScenarioElement
String conversion method. This routine converts an element into a string representing it, by transforming it using toText.
Overrides:
toString in class ScenarioElement
Following copied from class: ConForM.CoopnTools.CoKer.ScenarioMgr.ScenarioElement
Parameters:
env - the environment deciding the form of the display
indent - the identation factor
Returns:
a String image of the element.

toCompleteString

public java.lang.String toCompleteString(CoopnEnv env,
                                         int indent)
Description copied from interface: CoopnSyntacticElement
String conversion method. This routine converts an element into a string representing it. The string representation is intended to be as complete as possible, even if the resulting string is not more readable. The string representation is not required to include the comments associated to the element, if any.
Overrides:
toCompleteString in class ScenarioElement
Following copied from interface: ConForM.CoopnTools.CoKer.CoopnSyntacticElement
Parameters:
env - the environment deciding the form of the display. A null values indicates a default form.
indent - the identation factor. A zero value indicates no indentation at all.
Returns:
a String image of the element.

setLoid

public void setLoid(CoopnTerm loid)
Set a loid. This method updates directly the state and may be dangerous; standard manipulation of TrueStates should be done using methods createContext() and createObject() and so on.

addCoid

public void addCoid(CoopnTerm coid)
Add a coid. This method updates directly the state and may be dangerous; standard manipulation of TrueStates should be done using methods createContext() and createObject() and so on.

addContextState

public void addContextState(ContextState state)
Add a context state, with its objects. This method updates directly the state and may be dangerous; standard manipulation of TrueStates should be done using methods createContext() and createObject() and so on. THIS METHODS MUST BE CALLED ONLY AFTER THE FINISH OF THE CONTEXT STATE CREATION, or THE resulting state is INCONSISTENT.

createContext

public void createContext(CoopnModuleName context)
Creates a context.

firstObjectIdentifierOf

public static CoopnGeneratorSymbol firstObjectIdentifierOf(CoopnType type)
Get the public generator corresponding to a first OID for a particular type.

nextObjectIdentifierOf

public static CoopnGeneratorSymbol nextObjectIdentifierOf(CoopnType type)
Get the public generator corresponding to a next OID for a particular type.

createObject

public CoopnTerm createObject(CoopnType type,
                              CoopnModuleName context)
Create a new object of a particular type, and place it into its context.
Returns:
the oid of the created object

createObject

public CoopnTerm createObject(CoopnObjectSymbol object,
                              CoopnModuleName context)
Create a new static object of a particular type, and place it into its context.
Returns:
the oid of the created object

removeObject

public void removeObject(CoopnTerm oid)

cloid

public CoopnTerm cloid(CoopnType type)
Return the set of current last object odentifier of a type.
Parameters:
type - type type
Returns:
the current last object identifier, or null if no objects of this type exist.

loids

public java.util.Set loids()

stateOf

public ContextState stateOf(CoopnModuleName context)
Return the state of an enclosed context.
Parameters:
context - the name of the context
Returns:
the state, ot null if the context is not part of this context.

contexts

public java.util.Set contexts()
Get the set of all copntexts enclosed in this state.
Returns:
an unmodifiable set containing the enclosed contexts as CoopnModuleName.

coids

public java.util.Set coids()

actualObjectType

public CoopnType actualObjectType(CoopnTerm oid)
Get the actual type of an object, or null iff oid not konwn.

clone

public java.lang.Object clone()
Create a clone of a state.
Overrides:
clone in class ScenarioElement
Following copied from class: ConForM.CoopnTools.CoKer.ScenarioMgr.ScenarioElement
Returns:
a clone object.