agg.xt_basis
Class Rule

java.lang.Object
  extended by java.util.Observable
      extended by agg.util.ExtObservable
          extended by agg.xt_basis.OrdinaryMorphism
              extended by agg.xt_basis.Rule
All Implemented Interfaces:
Disposable, XMLObject, Morphism
Direct Known Subclasses:
SubRule

public class Rule
extends OrdinaryMorphism
implements XMLObject

At the moment, AGG implements the DPO approach by switching on the * dangling-edge-condition by default. However, the DEC can be switched * off manually such that AGG operates on the SPO. (SG, Aug.1999)


Field Summary
protected  boolean applicable
           
protected  java.util.Vector<EvalSet> atom_conditions
           
protected  java.util.Hashtable<GraphObject,GraphObject> changedPreserved
           
protected  java.util.Vector<java.lang.String> constraintNamesSet
           
protected  java.util.Vector<Formula> constraints
           
protected  java.util.Vector<GraphObject> created
           
protected  java.util.Vector<GraphObject> deleted
           
protected  java.util.Vector<GraphObject> forbiden
           
protected  boolean generatePostConstraints
           
protected  boolean isChanging
           
protected  boolean isCreating
           
protected  boolean isDeleting
           
protected  boolean isReady
           
protected  java.util.Vector<OrdinaryMorphism> itsNACs
           
protected  java.util.Vector<OrdinaryMorphism> itsPACs
           
protected  java.util.Vector<AtomConstraint> itsUsedAtomics
           
protected  java.util.Vector<Formula> itsUsedFormulas
           
protected  int layer
           
protected  boolean parallelMatching
           
protected  java.util.Vector<GraphObject> preserved
           
protected  int priority
           
protected  boolean triggerOfLayer
           
protected  java.util.List<java.lang.String> typesWhichNeedMultiplicityCheck
           
 
Fields inherited from class agg.xt_basis.OrdinaryMorphism
cKeepContext, comment, enabled, errorMsg, errors, itsAttrContext, itsAttrManager, itsAttrMappings, itsCodomObjects, itsCoMorph, itsCompleter, itsDomObjects, itsImag, itsInteractiveFlag, itsName, itsOrig, itsTouchedFlag, partialMorphCompletion, removeAttrMapping, typeObjectsMapChanged
 
Constructor Summary
protected Rule()
          Create myself.
protected Rule(Graph left, Graph right)
          Create myself.
protected Rule(TypeSet types)
          Create myself.
 
Method Summary
 void addConstraint(Formula f)
          Adds the specified graph constraint to its list of constraints which can be converted to the post application constraints.
 boolean addNAC(OrdinaryMorphism nac)
          Adds the specified morphism representing a negative application condition (NAC).
 boolean addPAC(OrdinaryMorphism pac)
          Adds the specified morphism representing a positive application condition (PAC).
 void adjustAttrContextOfMatch(boolean inputParameterOnly)
          Checks existing variables of the attribute context against the attribute context of its current match and adjusts the attribute context of its match, if needed.
 boolean areNACsValid()
          always returns TRUE.
 boolean arePACsValid()
          always returns TRUE!
 boolean canMatch(Graph g, MorphCompletionStrategy strategy)
          Returns true if this rule can make a match basically.
 java.lang.String checkInputParameterSet()
          Returns the name of an input parameter whithout value, otherwise - null.
 java.util.Vector<java.lang.String> checkInputParameterSet(boolean left)
          Returns name(s) of the variables of the attribute context which are used as input parameter(s) of this rule and they are not set.
 boolean checkMakeAbstract(Type nodeType)
          Returns FALSE if the specified nodeType is an abstract type and used in the RHS to create a node, otherwise - TRUE.
