ConForM.CoopnTools.CoKer.ConstraintsMgr
Class ConstraintsMgr

java.lang.Object
  |
  +--ConForM.CoopnTools.CoKer.ConstraintsMgr.ConstraintsMgr
All Implemented Interfaces:
SpecModuleObserver

public class ConstraintsMgr
extends java.lang.Object
implements SpecModuleObserver

Constraints Manager. This class essentially defines the services provided by the constraints manager.


Field Summary
static java.lang.String VERSION
          constraints Manager version;
 
Constructor Summary
ConstraintsMgr(CoopnSpec spec, PackageMgr packageMgr, CoopnEnv env)
          Constructor.
 
Method Summary
 void addAxiom(java.lang.String consName, ConstraintsAxiomSymbol symbol)
          Add a axiom symbol.
 void addBodyConstraint(java.lang.String consName, ConstraintsConsSymbol symbol)
          Add a body constraints symbol to a constraint set.
 void addInterfaceConstraint(java.lang.String consName, ConstraintsConsSymbol symbol)
          Add an interface constraint symbol to the constraints set.
 void addVariable(java.lang.String consName, ConstraintsVariableSymbol symbol)
          Add a variable symbol.
 void buildConstraintSet(java.lang.String name)
           
 ConForM.CoopnTools.CoKer.ConstraintsMgr.CentralConstraintsMgr.CentralConstraintsMgr centralMgr()
          Get the associated coopn manager.
 java.lang.String consName()
           
 void createConstraintSet(java.lang.String consName, java.lang.String comment)
          Creates a constraints module.
 java.lang.String displayAssignation(java.lang.String elem)
          Comment to String conversion.
 java.lang.String displayAtom(java.lang.String elem)
          Comment to String conversion.
 java.lang.String displayComment(java.lang.String elem)
          Comment to String conversion.
 java.lang.String displayCondition(java.lang.String elem)
          Comment to String conversion.
 java.lang.String displayExpression(java.lang.String elem)
          Comment to String conversion.
 java.lang.String displayModuleName(java.lang.String elem)
          ModuleName to String conversion.
 java.lang.String displayName(java.lang.String elem)
          Name to String conversion.
 void dispose()
          Leave a package manager.
 ConstraintsAssignation evalAssignation(java.lang.String string, CoopnEnv env)
          String to comment conversion.
 ConstraintsAtom evalAtom(java.lang.String string, CoopnEnv env)
          String to comment conversion.
 java.lang.String evalComment(java.lang.String string)
          String to comment conversion.
 ConstraintsCondition evalCondition(java.lang.String string, CoopnEnv env)
          String to comment conversion.
 ConstraintsExpression evalExpression(java.lang.String string, CoopnEnv env)
          String to comment conversion.
 java.lang.String evalModuleName(java.lang.String string)
          String to ModuleName conversion.
 java.lang.String evalName(java.lang.String string)
          String to Name conversion.
 ConstraintsModule getAndObserveModule(java.lang.String consName, ConstraintsModuleObserver observer)
          Get a constraint module and register a specification module observer.
 ConstraintSet getConstraintSet()
           
 ConstraintsModule getModule(java.lang.String consName)
          Get a constraint module.
 CoopnUser lockModule(java.lang.String consName, CoopnUser user)
          Lock a constraints module.
 void modifyComment(java.lang.String consName, java.lang.String comment)
          Change the comment of a constraint set.
 void notifySpecModuleChanged(java.lang.String specName, SpecModule module)
          Notification routine.
 PackageMgr packageMgr()
          Get the associated package manager.
 void reloadModule(java.lang.String consName)
          Reload a constraint module from the disk.
 void removeAxiom(java.lang.String consName, ConstraintsAxiomSymbol symbol)
          Remove a axiom symbol.
 void removeBodyConstraint(java.lang.String consName, ConstraintsConsSymbol symbol)
          Remove a body constraints symbol from the constraint set.
 void removeInterfaceConstraint(java.lang.String consName, ConstraintsConsSymbol symbol)
          Remove an interface constraint symbol from the constraints set.
 void removeVariable(java.lang.String consName, ConstraintsVariableSymbol symbol)
          Remove a variable symbol.
 void setModuleName(java.lang.String name)
           
 CoopnSpec spec()
          Get the associated spec .
 SpecMgr specMgr()
          Get the associated spec manager.
 void syncConsModule(java.lang.String consName)
          Sync a constraint module.
 void unlockConsModule(java.lang.String consName)
          Unlock a constraints module.
 void unregisterObserver(java.lang.String consName, ConstraintsModuleObserver observer)
          unregister a constraint module observer.
 void updateDatabase(java.lang.String name, ConstraintsModule module)
          Updates the database after modifying a file
 void use()
          Uses an aspect manager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERSION

