ConForM.CoopnTools.CoKer.ScenarioMgr
Class Scenario

java.lang.Object
  |
  +--ConForM.CoopnTools.CoKer.ScenarioMgr.Scenario
All Implemented Interfaces:
AnonymousNameBridge, java.lang.Cloneable, CoopnSyntacticElement, CoopnSyntacticModule, java.io.Serializable

public class Scenario
extends java.lang.Object
implements CoopnSyntacticModule, java.io.Serializable, java.lang.Cloneable, AnonymousNameBridge

Scenario in the CO-OPN semantics. This class is not protected against external manipulations, i.e. methods are delivering the object stored in this class, instead of copies. In other words, modifications of the objects returned by this class are reflected inside the instances of this class ! This is for performance reasons. Tools implementaors are warned !!!

See Also:
Serialized Form

Constructor Summary
Scenario(java.lang.String name, CoopnCompilInfo compilInfo, java.lang.String comment)
          Build a new empty scenario.
 
Method Summary
 void addInitialState(State state)
          Add a initial state.
 void addStep(Step step)
          Add a step.
 java.lang.Object clone()
          Cloning method.
 java.lang.String comment()
          Comment retrieving method.
 CoopnCompilInfo compilInfo()
          Return the compilation information associated to this module.
 java.lang.String completeKind()
          Complete kind retrieving method.
 boolean contains(State state)
          Look if a state is included in the scenario.
 boolean contains(Step step)
          Look if a step is included in the scenario.
 void endAnonymousNameBridge()
          End an anonymous name bridge.
 boolean equals(java.lang.Object obj)
          Equality method.
 CoopnAnonymousName getAnonymousName(java.lang.Object key)
          Get the anonymous name corresponding to the key.
 java.lang.String getName(State state)
          Get the name of a state.
 java.lang.String getName(Step step)
          Get the name of a transition.
 int hashCode()
          Hashcode method.
 boolean hasParameters()
          Look if this module has parameters,i.e. additional information to the complete kind.
 boolean isInitial(State state)
          get a flag telling if a state is initial or not.
 boolean isTotallyExplored(State state)
          get a flag telling if a state is totally explored or not.
 java.lang.String kind()
          Kind retrieving method.
 int moduleKind()
          Get the module kind (in the sense of the package manager) of this module, for instance COOPNSOURCE, COALASOURCE, PACKAGE, and so on).
 java.lang.String moduleName()
          Get the name.
 java.lang.String name()
          Get the name.
 java.lang.String parameters()
          Parameters retrieving method.
 void removeState(State state)
          Remove a state.
 void removeStep(Step step)
          Remove a step.
 CoopnSyntacticSection[] sections()
          Get the sections of this module.
 void setComment(java.lang.String comment)
           
 void setInitial(State state, boolean initial)
          Set a state as initial.
 void setName(State state, java.lang.String name)
          Set the name of a state.
 void setName(Step step, java.lang.String name)
          Set the name of a transition.
 void setName(java.lang.String name)
          Set the name.
 void setTotallyExplored(State state, boolean totallyExplored)
          Set a state as totally explored or not.
 void startAnonymousNameBridge()
          Start an anonymous name bridge.
 java.util.Set states()
          Get the set of states.
 java.util.Set steps()
          Get the set of steps.
 java.lang.String toCompleteString()
          String conversion method.
 java.lang.String toCompleteString(CoopnEnv env)
          String conversion method.
 java.lang.String toCompleteString(CoopnEnv env, int indent)
          String conversion method.
 java.lang.String toString()
          String conversion method.
 java.lang.String toString(CoopnEnv env)
          String conversion method.
 java.lang.String toString(CoopnEnv env, int indent)
          String conversion method.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Scenario

public Scenario(java.lang.String name,
                CoopnCompilInfo compilInfo,
                java.lang.String comment)
Build a new empty scenario.
Parameters:
name - the name of the scenario
comment - the associated structured comments
Method Detail

name

public java.lang.String name()
Get the name.

setName

public void setName(java.lang.String name)
Set the name.

moduleName

public java.lang.String moduleName()
Get the name. Must be defined in the inherited classes.
Specified by:
moduleName in interface CoopnSyntacticModule
Returns:
a String representation of the module name. Never null.

moduleKind

public int moduleKind()
Get the module kind (in the sense of the package manager) of this module, for instance COOPNSOURCE, COALASOURCE, PACKAGE, and so on).
Specified by:
moduleKind in interface CoopnSyntacticModule
Returns:
the module kind.

compilInfo

public CoopnCompilInfo compilInfo()
Return the compilation information associated to this module.
Specified by:
compilInfo in interface CoopnSyntacticModule

kind

public java.lang.String kind()
Kind retrieving method. This method must be defined in the inherited classes for returning a string allowing the user to know what kind of module this is, for instance "Class", "Aspect", or "CAA".
Specified by:
kind in interface CoopnSyntacticModule
Returns:
a string defining the module kind.

completeKind

public java.lang.String completeKind()
Complete kind retrieving method. This method must be defined in the inherited classes for returning a string allowing the user to know what kind of module this is, including building information such as "generic" or "abstract".
Specified by:
completeKind in interface CoopnSyntacticModule
Returns:
a string defining the module complete kind.

hasParameters

public boolean hasParameters()
Look if this module has parameters,i.e. additional information to the complete kind.
Specified by:
hasParameters in interface CoopnSyntacticModule
Returns:
boolean iff this module has parameters.

parameters

public java.lang.String parameters()
Parameters retrieving method. Parameters are additional information to the complete kind.
Specified by:
parameters in interface CoopnSyntacticModule
Returns:
a string defining the paremeters, or null.

comment

