ConForM.CoopnTools.CoKer.CoopnMgr
Class CoopnWorkspace

java.lang.Object
  |
  +--ConForM.CoopnTools.CoKer.CoopnMgr.CentralCoopnMgr.CoopnFrame
        |
        +--ConForM.CoopnTools.CoKer.CoopnMgr.CentralCoopnMgr.CoopnSituationFrame
              |
              +--ConForM.CoopnTools.CoKer.CoopnMgr.CentralCoopnMgr.CoopnWorkspaceFrame
                    |
                    +--ConForM.CoopnTools.CoKer.CoopnMgr.CoopnWorkspace
All Implemented Interfaces:
java.lang.Cloneable, CoopnModuleDependency, CoopnTypeRelation
Direct Known Subclasses:
CoopnSpec

public class CoopnWorkspace
extends ConForM.CoopnTools.CoKer.CoopnMgr.CentralCoopnMgr.CoopnWorkspaceFrame
implements CoopnModuleDependency, CoopnTypeRelation

Coopn workspace. A coopn workspace is used to interpret co-opn source text. It gives a CoopnFrame. The workspace is described as a situation outside a list of modules, and a set of additional meta-elements. Workspace's signatures are re-evaluated and re-checked when explicitely requested, for performance reasons. This process is performed each time the method build() is called.


Field Summary
protected  CoopnMgr coopnMgr
           
 
Fields inherited from class ConForM.CoopnTools.CoKer.CoopnMgr.CentralCoopnMgr.CoopnWorkspaceFrame
badArityText, badTypeText, msgArgs, msgFmt, name, packageText, resources, statSemErrText, workspaceModuleName
 
Fields inherited from class ConForM.CoopnTools.CoKer.CoopnMgr.CentralCoopnMgr.CoopnSituationFrame
centralMgr, env, mgr, modules
 
Constructor Summary
CoopnWorkspace(java.lang.String name, CoopnMgr mgr, CoopnEnv env)
          Creates a new workspace, based on the situation external to every modules in the environment.
CoopnWorkspace(java.lang.String name, java.lang.String[] modules, CoopnMgr mgr, CoopnEnv env)
          Creates a new workspace, based on the situation external to a list of modules.
 
Method Summary
 void addClassCreationSymbolVariable(java.lang.String name, java.lang.String originType, java.lang.String type)
          Add a class creation symbol variable.
 void addClassDestructionSymbolVariable(java.lang.String name, java.lang.String originType, java.lang.String type)
          Add a class destruction symbol variable.
 void addClassGateSymbolVariable(java.lang.String name, java.lang.String originType, java.lang.String type)
          Add a class gate symbol variable.
 void addClassMethodSymbolVariable(java.lang.String name, java.lang.String originType, java.lang.String type)
          Add a class method symbol variable.
 void addContextGateSymbolVariable(java.lang.String name, java.lang.String type)
          Add a context gate symbol variable.
 void addContextMethodSymbolVariable(java.lang.String name, java.lang.String type)
          Add a context method symbol variable.
 void addGeneratorSymbolVariable(java.lang.String name, java.lang.String domain, java.lang.String codomain)
          Add a generator symbol variable.
 void addObjectSymbolVariable(java.lang.String name, java.lang.String type)
          Add an object symbol variable.
 void addOperationSymbolVariable(java.lang.String name, java.lang.String domain, java.lang.String codomain)
          Add an operation symbol variable.
 void addSortSymbolVariable(java.lang.String name)
          Add a sort symbol variable.
 void addTermVariable(java.lang.String name, java.lang.String type)
          Add a term variable.
 void addTypeSymbolVariable(java.lang.String name)
          Add a type symbol variable.
 void build()
          Checks and build the workspace.
 void clearVariables()
          Clear all variables.
 java.lang.Object clone()
           
 CoopnMgr coopnMgr()
          Return the coopn manager associated to this specification.
 java.lang.String[] dependencies()
          Module dependency.
 boolean equ(CoopnTypeAgg left, CoopnTypeAgg right)
          Equivalence between two lists of types.
 boolean equ(CoopnType left, CoopnType right)
          Equivalence between two types.
 boolean equals(java.lang.Object obj)
           
 java.lang.String[] getDependencies()
          Get the dependencies of the specification.
 boolean less(CoopnTypeAgg sub, CoopnTypeAgg sup)
          Order between two lists of types.
 boolean less(CoopnType sub, CoopnType sup)
          Order between two types.
 boolean lessOrEqu(CoopnTypeAgg sub, CoopnTypeAgg sup)
          Order between two lists of types.
 boolean lessOrEqu(CoopnType sub, CoopnType sup)
          Order between two types.
 java.lang.String[] modules()
          Return the modules of the workspace.
 java.lang.String name()
          Return the name of the workspace.
 CoopnObjectSymbol[] objects()
           
 void reBuild()
          Re-build the workspace.
 CoopnSortSymbol[] sorts()
           
 java.lang.String toString()
           
 CoopnTypeSymbol[] types()
           
 boolean unifiable(CoopnTypeAgg left, CoopnTypeAgg right)
          Compatibility for unification between two lists of types.
 boolean unifiable(CoopnType left, CoopnType right)
          Compatibility for unification between two types.
 