public static final java.lang.String VERSION
constraints Manager version;
Constructor Detail

ConstraintsMgr

public ConstraintsMgr(CoopnSpec spec,
                      PackageMgr packageMgr,
                      CoopnEnv env)
               throws java.lang.IllegalArgumentException
Constructor. Build and use a new specification manager.
Parameters:
packageMgr - the associated package manager
env - the environment of the spec manager
Throws:
java.lang.IllegalArgumentException - the environment is absent or inconsistent.
Method Detail

packageMgr

public PackageMgr packageMgr()
Get the associated package manager.

specMgr

public SpecMgr specMgr()
Get the associated spec manager.

spec

public CoopnSpec spec()
Get the associated spec .

use

public void use()
Uses an aspect manager.

dispose

public void dispose()
Leave a package manager. This method release the resources used by this manager, if it is not used any more.

consName

public java.lang.String consName()

setModuleName

public void setModuleName(java.lang.String name)

centralMgr

public ConForM.CoopnTools.CoKer.ConstraintsMgr.CentralConstraintsMgr.CentralConstraintsMgr centralMgr()
Get the associated coopn manager.

getModule

public ConstraintsModule getModule(java.lang.String consName)
Get a constraint module. Return the desired constraint module.
Parameters:
consName - the constraint set name
Returns:
an unmodifiable instance of the constraint module, or null if the module is not found or erroneous.
Throws:
java.lang.IllegalArgumentException - problem with the environment.

getConstraintSet

public ConstraintSet getConstraintSet()

buildConstraintSet

public void buildConstraintSet(java.lang.String name)

getAndObserveModule

public ConstraintsModule getAndObserveModule(java.lang.String consName,
                                             ConstraintsModuleObserver observer)
                                      throws java.lang.IllegalArgumentException
Get a constraint module and register a specification module observer. Return the desired spec module.
Parameters:
consName - the constraint set name
observer - the cons module observer
Returns:
an unmodifiable instance of the constraint module, or null if the module is not found or erroneous.
Throws:
java.lang.IllegalArgumentException - problem with the environment.

unregisterObserver

public void unregisterObserver(java.lang.String consName,
                               ConstraintsModuleObserver observer)
unregister a constraint module observer.
Parameters:
consName - the constraint set name
observer - the constraint module observer
Throws:
java.lang.IllegalArgumentException - A problem occured with the environment.

lockModule

public CoopnUser lockModule(java.lang.String consName,
                            CoopnUser user)
Lock a constraints module. Only one lock may exist on a constraint module at the same time. Only locked modules may be modified.
Parameters:
consName - the constraint set to lock
user - the user who want to acquire the lock
Returns:
null iff this operation succeeded, i.e. if the lock is granted; the user which already has the lock else.
Throws:
java.lang.IllegalArgumentException - an argument is illegal

unlockConsModule

public void unlockConsModule(java.lang.String consName)
Unlock a constraints module. If the module was locked, it is stored on disk (if needed). Else, nothing happens...

syncConsModule

public void syncConsModule(java.lang.String consName)
Sync a constraint module. If the module was locked, it is stored on disk (if needed). Else, nothing happens...

updateDatabase

public void updateDatabase(java.lang.String name,
                           ConstraintsModule module)
                    throws java.lang.IllegalAccessException
Updates the database after modifying a file

createConstraintSet

public void createConstraintSet(java.lang.String consName,
                                java.lang.String comment)
                         throws java.lang.IllegalAccessException
Creates a constraints module.
Parameters:
consName - the constraint set name
comment - the associated comment; may be null
Throws:
java.lang.IllegalArgumentException - problem with arguments.
java.lang.IllegalAccessException - the package is not locked.

reloadModule

public void reloadModule(java.lang.String consName)
                  throws java.lang.IllegalAccessException
Reload a constraint module from the disk.
Parameters:
consName - the constraint set name
Throws:
java.lang.IllegalArgumentException - the constraint is not found.
java.lang.IllegalAccessException - the constraint is not locked.

modifyComment

public void modifyComment(java.lang.String consName,
                          java.lang.String comment)
                   throws java.lang.IllegalAccessException
Change the comment of a constraint set.
Parameters:
consName - the constraint set name
comment - the new comment, or null of no comment
Throws:
java.lang.IllegalArgumentException - the constraint is not found.
java.lang.IllegalAccessException - the constraint is not locked.