protected  boolean checkType(Type orig, Type image)
          Checks the type compatibility of two graph objects.
 void clearConstraints()
          Clears lists of its graph constraints.
 void clearConstraints(AtomConstraint ac)
          Clears its lists of graph constraints only if the specified atomic graph constraint belongs to its constraints.
 void clearConstraints(Formula f)
          Clears its lists of graph constraints only if the specified graph constraint belongs to its constraints.
 void clearRule()
           
 boolean compareConstantAttributeValue(GraphObject src, GraphObject tgt)
          Compares attribute value of the specified objects due to constant value of the first object.
 boolean compareConstantAttributeValueOfMappedObjects(GraphObject src, GraphObject tgt)
          Compares attribute value of the specified objects due to constant value of the first object.
 boolean compareTo(Rule r)
          Compares its LHS, RHS, morphism, NACs, PACs and attribute context to the appropriate elements of the specified rule.
 java.lang.String convertUsedFormulas()
          Generates rule post application conditions from its constraints(formulas).
 OrdinaryMorphism createNAC()
          Creates a new negative application condition (NAC) and add it to its NACs.
 OrdinaryMorphism createPAC()
          Creates a new positive application condition (PAC) and add it to its PACs.
 void destroyNAC(OrdinaryMorphism nac)
          Destroys the specified NAC from my NACs.
 boolean destroyObjectsOfType(Type t)
          Try to destroy all graph objects of the specified type from its graphs (LHS, RHS, NACs, PACs, graph constraints).
 java.util.Vector<java.lang.String> destroyObjectsOfTypes(java.util.Vector<Type> types)
          Try to destroy all graph objects of the specified types from its graphs (LHS, RHS, NACs, PACs, graph constraints).
 void destroyPAC(OrdinaryMorphism pac)
          Destroys the specified pac from my set of PACs.
 void dispose()
          Remove all graph object mappings and all relations to its source and target graphs.
 void enableInputParameter(boolean enable)
           
 void enableNACs(boolean enable)
           
 void enablePACs(boolean enable)
           
 void finalize()
           
 java.util.Vector<EvalSet> getAtomApplConds()
           
 Rule getClone()
          Returns a copy of this rule.
 java.util.Vector<java.lang.String> getConstraintNames()
           
 java.util.Vector<Formula> getConstraints()
          Returns its graph constraints which can be converted to the post application constraints.
 java.util.Hashtable<GraphObject,GraphObject> getElementsToChange()
          Returns preserved elements which attributes should be changed.
 java.util.Vector<GraphObject> getElementsToCreate()
          Returns elements of the RHS to create.
 java.util.Vector<GraphObject> getElementsToDelete()
          Returns elements of the LHS to delete.
 java.util.Vector<GraphObject> getElementsToPreserve()
          Returns elements of the LHS which should be preserved.
 java.lang.String getErrorMsg()
          Returns error message if this rule is not ready to transform.
 java.util.Vector<VarMember> getInputParameters()
          Returns variables of the attribute context of this rule which are used as input parameter for the rule application.
 java.util.Vector<VarMember> getInputParametersOfGraphObject(GraphObject go)
          Returns variables of the attribute context of this rule which are used from attributes of the specified graph object as input parameter for the rule application.
 int getLayer()
          Returns its layer.
 Graph getLeft()
          Returns its left graph.
 Match getMatch()
          Returns my current match
 OrdinaryMorphism getMorphism()
          Return its morphism between the left and right graphs.
 OrdinaryMorphism getNAC(java.lang.String name)
          Returns an OrdinaryMorphism representing a NAC with the specified name.
 java.util.Enumeration<OrdinaryMorphism> getNACs()
          Returns an enumeration of my NACs.
 java.util.List<OrdinaryMorphism> getNACsList()
           
 java.util.Vector<OrdinaryMorphism> getNACsVector()
          Deprecated. replaced by getNACsList()
 int getNumberOfObjectsToCreate()
          Deprecated. use getElementsToCreate().size()
 int getNumberOfObjectsToDelete()
          Deprecated. use getElementsToDelete().size()
 java.util.Vector<GraphObject> getObjectsToCreate()
          Deprecated. replaced by Vector getElementsToCreate()
 java.util.Vector<GraphObject> getObjectsToDelete()
          Deprecated. replaced by Vector getElementsToDelete()
 OrdinaryMorphism getPAC(java.lang.String name)
          Returns an OrdinaryMorphism representing a PAC with the specified name.
 java.util.Enumeration<OrdinaryMorphism> getPACs()
          Return an enumeration of my PACs with elements of type OrdinaryMorphism.
 java.util.List<OrdinaryMorphism> getPACsList()
           
 java.util.Vector<OrdinaryMorphism> getPACsVector()
          Deprecated. replaced by getPACsList() Return the Vector of my PACs with elements of type OrdinaryMorphism.
 int getPriority()
          Returns my priority.
 Graph getRight()
          Returns its right graph.
 TypeSet getTypeSet()
           
 java.util.List<java.lang.String> getTypesWhichNeedMultiplicityCheck()
           
 java.util.Vector<AtomConstraint> getUsedAtomics()
          Return a vector of atomic graph constraints used for generating post application conditions.
 java.util.Vector<Formula> getUsedFormulas()
          Return the vector of constraints (formulas) used for generating post application conditions.
 java.util.Vector<Type> getUsedTypes()
           
 boolean hasNACs()
          Returns true if it contains a NAC.
 boolean hasPACs()
          Returns true, if its contains a PAC.
 Pair<Rule,Pair<OrdinaryMorphism,OrdinaryMorphism>> invertComplex()
          Tries to invert this rule.
 Rule invertSimplex()
          Returns an inverted rule.
 boolean isApplicable()
          Returns the value which set by setApplicable(boolean appl).
 boolean isApplicable(Graph g, MorphCompletionStrategy strategy)
          Checks whether this rule is applicable at the specified graph by the specified matching strategy or not.
 boolean isApplicable(Graph g, MorphCompletionStrategy strategy, boolean doCheckIfReadyToTransform)
          Checks whether this rule is applicable at the specified graph by the specified matching strategy or not.
 boolean isArcDeleting()
           
 boolean isChanging()
          Returns true if this rule will change some attributes of the graph elements, otherwise - false.
 boolean isCreating()
          Returns true if this rule will create new graph elements, otherwise - false.
 boolean isDeleting()
          Returns true if this rule will delete some graph elements, otherwise - false.
 boolean isElement(Graph g)
          Checks if the specified graph is its LHS, RHS, target of a NAC, target of a PAC graph.
 boolean isEmptyRule()
          Return true if its left and right graphs are empty and there aren't any NACs and PACs, otherwise - false.
 boolean isLeftApplicable(Graph g, MorphCompletionStrategy strategy, boolean doCheckIfReadyToTransform)
          Checks whether this rule is applicable at the specified graph by the specified matching strategy or not.
 boolean isNACValid(OrdinaryMorphism nac)
          always returns TRUE.
 boolean isNodeDeleting()
           
 boolean isPACValid(OrdinaryMorphism pac)
          always returns TRUE!
 boolean isParallelApplyEnabled()
           
 boolean isReadyToTransform()
          Checks attribute setting of RHS, variable declarations and attribute conditions.
 boolean isReadyToTransform(boolean prepareRuleInfo)
          Deprecated. replaced by isReadyToTransform() that includs update of the rule infos
 boolean isTriggerOfLayer()
          Checks if this rule is a trigger rule of its layer.
 boolean isUsingType(GraphObject typeObj)
          Returns true if this rule, its NACs or PACs are using the specified type which is an element (node or edge) of a type graph.
 void prepareRuleInfo()
          Prepares info about this rule: node, edges to preserve, change, delete, create; types which should be checked due to node resp. edge type multiplicity.
 void removeApplConditions()
          Clears its application constraints.
 void removeAtomApplCond(AtomApplCond atom)
          Removes the specified atomic application condition from its post application conditions.
 void removeConstraint(EvalSet constraint)
          Removes the specified application condition from its post application conditions.
 boolean removeNAC(OrdinaryMorphism nac)
          Removes a negative application condition.
 boolean removePAC(OrdinaryMorphism pac)
          Removes the specified positive application condition.
 void removeUnusedVariableOfAttrContext()
           
 void resetTargetOfMatch(Graph g)
          Reset target graph of its match, if it exists.