Methods inherited from class ConForM.CoopnTools.CoKer.CoopnMgr.CentralCoopnMgr.CoopnWorkspaceFrame
buildTexts, computeSignature, reComputeSignature, statSemError, stringFormat, stringFormat
 
Methods inherited from class ConForM.CoopnTools.CoKer.CoopnMgr.CentralCoopnMgr.CoopnSituationFrame
cloneCoopnSituationFrame, coreToString, hashCode
 
Methods inherited from class ConForM.CoopnTools.CoKer.CoopnMgr.CentralCoopnMgr.CoopnFrame
cloneCoopnFrame
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

coopnMgr

protected CoopnMgr coopnMgr
Constructor Detail

CoopnWorkspace

public CoopnWorkspace(java.lang.String name,
                      CoopnMgr mgr,
                      CoopnEnv env)
Creates a new workspace, based on the situation external to every modules in the environment.
Parameters:
name - the name of the workspace
mgr - the coopn manager to use
env - the environment
Throws:
java.lang.IllegalArgumentException - one of the argument is not correct.

CoopnWorkspace

public CoopnWorkspace(java.lang.String name,
                      java.lang.String[] modules,
                      CoopnMgr mgr,
                      CoopnEnv env)
Creates a new workspace, based on the situation external to a list of modules.
Parameters:
name - the name of the workspace
modules - the list of modules
mgr - the coopn manager to use
env - the environment
Throws:
java.lang.IllegalArgumentException - one of the argument is not correct.
Method Detail

name

public java.lang.String name()
Return the name of the workspace.

getDependencies

public java.lang.String[] getDependencies()
                                   throws java.lang.IllegalArgumentException
Get the dependencies of the specification. An up-to-date version of the module is found, and its dependencies are returned. In other words, this methods returns the list of all coopn modules necessitated to "execute" this spec.
Returns:
an array of strings containing all dependencies.
Throws:
java.lang.IllegalArgumentException - the result cannot be delivered (because it is not found, erroneous, and so on).

coopnMgr

public CoopnMgr coopnMgr()
Return the coopn manager associated to this specification.

modules

public java.lang.String[] modules()
Return the modules of the workspace.

sorts

public CoopnSortSymbol[] sorts()
Overrides:
sorts in class ConForM.CoopnTools.CoKer.CoopnMgr.CentralCoopnMgr.CoopnSituationFrame

types

public CoopnTypeSymbol[] types()
Overrides:
types in class ConForM.CoopnTools.CoKer.CoopnMgr.CentralCoopnMgr.CoopnSituationFrame

objects

public CoopnObjectSymbol[] objects()
Overrides:
objects in class ConForM.CoopnTools.CoKer.CoopnMgr.CentralCoopnMgr.CoopnSituationFrame

dependencies

public java.lang.String[] dependencies()
Description copied from interface: CoopnModuleDependency
Module dependency.
Specified by:
dependencies in interface CoopnModuleDependency
Overrides:
dependencies in class ConForM.CoopnTools.CoKer.CoopnMgr.CentralCoopnMgr.CoopnSituationFrame
Following copied from interface: ConForM.CoopnTools.CoKer.CoopnMgr.CoopnModuleDependency
Returns:
an array of strings containing names of modules.

equ

public boolean equ(CoopnTypeAgg left,
                   CoopnTypeAgg right)
