agg.xt_basis
Class Match

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

public class Match
extends OrdinaryMorphism
implements XMLObject

This class is used to represent matches (morphism from the left side graph of a rule into a host graph). Note that not every instance of this class is a valid match in terms of theory, because in theory a match has to be a total morphism satisfying all positive negative application conditions (NACs) of the corresponding rule. The methods isTotal() and isValid() can be used to check for these additional properties dynamically.

See Also:
Morphism.isTotal(), isValid()

Field Summary
 
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 Match()
           
protected Match(Rule rule, Graph graph)
           
 
Method Summary
 void adjustAttrCondition()
          Checks existing attribute conditions of the attribute context against the attribute context of its rule.
 void adjustAttrInputParameter(boolean inputParameterOnly)
          Checks existing variables of the attribute context against the attribute context of its rule.
 boolean allowedToIgnoreInputParameter()
           
 void allowToIgnoreInputParameter(boolean b)
           
 boolean areNACsSatisfied()
           
 boolean areNACsSatisfied(boolean withVars)
           
 boolean arePACsSatisfied()
           
 boolean arePACsSatisfied(boolean withVars)
           
protected  boolean areTotalityIdentificationDanglingAttrsOfGluingSatisfied()
           
 boolean areTotalityIdentificationDanglingSatisfied()
           
 boolean checkAbstractGraphObject(Type abstractNodeType)
          Returns FALSE if a node of the specified abstract type is found in the target graph of this match, otherwise - TRUE.
 boolean checkAttrCondition()
           
protected  void checkEdgeSourceTargetCompatibility(GraphObject orig, GraphObject image)
           
 Morphism checkNAC(OrdinaryMorphism nac)
          Check if this match satisfies the given negative application condition.
 Morphism checkNAC(OrdinaryMorphism nac, boolean withVars)
           
 Morphism checkPAC(OrdinaryMorphism pac)
          Check if this match satisfies the given positive application condition.
 Morphism checkPAC(OrdinaryMorphism pac, boolean withVars)
           
 void clear()
          Remove all mappings and unset all variables of its attribute context.
 void clearErrorMsg()
           
 void dispose()
          Remove all graph object mappings and all relations to its source and target graphs.
 void enableInputParameter(boolean enable)
           
 void finalize()
           
 java.lang.String getErrorMsg()
          Returns an empty message or null if this match is valid, otherwise - an error message.
 java.lang.String getLastErrorMsg()
           
 Rule getRule()
          Return the rule that I am a match for.
 boolean isAttrConditionSatisfied()
           
 boolean isDanglingConditionSatisfied()
           
 boolean isReadyToTransform()
          Checks variable declarations and attribute conditions.
 boolean isTypeMaxMultiplicitySatisfied()
          Checks multiplicity of node resp. edge types due to the type graph of the given match.
 boolean isTypeMultiplicitySatisfied()
          Checks multiplicity of node resp. edge types due to the type graph of the given match.
 boolean isValid()
          Checks if this is a valid match.
 boolean isValid(boolean allowVariables)
          This method is like the method isValid(), additionally, the usage of variables in a work graph is possible.
 boolean nextCompletion()
          Compute next completion: * Invoke this method successively to get all completions.
 boolean nextCompletionWithConstantsAndVariablesChecking()
          Compute next completion: * Invoke this method successively to get all completions
 boolean nextCompletionWithConstantsChecking()
          Compute next completion: * Invoke this method successively to get all completions
 void resetTarget(Graph g)
           
 void resetVariableDomainOfCompletionStrategy(boolean b)
           
 void unsetInputParameter(boolean inputParameterOnly)
          Set the value of the variables of the attribute context to null.
 void unsetVariables()
           
 void XreadObject(XMLHelper h)
           
 void XwriteObject(XMLHelper h)
           
 