protected  void restoreVariableDeclaration()
          Restores variable declarations of the RHS, NACs and PACs.
 void setApplicable(boolean appl)
           
 void setAtomApplConds(java.util.Vector<EvalSet> v, java.util.Vector<java.lang.String> names)
          Set the specified post application conditions to its conditions.
 void setInputParameters(java.util.HashMap<java.lang.String,java.util.Vector<java.lang.Object>> parameters)
          Set value of the input parameter of its attribute context.
 void setLayer(int l)
          Sets its layer.
 void setMatch(Match m)
          Set its match to the specified parameter.
 void setParallelMatchingEnabled(boolean b)
           
 void setPriority(int p)
          Sets my priority.
 void setTriggerForLayer(boolean trigger)
          Set this rule to be a trigger rule of its layer.
 void setUsedFormulas(java.util.List<Formula> formulasToUse)
          Set its constraints (formulas) which will be used for generating its post application conditions.
 void unsetInputParameter(boolean inputParameterOnly)
          Set the value of variables of its attribute context to null.
 void XreadObject(XMLHelper h)
          Implements the interface of XMLObject
 void XwriteObject(XMLHelper h)
          Implements the interface of XMLObject
 
Methods inherited from class agg.xt_basis.OrdinaryMorphism
adaptAttrContextValues, addAttrMapping, addChild2ParentMapping, addErrorMsg, addMapping, addMapping, addMapping, addPlainMapping, addToAttrContext, addToAttrContext, addToAttrContext, canComplete, checkAll, checkConstants, checkCreateMapping, checkCreateMapping, checkEdgeSourceTargetCompatibility, checkVariables, clear, clearErrorMsg, compareTo, completeDiagram, completeDiagram, compose, copyAttrContext, deleteTransientContextVariables, disableUnusedAttrCondition, dispose, doCompose, doComposeInherit, enableUnusedAttrCondition, fillUpAttrContext, fillUpImageAttrs, fillUpOriginalAttrs, getAttrContext, getAttrManager, getCodomain, getCodomainObjects, getCoMorphism, getCompletionStrategy, getDomain, getDomainObjects, getImage, getImage, getInverseImage, getInverseImageList, getName, getOriginal, getOverlappings, getOverlappings, getOverlappingsVector, getOverlappingsVector, getSize, getSource, getTarget, getTextualComment, getUsageOfInputParameters, getVariableDeclarations, intersectCoDomains, invert, isBijective, isClassName, isCommutative, isEmpty, isEnabled, isInjective, isIsomorphicTo, isIsomorphicTo, isMappingChanged, isNotificationRequired, isPartial, isPartialIsomorphicTo, isPartialMorphismCompletion, isSurjective, isTotal, isTypeObjectsMapChanged, makeAttributeContext, makeDiagram, makeDiagram, makeFullDiagram, makeFullDiagram, makeMatch, makeWeakDiagram, makeWeakDiagram, morphcopy, nextCompletion, nextCompletion, nextCompletionWithConstantsAndVariablesChecking, nextCompletionWithConstantsAndVariablesChecking, nextCompletionWithConstantsChecking, nextCompletionWithConstantsChecking, nonMappedImages, nonMappedOriginals, propagateChange, readMorphism, removeAllMappings, removeAttrMapping, removeAttrMappings, removeMapping, removeMapping, removeMapping, removeVariableValue, resetCSPVariableDomainOf, setAttrContext, setChanged, setCoMorphism, setCompletionStrategy, setCompletionStrategy, setEnabled, setName, setPartialMorphismCompletion, setSource, setTarget, setTextualComment, setTypeObjectsMapChanged, simplecopy, unsetCompletionStrategy, unsetOriginalAttrsIfExpression, updateAttrMappings, writeMorphism
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