Description copied from interface: CoopnTypeRelation
Equivalence between two lists of types.
Specified by:
equ in interface CoopnTypeRelation
Overrides:
equ in class ConForM.CoopnTools.CoKer.CoopnMgr.CentralCoopnMgr.CoopnSituationFrame
Following copied from interface: ConForM.CoopnTools.CoKer.CoopnMgr.CoopnTypeRelation
Parameters:
left - the first list of types
right - the second list of types
Returns:
true iff both lists of types are equivalents with regard to the type relation represented by this object.

equ

public boolean equ(CoopnType left,
                   CoopnType right)
Description copied from interface: CoopnTypeRelation
Equivalence between two types.
Specified by:
equ in interface CoopnTypeRelation
Overrides:
equ in class ConForM.CoopnTools.CoKer.CoopnMgr.CentralCoopnMgr.CoopnSituationFrame
Following copied from interface: ConForM.CoopnTools.CoKer.CoopnMgr.CoopnTypeRelation
Parameters:
left - the first type
right - the second type
Returns:
true iff both types are equivalents with regard to the type relation represented by this object.

less

public boolean less(CoopnTypeAgg sub,
                    CoopnTypeAgg sup)
Description copied from interface: CoopnTypeRelation
Order between two lists of types.
Specified by:
less in interface CoopnTypeRelation
Overrides:
less in class ConForM.CoopnTools.CoKer.CoopnMgr.CentralCoopnMgr.CoopnSituationFrame
Following copied from interface: ConForM.CoopnTools.CoKer.CoopnMgr.CoopnTypeRelation
Parameters:
sub - the first list of types
sup - the second list of types
Returns:
true iff sub is less or equal to sup AND at least one element of sub is strictly less than the same element of sup.

less

public boolean less(CoopnType sub,
                    CoopnType sup)
Description copied from interface: CoopnTypeRelation
Order between two types.
Specified by:
less in interface CoopnTypeRelation
Overrides:
less in class ConForM.CoopnTools.CoKer.CoopnMgr.CentralCoopnMgr.CoopnSituationFrame
Following copied from interface: ConForM.CoopnTools.CoKer.CoopnMgr.CoopnTypeRelation
Parameters:
sub - the first type
sup - the second type
Returns:
true iff sub is a strict sub-sort or a sub-type of sup.

lessOrEqu

public boolean lessOrEqu(CoopnTypeAgg sub,
                         CoopnTypeAgg sup)
Description copied from interface: CoopnTypeRelation
Order between two lists of types.
Specified by:
lessOrEqu in interface CoopnTypeRelation
Overrides:
lessOrEqu in class ConForM.CoopnTools.CoKer.CoopnMgr.CentralCoopnMgr.CoopnSituationFrame
Following copied from interface: ConForM.CoopnTools.CoKer.CoopnMgr.CoopnTypeRelation
Parameters:
sub - the first list of types
sup - the second list of types
Returns:
true iff every element of sub is a sub-sort or a sub-type of the same (indexed) element sup.

lessOrEqu

public boolean lessOrEqu(CoopnType sub,
                         CoopnType sup)
Description copied from interface: CoopnTypeRelation
Order between two types.
Specified by:
lessOrEqu in interface CoopnTypeRelation
Overrides:
lessOrEqu in class ConForM.CoopnTools.CoKer.CoopnMgr.CentralCoopnMgr.CoopnSituationFrame
Following copied from interface: ConForM.CoopnTools.CoKer.CoopnMgr.CoopnTypeRelation
Parameters:
sub - the first type
sup - the second type
Returns:
true iff sub is a sub-sort or a sub-type of sup.

unifiable

public boolean unifiable(CoopnTypeAgg left,
                         CoopnTypeAgg right)
Description copied from interface: CoopnTypeRelation
Compatibility for unification between two lists of types.
Specified by:
unifiable in interface CoopnTypeRelation
Overrides:
unifiable in class ConForM.CoopnTools.CoKer.CoopnMgr.CentralCoopnMgr.CoopnSituationFrame
Following copied from interface: ConForM.CoopnTools.CoKer.CoopnMgr.CoopnTypeRelation
Parameters:
left - the first list of types
right - the second list of types
Returns:
true iff both types of every (indexed) element are compatibles with regard to the type relation represented by this object.