Methods inherited from class agg.xt_basis.OrdinaryMorphism
adaptAttrContextValues, addAttrMapping, addChild2ParentMapping, addErrorMsg, addMapping, addMapping, addMapping, addPlainMapping, addToAttrContext, addToAttrContext, addToAttrContext, canComplete, canMatch, checkAll, checkConstants, checkCreateMapping, checkCreateMapping, checkType, checkVariables, compareTo, completeDiagram, completeDiagram, compose, copyAttrContext, deleteTransientContextVariables, disableUnusedAttrCondition, dispose, doCompose, doComposeInherit, enableUnusedAttrCondition, fillUpAttrContext, fillUpImageAttrs, fillUpOriginalAttrs, getAttrContext, getAttrManager, getCodomain, getCodomainObjects, getCoMorphism, getCompletionStrategy, getDomain, getDomainObjects, getElementsToCreate, getElementsToDelete, getImage, getImage, getInverseImage, getInverseImageList, getName, getOriginal, getOverlappings, getOverlappings, getOverlappingsVector, getOverlappingsVector, getSize, getSource, getTarget, getTextualComment, getUsageOfInputParameters, getUsedTypes, 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, nextCompletionWithConstantsAndVariablesChecking, nextCompletionWithConstantsChecking, nonMappedImages, nonMappedOriginals, propagateChange, readMorphism, removeAllMappings, removeAttrMapping, removeAttrMappings, removeMapping, removeMapping, removeMapping, removeUnusedVariableOfAttrContext, 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
 

Constructor Detail

Match

protected Match()

Match

protected Match(Rule rule,
                Graph graph)
Method Detail

dispose

public void dispose()
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

clear

public void clear()
Description copied from class: OrdinaryMorphism
Remove all mappings and unset all variables of its attribute context.

Overrides:
clear in class OrdinaryMorphism

resetTarget

public void resetTarget(Graph g)

getRule

public final Rule getRule()
Return the rule that I am a match for.


getErrorMsg

public java.lang.String getErrorMsg()
Returns an empty message or null if this match is valid, otherwise - an error message.

Overrides:
getErrorMsg in class OrdinaryMorphism

getLastErrorMsg

public java.lang.String getLastErrorMsg()

clearErrorMsg

public void clearErrorMsg()
Overrides:
clearErrorMsg in class OrdinaryMorphism

checkAbstractGraphObject

public boolean checkAbstractGraphObject(Type abstractNodeType)
Returns FALSE if a node of the specified abstract type is found in the target graph of this match, otherwise - TRUE.


adjustAttrInputParameter

public void adjustAttrInputParameter(boolean inputParameterOnly)
Checks existing variables of the attribute context against the attribute context of its rule. Adjusts the attribute context of this match, if needed.


adjustAttrCondition

public void adjustAttrCondition()
Checks existing attribute conditions of the attribute context against the attribute context of its rule. Adjusts the attribute conditions of this match, if needed.


unsetInputParameter

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


allowToIgnoreInputParameter

public void allowToIgnoreInputParameter(boolean b)

allowedToIgnoreInputParameter

public boolean allowedToIgnoreInputParameter()

isReadyToTransform

public boolean isReadyToTransform()
Checks variable declarations and attribute conditions. Use method getErrorMsg() to get found error.


resetVariableDomainOfCompletionStrategy

public void resetVariableDomainOfCompletionStrategy(boolean b)

nextCompletion

public boolean nextCompletion()
Description copied from class: OrdinaryMorphism
Compute next completion: * Invoke this method successively to get all completions.

Overrides:
nextCompletion in class OrdinaryMorphism
Returns:
false if there are no more completions.*

nextCompletionWithConstantsChecking

public boolean nextCompletionWithConstantsChecking()
Description copied from class: OrdinaryMorphism
Compute next completion: * Invoke this method successively to get all completions. *

Overrides:
nextCompletionWithConstantsChecking in class OrdinaryMorphism
Returns:
false if there are no more completions.

nextCompletionWithConstantsAndVariablesChecking

public boolean nextCompletionWithConstantsAndVariablesChecking()
Description copied from class: OrdinaryMorphism
Compute next completion: * Invoke this method successively to get all completions. *

Overrides:
nextCompletionWithConstantsAndVariablesChecking in class OrdinaryMorphism
Returns:
false if there are no more completions.