itsNACs

protected final java.util.Vector<OrdinaryMorphism> itsNACs

itsPACs

protected final java.util.Vector<OrdinaryMorphism> itsPACs

itsUsedAtomics

protected final java.util.Vector<AtomConstraint> itsUsedAtomics

itsUsedFormulas

protected final java.util.Vector<Formula> itsUsedFormulas

constraintNamesSet

protected transient java.util.Vector<java.lang.String> constraintNamesSet

constraints

protected transient java.util.Vector<Formula> constraints

atom_conditions

protected transient java.util.Vector<EvalSet> atom_conditions

generatePostConstraints

protected transient boolean generatePostConstraints

applicable

protected transient boolean applicable

parallelMatching

protected boolean parallelMatching

layer

protected int layer

priority

protected int priority

triggerOfLayer

protected boolean triggerOfLayer

isReady

protected transient boolean isReady

isDeleting

protected transient boolean isDeleting

isCreating

protected transient boolean isCreating

isChanging

protected transient boolean isChanging

preserved

protected transient java.util.Vector<GraphObject> preserved

created

protected transient java.util.Vector<GraphObject> created

deleted

protected transient java.util.Vector<GraphObject> deleted

forbiden

protected transient java.util.Vector<GraphObject> forbiden

changedPreserved

protected transient java.util.Hashtable<GraphObject,GraphObject> changedPreserved

typesWhichNeedMultiplicityCheck

protected transient java.util.List<java.lang.String> typesWhichNeedMultiplicityCheck
Constructor Detail

Rule