public java.lang.String comment()
Comment retrieving method. This method must be defined in the inherited classes for returning the comment associated to this symbol.
Specified by:
comment in interface CoopnSyntacticModule
Returns:
a string defining the associated comment, or null iff no comment is associated to this symbol.

setComment

public void setComment(java.lang.String comment)

sections

public CoopnSyntacticSection[] sections()
Get the sections of this module.
Specified by:
sections in interface CoopnSyntacticModule
Returns:
The sections defined by this module.

states

public java.util.Set states()
Get the set of states.

steps

public java.util.Set steps()
Get the set of steps.

addInitialState

public void addInitialState(State state)
Add a initial state.
Parameters:
state - the state; cannot be null
Throws:
java.lang.IllegalArgumentException - the state is empty.

removeState

public void removeState(State state)
Remove a state.

contains

public boolean contains(State state)
Look if a state is included in the scenario.

addStep

public void addStep(Step step)
Add a step. The states of the step's transition are added to the set of states, if needed. The step is added to the set of steps, if needed.
Parameters:
step - the step; cannot be null
Throws:
java.lang.IllegalArgumentException - the step is empty.

removeStep

public void removeStep(Step step)
Remove a step. The states of the step's transition are not automatically removed.
Parameters:
step - the step; cannot be null
Throws:
java.lang.IllegalArgumentException - the step is empty.

contains

public boolean contains(Step step)
Look if a step is included in the scenario.

setName

public void setName(State state,
                    java.lang.String name)
Set the name of a state.
Parameters:
state - the state
name - the name; a null value or an empty string means no name empty name

getName

public java.lang.String getName(State state)
Get the name of a state.
Parameters:
state - the state
Returns:
the name, or null if the state has no name

setName

public void setName(Step step,
                    java.lang.String name)
Set the name of a transition.
Parameters:
transition - the transition
name - the name; a null value or an empty string means no name empty name

getName

public java.lang.String getName(Step step)
Get the name of a transition.
Parameters:
transition - the transition
Returns:
the name, or null if the transition has no name

isInitial

public boolean isInitial(State state)
get a flag telling if a state is initial or not.
Parameters:
state - the state
totallyExplored - true for totally explored, false else

setInitial

public void setInitial(State state,
                       boolean initial)
Set a state as initial.

setTotallyExplored

public void setTotallyExplored(State state,
                               boolean totallyExplored)
Set a state as totally explored or not.
Parameters:
state - the state
totallyExplored - true for totally explored, false else

isTotallyExplored

public boolean isTotallyExplored(State state)
get a flag telling if a state is totally explored or not.
Parameters:
state - the state
totallyExplored - true for totally explored, false else

startAnonymousNameBridge

public void startAnonymousNameBridge()
Start an anonymous name bridge. After a call to this method, the first call to getAnonymousName(key) will generate a new name, whatever the key is.
Specified by:
startAnonymousNameBridge in interface AnonymousNameBridge

endAnonymousNameBridge

public void endAnonymousNameBridge()
End an anonymous name bridge. Release the resources used by the current bridge, if any.
Specified by:
endAnonymousNameBridge in interface AnonymousNameBridge

getAnonymousName

public CoopnAnonymousName getAnonymousName(java.lang.Object key)
Get the anonymous name corresponding to the key. If the key has already been translated in this bridge, the associated name is returned; else a new name, unique to the scenario, is created and returned.
Specified by:
getAnonymousName in interface AnonymousNameBridge

equals

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

hashCode

public int hashCode()
Description copied from interface: CoopnSyntacticElement
Hashcode method. Must be defined in the inherited classes.
Specified by:
hashCode in interface CoopnSyntacticElement
Overrides:
hashCode in class java.lang.Object
Following copied from interface: ConForM.CoopnTools.CoKer.CoopnSyntacticElement
Returns:
the hash code.

toString

public java.lang.String toString(CoopnEnv env,
                                 int indent)
String conversion method. This routine converts an element into a string representing it. The string representation is intended to be readable from users. The string representation is not required to include the comments associated to the element, if any.
Specified by:
toString in interface 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.

toString

public java.lang.String toString(CoopnEnv env)
String conversion method. Use an identation of 0. This routine converts an element into a string representing it. The string representation is intended to be readable from users. The string representation is not required to include the comments associated to the element, if any.
Specified by:
toString in interface CoopnSyntacticElement
Parameters:
env - the environment deciding the form of the display
Returns:
a String image of the element.

toString

public java.lang.String toString()
String conversion method. Use no environment and an identation of 0. This routine converts an element into a string representing it. The string representation is intended to be readable from users. The string representation is not required to include the comments associated to the element, if any.
Specified by:
toString in interface CoopnSyntacticElement
Overrides:
toString in class java.lang.Object
Returns:
a String image of the element.

toCompleteString

public java.lang.String toCompleteString(CoopnEnv env,
                                         int indent)
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.
Specified by:
toCompleteString in interface 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.

toCompleteString

public java.lang.String toCompleteString(CoopnEnv env)
String conversion method. Use an identation of 0. 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.
Specified by:
toCompleteString in interface CoopnSyntacticElement
Parameters:
env - the environment deciding the form of the display
Returns:
a String image of the element.

toCompleteString

public java.lang.String toCompleteString()
String conversion method. Use no environment and an identation of 0. 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.
Specified by:
toCompleteString in interface CoopnSyntacticElement
Returns:
a String image of the element.

clone

public java.lang.Object clone()
Cloning method.
Specified by:
clone in interface CoopnSyntacticElement
Overrides:
clone in class java.lang.Object
Following copied from interface: ConForM.CoopnTools.CoKer.CoopnSyntacticElement
Returns:
a clone object.