addInterfaceConstraint

public void addInterfaceConstraint(java.lang.String consName,
                                   ConstraintsConsSymbol symbol)
                            throws java.lang.IllegalAccessException
Add an interface constraint symbol to the constraints set.
Parameters:
consName - the constraint set name
symbol - the source module symbol
Throws:
java.lang.IllegalArgumentException - the constraint is not found.
java.lang.IllegalAccessException - the constraint is not locked.

removeInterfaceConstraint

public void removeInterfaceConstraint(java.lang.String consName,
                                      ConstraintsConsSymbol symbol)
                               throws java.lang.IllegalAccessException
Remove an interface constraint symbol from the constraints set.
Parameters:
consName - the constraint set name
symbol - the source module symbol
Throws:
java.lang.IllegalArgumentException - the constraint is not found.
java.lang.IllegalAccessException - the constraint is not locked.

addBodyConstraint

public void addBodyConstraint(java.lang.String consName,
                              ConstraintsConsSymbol symbol)
                       throws java.lang.IllegalAccessException
Add a body constraints symbol to a constraint set.
Parameters:
consName - the constraint set name
symbol - the source module symbol
Throws:
java.lang.IllegalArgumentException - the constraint is not found.
java.lang.IllegalAccessException - the constraint is not locked.

removeBodyConstraint

public void removeBodyConstraint(java.lang.String consName,
                                 ConstraintsConsSymbol symbol)
                          throws java.lang.IllegalAccessException
Remove a body constraints symbol from the constraint set.
Parameters:
consName - the constraint set name
symbol - the source module symbol
Throws:
java.lang.IllegalArgumentException - the constraint is not found.
java.lang.IllegalAccessException - the constraint is not locked.

addAxiom

public void addAxiom(java.lang.String consName,
                     ConstraintsAxiomSymbol symbol)
              throws java.lang.IllegalAccessException
Add a axiom symbol.
Parameters:
consName - the cons name
symbol - the source module symbol
Throws:
java.lang.IllegalArgumentException - the constraint is not found.
java.lang.IllegalAccessException - the constraint is not locked.

removeAxiom

public void removeAxiom(java.lang.String consName,
                        ConstraintsAxiomSymbol symbol)
                 throws java.lang.IllegalAccessException
Remove a axiom symbol.
Parameters:
consName - the cons name
symbol - the source module symbol
Throws:
java.lang.IllegalArgumentException - the constraint is not found.
java.lang.IllegalAccessException - the constraint is not locked.

addVariable

public void addVariable(java.lang.String consName,
                        ConstraintsVariableSymbol symbol)
                 throws java.lang.IllegalAccessException
Add a variable symbol.
Parameters:
consName - the cons name
symbol - the source module symbol
Throws:
java.lang.IllegalArgumentException - the constraint is not found.
java.lang.IllegalAccessException - the constraint is not locked.

removeVariable

public void removeVariable(java.lang.String consName,
                           ConstraintsVariableSymbol symbol)
                    throws java.lang.IllegalAccessException
Remove a variable symbol.
Parameters:
consName - the cons name
symbol - the source module symbol
Throws:
java.lang.IllegalArgumentException - the constraint is not found.
java.lang.IllegalAccessException - the constraint is not locked.

evalComment

public java.lang.String evalComment(java.lang.String string)
                             throws java.lang.IllegalArgumentException
String to comment conversion. Evaluates a string into a valid spec comment.
Parameters:
string - the string to evaluates; may be null
Returns:
the desired package comment.
Throws:
java.lang.IllegalArgumentException - the element cannot be delivered (because it is erroneous, and so on).

displayComment

public java.lang.String displayComment(java.lang.String elem)
                                throws java.lang.IllegalArgumentException
Comment to String conversion. Display a comment into a string representing it.
Parameters:
elem - the element to display; may be null
Returns:
the desired string.
Throws:
java.lang.IllegalArgumentException - the string cannot be delivered (because it is erroneous, and so on).

evalCondition

public ConstraintsCondition evalCondition(java.lang.String string,
                                          CoopnEnv env)
                                   throws java.lang.IllegalArgumentException
String to comment conversion. Evaluates a string into a valid spec comment.
Parameters:
string - the string to evaluates; may be null
Returns:
the desired package comment.
Throws:
java.lang.IllegalArgumentException - the element cannot be delivered (because it is erroneous, and so on).

displayCondition

public java.lang.String displayCondition(java.lang.String elem)
                                  throws java.lang.IllegalArgumentException