unifiable

public boolean unifiable(CoopnType left,
                         CoopnType right)
Description copied from interface: CoopnTypeRelation
Compatibility for unification between two types.
Specified by:
unifiable in interface CoopnTypeRelation
Overrides:
unifiable in class ConForM.CoopnTools.CoKer.CoopnMgr.CentralCoopnMgr.CoopnSituationFrame
Following copied from interface: ConForM.CoopnTools.CoKer.CoopnMgr.CoopnTypeRelation
Parameters:
left - the first type
right - the second type
Returns:
true iff both types are compatibles with regard to the type relation represented by this object.

clearVariables

public void clearVariables()
Clear all variables. Each variable in the current workspace is cleared.
Overrides:
clearVariables in class ConForM.CoopnTools.CoKer.CoopnMgr.CentralCoopnMgr.CoopnWorkspaceFrame

addTermVariable

public void addTermVariable(java.lang.String name,
                            java.lang.String type)
Add a term variable.
Overrides:
addTermVariable in class ConForM.CoopnTools.CoKer.CoopnMgr.CentralCoopnMgr.CoopnWorkspaceFrame
Parameters:
name - the name of the variable
type - the type of the variable
Throws:
java.lang.IllegalArgumentException - one of the parameter is such that the variable cannot be syntactically constructed.

addSortSymbolVariable

public void addSortSymbolVariable(java.lang.String name)
Add a sort symbol variable.
Overrides:
addSortSymbolVariable in class ConForM.CoopnTools.CoKer.CoopnMgr.CentralCoopnMgr.CoopnWorkspaceFrame
Parameters:
name - the name of the variable
Throws:
java.lang.IllegalArgumentException - one of the parameter is such that the variable cannot be syntactically constructed.

addTypeSymbolVariable

public void addTypeSymbolVariable(java.lang.String name)
Add a type symbol variable.
Overrides:
addTypeSymbolVariable in class ConForM.CoopnTools.CoKer.CoopnMgr.CentralCoopnMgr.CoopnWorkspaceFrame
Parameters:
name - the name of the variable
Throws:
java.lang.IllegalArgumentException - one of the parameter is such that the variable cannot be syntactically constructed.

addGeneratorSymbolVariable

public void addGeneratorSymbolVariable(java.lang.String name,
                                       java.lang.String domain,
                                       java.lang.String codomain)
Add a generator symbol variable.
Overrides:
addGeneratorSymbolVariable in class ConForM.CoopnTools.CoKer.CoopnMgr.CentralCoopnMgr.CoopnWorkspaceFrame
Parameters:
name - the name of the variable
domain - the domain of the variable
codomain - the codomain of the variable
Throws:
java.lang.IllegalArgumentException - one of the parameter is such that the variable cannot be syntactically constructed.

addOperationSymbolVariable

public void addOperationSymbolVariable(java.lang.String name,
                                       java.lang.String domain,
                                       java.lang.String codomain)
Add an operation symbol variable.
Overrides:
addOperationSymbolVariable in class ConForM.CoopnTools.CoKer.CoopnMgr.CentralCoopnMgr.CoopnWorkspaceFrame
Parameters:
name - the name of the variable
domain - the domain of the variable
codomain - the codomain of the variable
Throws:
java.lang.IllegalArgumentException - one of the parameter is such that the variable cannot be syntactically constructed.

addObjectSymbolVariable

public void addObjectSymbolVariable(java.lang.String name,
                                    java.lang.String type)
Add an object symbol variable.
Overrides:
addObjectSymbolVariable in class ConForM.CoopnTools.CoKer.CoopnMgr.CentralCoopnMgr.CoopnWorkspaceFrame
Parameters:
name - the name of the variable
type - the type of the variable
Throws:
java.lang.IllegalArgumentException - one of the parameter is such that the variable cannot be syntactically constructed.

addClassGateSymbolVariable

public void addClassGateSymbolVariable(java.lang.String name,
                                       java.lang.String originType,
                                       java.lang.String type)
Add a class gate symbol variable.
Overrides:
addClassGateSymbolVariable in class ConForM.CoopnTools.CoKer.CoopnMgr.CentralCoopnMgr.CoopnWorkspaceFrame
Parameters:
name - the name of the variable
domain - the domain of the variable
codomain - the codomain of the variable
Throws:
java.lang.IllegalArgumentException - one of the parameter is such that the variable cannot be syntactically constructed.