protected Rule()
Create myself.


Rule

protected Rule(TypeSet types)
Create myself.


Rule

protected Rule(Graph left,
               Graph right)
Create myself.

Parameters:
left - my left graph.
right - my right graph.
Method Detail

dispose

public void dispose()
Description copied from class: OrdinaryMorphism
Remove all graph object mappings and all relations to its source and target graphs.

Specified by:
dispose in interface Disposable
Overrides:
dispose in class OrdinaryMorphism
See Also:
Change_ObservableGone

finalize

public void finalize()
Overrides:
finalize in class ExtObservable

clearRule

public void clearRule()

isElement

public boolean isElement(Graph g)
Checks if the specified graph is its LHS, RHS, target of a NAC, target of a PAC graph.


getLeft

public final Graph getLeft()
Returns its left graph.


getRight

public final Graph getRight()
Returns its right graph.


isApplicable

public boolean isApplicable()
Returns the value which set by setApplicable(boolean appl).


isApplicable

public boolean isApplicable(Graph g,
                            MorphCompletionStrategy strategy)
Checks whether this rule is applicable at the specified graph by the specified matching strategy or not. Pre: check isReadyToTransform() should be done before


isApplicable

public boolean isApplicable(Graph g,
                            MorphCompletionStrategy strategy,
                            boolean doCheckIfReadyToTransform)
Checks whether this rule is applicable at the specified graph by the specified matching strategy or not.


enableInputParameter

public void enableInputParameter(boolean enable)

isLeftApplicable

public boolean isLeftApplicable(Graph g,
                                MorphCompletionStrategy strategy,
                                boolean doCheckIfReadyToTransform)
Checks whether this rule is applicable at the specified graph by the specified matching strategy or not. This check does not take in account its NACs and PACs.


enableNACs

public void enableNACs(boolean enable)

enablePACs

public void enablePACs(boolean enable)

setApplicable

public void setApplicable(boolean appl)

getTypeSet

public TypeSet getTypeSet()

createNAC

public OrdinaryMorphism createNAC()
Creates a new negative application condition (NAC) and add it to its NACs. Note, because a new NAC morphism is empty and the LHS is not, it is not a NAC morphism in terms of theory, which demands a NAC to be a total morphism.

Returns:
an empty morphism nac with nac.getOriginal() == this.getOriginal().

addNAC

public boolean addNAC(OrdinaryMorphism nac)
Adds the specified morphism representing a negative application condition (NAC).

Pre: nac.getOriginal() == this.getOriginal().


destroyNAC

public void destroyNAC(OrdinaryMorphism nac)
Destroys the specified NAC from my NACs. The image graph of the nac morphism would be destroyed, too.


hasNACs

public boolean hasNACs()
Returns true if it contains a NAC.


getNACs

public java.util.Enumeration<OrdinaryMorphism> getNACs()
Returns an enumeration of my NACs.


getNACsVector

public java.util.Vector<OrdinaryMorphism> getNACsVector()
Deprecated. replaced by getNACsList()


getNACsList

public java.util.List<OrdinaryMorphism> getNACsList()

getNAC

public OrdinaryMorphism getNAC(java.lang.String name)
Returns an OrdinaryMorphism representing a NAC with the specified name.


removeNAC

public final boolean removeNAC(OrdinaryMorphism nac)
Removes a negative application condition.

Returns:
false if nac is not found, otherwise - true.

createPAC

public OrdinaryMorphism createPAC()
Creates a new positive application condition (PAC) and add it to its PACs. Note, because a new PAC morphism is empty and the LHS is not, it is not a PAC morphism in terms of theory, which demands a PAC to be a total morphism.

Returns:
an empty morphism pac with pac.getOriginal() == this.getOriginal().

addPAC

public boolean addPAC(OrdinaryMorphism pac)
Adds the specified morphism representing a positive application condition (PAC). Pre: pac.getOriginal() == this.getOriginal().


destroyPAC

public void destroyPAC(OrdinaryMorphism pac)
Destroys the specified pac from my set of PACs. The image graph of the pac morphism would be destroyed, too.


hasPACs

public boolean hasPACs()
Returns true, if its contains a PAC.


getPACs

public java.util.Enumeration<OrdinaryMorphism> getPACs()
Return an enumeration of my PACs with elements of type OrdinaryMorphism.


getPACsVector