Comment to String conversion. Display a comment into a string representing it.
Parameters:
elem - the element to display; may be null
Returns:
the desired string.
Throws:
java.lang.IllegalArgumentException - the string cannot be delivered (because it is erroneous, and so on).

evalAtom

public ConstraintsAtom evalAtom(java.lang.String string,
                                CoopnEnv env)
                         throws java.lang.IllegalArgumentException
String to comment conversion. Evaluates a string into a valid spec comment.
Parameters:
string - the string to evaluates; may be null
Returns:
the desired package comment.
Throws:
java.lang.IllegalArgumentException - the element cannot be delivered (because it is erroneous, and so on).

displayAtom

public java.lang.String displayAtom(java.lang.String elem)
                             throws java.lang.IllegalArgumentException
Comment to String conversion. Display a comment into a string representing it.
Parameters:
elem - the element to display; may be null
Returns:
the desired string.
Throws:
java.lang.IllegalArgumentException - the string cannot be delivered (because it is erroneous, and so on).

evalExpression

public ConstraintsExpression evalExpression(java.lang.String string,
                                            CoopnEnv env)
                                     throws java.lang.IllegalArgumentException
String to comment conversion. Evaluates a string into a valid spec comment.
Parameters:
string - the string to evaluates; may be null
Returns:
the desired package comment.
Throws:
java.lang.IllegalArgumentException - the element cannot be delivered (because it is erroneous, and so on).

displayExpression

public java.lang.String displayExpression(java.lang.String elem)
                                   throws java.lang.IllegalArgumentException
Comment to String conversion. Display a comment into a string representing it.
Parameters:
elem - the element to display; may be null
Returns:
the desired string.
Throws:
java.lang.IllegalArgumentException - the string cannot be delivered (because it is erroneous, and so on).

evalAssignation

public ConstraintsAssignation evalAssignation(java.lang.String string,
                                              CoopnEnv env)
                                       throws java.lang.IllegalArgumentException
String to comment conversion. Evaluates a string into a valid spec comment.
Parameters:
string - the string to evaluates; may be null
Returns:
the desired package comment.
Throws:
java.lang.IllegalArgumentException - the element cannot be delivered (because it is erroneous, and so on).

displayAssignation

public java.lang.String displayAssignation(java.lang.String elem)
                                    throws java.lang.IllegalArgumentException
Comment to String conversion. Display a comment into a string representing it.
Parameters:
elem - the element to display; may be null
Returns:
the desired string.
Throws:
java.lang.IllegalArgumentException - the string cannot be delivered (because it is erroneous, and so on).

evalName

public java.lang.String evalName(java.lang.String string)
                          throws java.lang.IllegalArgumentException
String to Name conversion. Evaluates a string into a valid spec name.
Parameters:
string - the string to evaluates
Returns:
the desired package name as a String.
Throws:
java.lang.IllegalArgumentException - the element cannot be delivered (because it is erroneous, and so on).

displayName

public java.lang.String displayName(java.lang.String elem)
                             throws java.lang.IllegalArgumentException
Name to String conversion. Display a Name into a string representing it.
Parameters:
elem - the element to display
Returns:
the desired string.
Throws:
java.lang.IllegalArgumentException - the string cannot be delivered (because it is erroneous, and so on).

evalModuleName

public java.lang.String evalModuleName(java.lang.String string)
                                throws java.lang.IllegalArgumentException
String to ModuleName conversion. Evaluates a string into a valid spec module name.
Parameters:
string - the string to evaluates
Returns:
the desired package module name as a String.
Throws:
java.lang.IllegalArgumentException - the element cannot be delivered (because it is erroneous, and so on).

displayModuleName

public java.lang.String displayModuleName(java.lang.String elem)
                                   throws java.lang.IllegalArgumentException
ModuleName to String conversion. Display a module name into a string representing it.
Parameters:
elem - the element to display
Returns:
the desired string.
Throws:
java.lang.IllegalArgumentException - the string cannot be delivered (because it is erroneous, and so on).

notifySpecModuleChanged

public void notifySpecModuleChanged(java.lang.String specName,
                                    SpecModule module)
Description copied from interface: SpecModuleObserver
Notification routine. This routine is called by the spec manager - if the file listener is registrated - each time the spec manager decides that the specification module is modified.
Specified by:
notifySpecModuleChanged in interface SpecModuleObserver
Following copied from interface: ConForM.CoopnTools.CoKer.SpecMgr.SpecModuleObserver
Parameters:
specName - the name of the spec module.
module - the modified specification module.