addClassMethodSymbolVariable

public void addClassMethodSymbolVariable(java.lang.String name,
                                         java.lang.String originType,
                                         java.lang.String type)
Add a class method symbol variable.
Overrides:
addClassMethodSymbolVariable in class ConForM.CoopnTools.CoKer.CoopnMgr.CentralCoopnMgr.CoopnWorkspaceFrame
Parameters:
name - the name of the variable
domain - the domain of the variable
codomain - the codomain of the variable
Throws:
java.lang.IllegalArgumentException - one of the parameter is such that the variable cannot be syntactically constructed.

addClassCreationSymbolVariable

public void addClassCreationSymbolVariable(java.lang.String name,
                                           java.lang.String originType,
                                           java.lang.String type)
Add a class creation symbol variable.
Overrides:
addClassCreationSymbolVariable in class ConForM.CoopnTools.CoKer.CoopnMgr.CentralCoopnMgr.CoopnWorkspaceFrame
Parameters:
name - the name of the variable
domain - the domain of the variable
codomain - the codomain of the variable
Throws:
java.lang.IllegalArgumentException - one of the parameter is such that the variable cannot be syntactically constructed.

addClassDestructionSymbolVariable

public void addClassDestructionSymbolVariable(java.lang.String name,
                                              java.lang.String originType,
                                              java.lang.String type)
Add a class destruction symbol variable.
Overrides:
addClassDestructionSymbolVariable in class ConForM.CoopnTools.CoKer.CoopnMgr.CentralCoopnMgr.CoopnWorkspaceFrame
Parameters:
name - the name of the variable
domain - the domain of the variable
codomain - the codomain of the variable
Throws:
java.lang.IllegalArgumentException - one of the parameter is such that the variable cannot be syntactically constructed.

addContextGateSymbolVariable

public void addContextGateSymbolVariable(java.lang.String name,
                                         java.lang.String type)
Add a context gate symbol variable.
Overrides:
addContextGateSymbolVariable in class ConForM.CoopnTools.CoKer.CoopnMgr.CentralCoopnMgr.CoopnWorkspaceFrame
Parameters:
name - the name of the variable
type - the type of the variable
Throws:
java.lang.IllegalArgumentException - one of the parameter is such that the variable cannot be syntactically constructed.

addContextMethodSymbolVariable

public void addContextMethodSymbolVariable(java.lang.String name,
                                           java.lang.String type)
Add a context method symbol variable.
Overrides:
addContextMethodSymbolVariable in class ConForM.CoopnTools.CoKer.CoopnMgr.CentralCoopnMgr.CoopnWorkspaceFrame
Parameters:
name - the name of the variable
type - the type of the variable
Throws:
java.lang.IllegalArgumentException - one of the parameter is such that the variable cannot be syntactically constructed.

build

public void build()
           throws java.lang.IllegalArgumentException
Checks and build the workspace. The workspace is cheked for its static semantics, and if correct, the signature of the workspace is computed, and the workspace become available to play its role.
Throws:
java.lang.IllegalArgumentException - the workspace is not correct (i.e. some modules are not found or erroneous, meta-elements are badly typed, and so on.

reBuild

public void reBuild()
             throws java.lang.IllegalArgumentException
Re-build the workspace. The part of the workspace dealing with variables is checked for its static semantics, and if correct, the signature of this part is computed and added to the signature of the core-part of the workspace as previously computed by a call to the method build(). The core-part of the workspace is defined as the part dealing with the CO-OPN source modules.
Throws:
java.lang.IllegalArgumentException - the workspace is not correct (i.e. some modules are not found or erroneous, meta-elements are badly typed, and so on.

toString

public java.lang.String toString()
Overrides:
toString in class ConForM.CoopnTools.CoKer.CoopnMgr.CentralCoopnMgr.CoopnSituationFrame

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class ConForM.CoopnTools.CoKer.CoopnMgr.CentralCoopnMgr.CoopnWorkspaceFrame

clone

public java.lang.Object clone()
Overrides:
clone in class ConForM.CoopnTools.CoKer.CoopnMgr.CentralCoopnMgr.CoopnWorkspaceFrame