public java.util.Vector<OrdinaryMorphism> getPACsVector()
Deprecated. replaced by getPACsList() Return the Vector of my PACs with elements of type OrdinaryMorphism.


getPACsList

public java.util.List<OrdinaryMorphism> getPACsList()

getPAC

public OrdinaryMorphism getPAC(java.lang.String name)
Returns an OrdinaryMorphism representing a PAC with the specified name.


removePAC

public final boolean removePAC(OrdinaryMorphism pac)
Removes the specified positive application condition.

Returns:
false if pac is not found, otherwise - true.

checkMakeAbstract

public boolean checkMakeAbstract(Type nodeType)
Returns FALSE if the specified nodeType is an abstract type and used in the RHS to create a node, otherwise - TRUE.


destroyObjectsOfType

public boolean destroyObjectsOfType(Type t)
Try to destroy all graph objects of the specified type from its graphs (LHS, RHS, NACs, PACs, graph constraints).


destroyObjectsOfTypes

public java.util.Vector<java.lang.String> destroyObjectsOfTypes(java.util.Vector<Type> types)
Try to destroy all graph objects of the specified types from its graphs (LHS, RHS, NACs, PACs, graph constraints). Returns names of the failed types.


getClone

public Rule getClone()
Returns a copy of this rule.


getMorphism

public final OrdinaryMorphism getMorphism()
Return its morphism between the left and right graphs.


getConstraints

public java.util.Vector<Formula> getConstraints()
Returns its graph constraints which can be converted to the post application constraints.


addConstraint

public void addConstraint(Formula f)
Adds the specified graph constraint to its list of constraints which can be converted to the post application constraints.


checkType

protected boolean checkType(Type orig,
                            Type image)
Checks the type compatibility of two graph objects. The first object should belong to the LHS, the second - to the RHS, to be used for a mapping of the rule morphism.

Overrides:
checkType in class OrdinaryMorphism

convertUsedFormulas

public java.lang.String convertUsedFormulas()
Generates rule post application conditions from its constraints(formulas). Returns error message if something gone wrong, otherwise - empty.


setUsedFormulas

public void setUsedFormulas(java.util.List<Formula> formulasToUse)
Set its constraints (formulas) which will be used for generating its post application conditions.


getUsedAtomics

public java.util.Vector<AtomConstraint> getUsedAtomics()
Return a vector of atomic graph constraints used for generating post application conditions. Elements of the usedAtomic are of the type agg.cons.AtomConstraint .


getUsedFormulas

public java.util.Vector<Formula> getUsedFormulas()
Return the vector of constraints (formulas) used for generating post application conditions. Elements of the usedFormulas are of the type agg.cons.Formula .


clearConstraints

public void clearConstraints(AtomConstraint ac)
Clears its lists of graph constraints only if the specified atomic graph constraint belongs to its constraints.


clearConstraints

public void clearConstraints(Formula f)
Clears its lists of graph constraints only if the specified graph constraint belongs to its constraints.


clearConstraints

public void clearConstraints()
Clears lists of its graph constraints.


setAtomApplConds

public void setAtomApplConds(java.util.Vector<EvalSet> v,
                             java.util.Vector<java.lang.String> names)
Set the specified post application conditions to its conditions.


getAtomApplConds

public java.util.Vector<EvalSet> getAtomApplConds()

getConstraintNames

public java.util.Vector<java.lang.String> getConstraintNames()

removeConstraint

public void removeConstraint(EvalSet constraint)
Removes the specified application condition from its post application conditions.


removeAtomApplCond

public void removeAtomApplCond(AtomApplCond atom)
Removes the specified atomic application condition from its post application conditions.


removeApplConditions

public void removeApplConditions()
Clears its application constraints.


setTriggerForLayer

public void setTriggerForLayer(boolean trigger)
Set this rule to be a trigger rule of its layer. That means: This rule will be the first rule to apply on its layer. It can be applyed one time only. All other rules on this layer can be applyed so long as possible.

Parameters:
trigger -

isTriggerOfLayer

public boolean isTriggerOfLayer()
Checks if this rule is a trigger rule of its layer.


getLayer

public int getLayer()
Returns its layer. The layer will be used by layered grammar.


setLayer

public void setLayer(int l)
Sets its layer. The layer is used by layered grammar.


getPriority

public int getPriority()
Returns my priority. The priority cann be used during graph transformation.


setPriority