areTotalityIdentificationDanglingAttrsOfGluingSatisfied

protected boolean areTotalityIdentificationDanglingAttrsOfGluingSatisfied()

areTotalityIdentificationDanglingSatisfied

public boolean areTotalityIdentificationDanglingSatisfied()

isValid

public final boolean isValid()
Checks if this is a valid match.
There are two cases to use this method:
  1. After the method nextCompletion() is called and returned with TRUE. In this case the check of conditions: totality, identification and dangling, NACs and PACs - is already done and only check of: node resp. edge type multiplicity and post rule application conditions - will be performed.
  2. The match mapping is set manually and the method nextCompletion() was not called. Then all checks: totality, identification and dangling, NACs and PACs , node resp. edge type multiplicity and post rule application conditions - will be performed.

For each condition the appropriate matching option should be set.

The usage of variables in the work graph is not allowed.

Returns:
true iff this is a total morphism and all conditions of its rule are satisfied.

isValid

public final boolean isValid(boolean allowVariables)
This method is like the method isValid(), additionally, the usage of variables in a work graph is possible.

Returns:
true iff this is a total morphism and all conditions of its rule are satisfied.

checkAttrCondition

public boolean checkAttrCondition()

areNACsSatisfied

public boolean areNACsSatisfied()

arePACsSatisfied

public boolean arePACsSatisfied()

areNACsSatisfied

public boolean areNACsSatisfied(boolean withVars)

arePACsSatisfied

public boolean arePACsSatisfied(boolean withVars)

checkNAC

public final Morphism checkNAC(OrdinaryMorphism nac)
Check if this match satisfies the given negative application condition.

Returns:
null if nac is satisfied; otherwise the morphism between nac.getImage() and this.getImage() that shows how nac was violated. Note that the returned morphism is only valid until the next call of nextCompletion() or checkNAC().

Pre:

  1. this.isTotal().
  2. nac.isTotal(). (This is what theory demands. The implementation works for partial NACs as well.)

checkNAC

public final Morphism checkNAC(OrdinaryMorphism nac,
                               boolean withVars)

checkPAC

public final Morphism checkPAC(OrdinaryMorphism pac)
Check if this match satisfies the given positive application condition.

Returns:
null if pac is not satisfied; otherwise the morphism between pac.getImage() and this.getImage() that shows how pac was satisfied. Note that the returned morphism is only valid until the next call of nextCompletion() or checkPAC().

Pre:

  1. this.isTotal().
  2. pac.isTotal(). (This is what theory demands. The implementation works for partial PACs as well; maybe this will turn out useful.)

checkPAC

public final Morphism checkPAC(OrdinaryMorphism pac,
                               boolean withVars)

enableInputParameter

public void enableInputParameter(boolean enable)

unsetVariables

public void unsetVariables()

isAttrConditionSatisfied

public boolean isAttrConditionSatisfied()

isDanglingConditionSatisfied

public boolean isDanglingConditionSatisfied()

checkEdgeSourceTargetCompatibility

protected void checkEdgeSourceTargetCompatibility(GraphObject orig,
                                                  GraphObject image)
                                           throws BadMappingException
Overrides:
checkEdgeSourceTargetCompatibility in class OrdinaryMorphism
Throws:
BadMappingException

isTypeMultiplicitySatisfied

public boolean isTypeMultiplicitySatisfied()
Checks multiplicity of node resp. edge types due to the type graph of the given match.

Parameters:
match -
Returns:
Error string if check failed, otherwise - null.

isTypeMaxMultiplicitySatisfied

public boolean isTypeMaxMultiplicitySatisfied()
Checks multiplicity of node resp. edge types due to the type graph of the given match.

Parameters:
match -
Returns:
Error string if check failed, otherwise - null.

XwriteObject

public void XwriteObject(XMLHelper h)
Specified by:
XwriteObject in interface XMLObject

XreadObject

public void XreadObject(XMLHelper h)
Specified by:
XreadObject in interface XMLObject