public void setPriority(int p)
Sets my priority. The priority cann be used during graph transformation.


isUsingType

public boolean isUsingType(GraphObject typeObj)
Returns true if this rule, its NACs or PACs are using the specified type which is an element (node or edge) of a type graph.


removeUnusedVariableOfAttrContext

public void removeUnusedVariableOfAttrContext()
Overrides:
removeUnusedVariableOfAttrContext in class OrdinaryMorphism

XwriteObject

public void XwriteObject(XMLHelper h)
Implements the interface of XMLObject

Specified by:
XwriteObject in interface XMLObject

XreadObject

public void XreadObject(XMLHelper h)
Implements the interface of XMLObject

Specified by:
XreadObject in interface XMLObject

invertSimplex

public Rule invertSimplex()
Returns an inverted rule. This rule has to be injective, otherwise - returns null. The attribute mappings are NOT inverted, thus: the resulting left and right-hand side graphs are not attributed anymore.


invertComplex

public Pair<Rule,Pair<OrdinaryMorphism,OrdinaryMorphism>> invertComplex()
Tries to invert this rule. The rule has to be injective. The attribute mappings are NOT inverted, thus the resulting left and right-hand side graphs are not attributed anymore. Returns the pair with an inverted rule as the first element and a help pair of two graph morphisms as the second element. The first morphism is between the LHS of this and the RHS of the inverted rule, the second morphism is between the RHS of this and the LHS of the inverted rule. If this rule is not injective - returns null.


getMatch

public Match getMatch()
Returns my current match


compareConstantAttributeValue

public boolean compareConstantAttributeValue(GraphObject src,
                                             GraphObject tgt)
Compares attribute value of the specified objects due to constant value of the first object. Failed attribute value of the second object will be unset. All members of the attribute tuple will be checked.

Parameters:
src - first object (an object of the LHS of a rule)
tar - second object (an object of a NAC, PAC of a rule)
Returns:
true if equal attribute value, otherwise false

compareConstantAttributeValueOfMappedObjects

public boolean compareConstantAttributeValueOfMappedObjects(GraphObject src,
                                                            GraphObject tgt)
Compares attribute value of the specified objects due to constant value of the first object. Failed attribute value of the second object will be unset. The check broken after at least one failed attribute found.

Parameters:
src - first object (an object of the LHS of a rule)
tar - second object (an object of a NAC, PAC of a rule)
Returns:
true if equal attribute value, otherwise false

compareTo

public boolean compareTo(Rule r)
Compares its LHS, RHS, morphism, NACs, PACs and attribute context to the appropriate elements of the specified rule. Returns true if all elements are equal.


getInputParameters

public java.util.Vector<VarMember> getInputParameters()
Returns variables of the attribute context of this rule which are used as input parameter for the rule application.


getInputParametersOfGraphObject

public java.util.Vector<VarMember> getInputParametersOfGraphObject(GraphObject go)
Returns variables of the attribute context of this rule which are used from attributes of the specified graph object as input parameter for the rule application.


areNACsValid

public boolean areNACsValid()
always returns TRUE. It is not yet implemented!


isNACValid

public boolean isNACValid(OrdinaryMorphism nac)
always returns TRUE. It is not yet implemented!


arePACsValid

public boolean arePACsValid()
always returns TRUE! Not yet implemented!


isPACValid

public boolean isPACValid(OrdinaryMorphism pac)
always returns TRUE! Not yet implemented!


adjustAttrContextOfMatch

public void adjustAttrContextOfMatch(boolean inputParameterOnly)
Checks existing variables of the attribute context against the attribute context of its current match and adjusts the attribute context of its match, if needed.


unsetInputParameter

public void unsetInputParameter(boolean inputParameterOnly)
Set the value of variables of its attribute context to null.


checkInputParameterSet

public java.lang.String checkInputParameterSet()
Returns the name of an input parameter whithout value, otherwise - null.


checkInputParameterSet

public java.util.Vector<java.lang.String> checkInputParameterSet(boolean left)
Returns name(s) of the variables of the attribute context which are used as input parameter(s) of this rule and they are not set. If the specified parameter left is TRUE then the LHS (and NACs) with an input parameter for matching are taken in account. If the specified parameter left is FALSE and the RHS (and NACs) with an input parameter for matching are taken in acount. Returns null if all variables as input parameter are set.


isReadyToTransform

public boolean isReadyToTransform(boolean prepareRuleInfo)
Deprecated. replaced by isReadyToTransform() that includs update of the rule infos

Checks attribute setting of RHS, variable declarations and attribute conditions. The method getErrorMessage() gives more information about fails. If the specified parameter prepareRuleInfo is true prepares infos (is deleting, creating, changing) about this rule.


isReadyToTransform

public boolean isReadyToTransform()
Checks attribute setting of RHS, variable declarations and attribute conditions. The method getErrorMessage() gives more information about fails.


prepareRuleInfo

public void prepareRuleInfo()
Prepares info about this rule: node, edges to preserve, change, delete, create; types which should be checked due to node resp. edge type multiplicity. These infos can be called by methods: getElementsToPreserve(), getElementsToChange(), getElementsToDelete(), getElementsToCreate(), getTypesWhichNeedMultiplicityCheck.


isEmptyRule

public boolean isEmptyRule()
Return true if its left and right graphs are empty and there aren't any NACs and PACs, otherwise - false.


getTypesWhichNeedMultiplicityCheck

public java.util.List<java.lang.String> getTypesWhichNeedMultiplicityCheck()

isCreating

public boolean isCreating()
Returns true if this rule will create new graph elements, otherwise - false.


getObjectsToCreate

public java.util.Vector<GraphObject> getObjectsToCreate()
Deprecated. replaced by Vector getElementsToCreate()


getNumberOfObjectsToCreate

public int getNumberOfObjectsToCreate()
Deprecated. use getElementsToCreate().size()


isDeleting

public boolean isDeleting()
Returns true if this rule will delete some graph elements, otherwise - false.


isNodeDeleting

public boolean isNodeDeleting()

isArcDeleting

public boolean isArcDeleting()

getObjectsToDelete

public java.util.Vector<GraphObject> getObjectsToDelete()
Deprecated. replaced by Vector getElementsToDelete()


getNumberOfObjectsToDelete

public int getNumberOfObjectsToDelete()
Deprecated. use getElementsToDelete().size()


getElementsToPreserve

public java.util.Vector<GraphObject> getElementsToPreserve()
Returns elements of the LHS which should be preserved.


getElementsToCreate

public java.util.Vector<GraphObject> getElementsToCreate()
Returns elements of the RHS to create.

Overrides:
getElementsToCreate in class OrdinaryMorphism

getElementsToDelete

public java.util.Vector<GraphObject> getElementsToDelete()
Returns elements of the LHS to delete.

Overrides:
getElementsToDelete in class OrdinaryMorphism

getElementsToChange

public java.util.Hashtable<GraphObject,GraphObject> getElementsToChange()
Returns preserved elements which attributes should be changed. The key is an object of the LHS, the value - its image of the RHS.


isChanging

public boolean isChanging()
Returns true if this rule will change some attributes of the graph elements, otherwise - false.


restoreVariableDeclaration

protected void restoreVariableDeclaration()
Restores variable declarations of the RHS, NACs and PACs. The reason is: the variables declarations can be lost afte a step. Before the next application of this rule can be done the lost variable declarations have to be restored. This method is called during Critical Pair Analysis.


getUsedTypes

public java.util.Vector<Type> getUsedTypes()
Overrides:
getUsedTypes in class OrdinaryMorphism

getErrorMsg

public java.lang.String getErrorMsg()
Returns error message if this rule is not ready to transform.

Overrides:
getErrorMsg in class OrdinaryMorphism
See Also:
isReadyToTransform().

canMatch

public boolean canMatch(Graph g,
                        MorphCompletionStrategy strategy)
Returns true if this rule can make a match basically. It works for INJECTIVE matching, only.

Overrides:
canMatch in class OrdinaryMorphism

setMatch

public void setMatch(Match m)
Set its match to the specified parameter.


resetTargetOfMatch

public void resetTargetOfMatch(Graph g)
Reset target graph of its match, if it exists.


setParallelMatchingEnabled

public void setParallelMatchingEnabled(boolean b)

isParallelApplyEnabled

public boolean isParallelApplyEnabled()

setInputParameters

public void setInputParameters(java.util.HashMap<java.lang.String,java.util.Vector<java.lang.Object>> parameters)
Set value of the input parameter of its attribute context. The specified parameters contain: String - is a name of an input parameter, first Object of a Vector - is the value, second Object of a Vector - is the type of this input parameter.