agg.xt_basis
Class OrdinaryMorphism

java.lang.Object
  extended by java.util.Observable
      extended by agg.util.ExtObservable
          extended by agg.xt_basis.OrdinaryMorphism
All Implemented Interfaces:
Disposable, Morphism
Direct Known Subclasses:
AtomConstraint, Match, NACStarMorphism, OrdinarySubMorphism, PACStarMorphism, Rule

public class OrdinaryMorphism
extends ExtObservable
implements Morphism

Implementation of a graph morphism. Note: This implementation is guaranteed to keep morphism properties when objects are deleted/created/modified in the original or image graphs.


Field Summary
protected static AttrContext cKeepContext
          Use this constant as a parameter in my constructors or in the initialize() method to indicate that the attribute context in question should not be altered.
protected  java.lang.String comment
           
protected  boolean enabled
           
protected  java.lang.String errorMsg
           
protected  java.util.Vector<java.lang.String> errors
           
protected  AttrContext itsAttrContext
           
protected  AttrManager itsAttrManager
           
protected  java.util.Dictionary<AttrInstance,AttrMapping> itsAttrMappings
           
protected  java.util.Vector<GraphObject> itsCodomObjects
           
protected  OrdinaryMorphism itsCoMorph
           
protected  MorphCompletionStrategy itsCompleter
           
protected  java.util.Vector<GraphObject> itsDomObjects
           
protected  Graph itsImag
           
protected  boolean itsInteractiveFlag
           
protected  java.lang.String itsName
           
protected  Graph itsOrig
           
protected  boolean itsTouchedFlag
           
protected  boolean partialMorphCompletion
           
protected  boolean removeAttrMapping
           
protected  boolean typeObjectsMapChanged
           
 
Constructor Summary
protected OrdinaryMorphism()
           
protected OrdinaryMorphism(AttrContext ac)
           
protected OrdinaryMorphism(Graph orig, Graph img)
           
  OrdinaryMorphism(Graph orig, Graph img, AttrContext ac)
           
 
Method Summary
 void adaptAttrContextValues(AttrContext ac)
           
protected  void addAttrMapping(AttrInstance o, AttrInstance i)
           
 void addChild2ParentMapping(GraphObject o, GraphObject i)
          Please note: This method is only for internal use of the critical pair analysis for grammars with node type inheritance.
protected  void addErrorMsg(java.lang.String msg)
           
 void addMapping(GraphObject o, GraphObject i)
          Map an object of source graph to an object of target graph.
 void addMapping(GraphObject o, GraphObject i, boolean mappingPropagation)
          Deprecated. please use addMapping(final GraphObject o, final GraphObject i)
 void addMapping(java.util.Vector<GraphObject> listOfGraphObjects)
          This method tries to add morphism mapping between elements of my source graph and elements of the specified list.
protected  void addPlainMapping(GraphObject o, GraphObject i)
           
 void addToAttrContext(AttrContext ac)
           
 void addToAttrContext(CondTuple conds)
           
 void addToAttrContext(VarTuple vars)
           
 boolean canComplete()
          Return true if this morphism can be completed basically.
 boolean canMatch(Graph g, MorphCompletionStrategy strategy)
          Return true if my source graph can be a subgraph of the given graph g basically.
protected  boolean checkAll()
          Check if the setting of the same attribute member of the original and image graph objects are equal.
 boolean checkConstants()
          Check if the constant value of the same attribute member * of the original and image graphobjects are equal.
 TypeError checkCreateMapping(Arc src, Arc tar)
          Returns null if the source and target nodes of the specified edges are already mapped and the type compatibility of these two edges is satisfied, otherwise - an error.
 TypeError checkCreateMapping(Node src, Node tar)
          Returns an error if the type compatibility of the specified nodes failed, otherwise - null.
protected  void checkEdgeSourceTargetCompatibility(GraphObject orig, GraphObject image)
           
protected  boolean checkType(Type orig, Type image)
           
 boolean checkVariables()
          Check if the variable of the same attribute member * of the original and image graphobjects are equal.
 void clear()
          Remove all mappings and unset all variables of its attribute context.
 void clearErrorMsg()
           
 boolean compareTo(OrdinaryMorphism morph)
           
 OrdinaryMorphism completeDiagram(OrdinaryMorphism input)
          Given an input morphism: starting at the original graph of the current morphism, a new morphism is created between both IMAGES such that the diagram commutes.
 boolean completeDiagram(OrdinaryMorphism input, OrdinaryMorphism output)
          Given an input morphism: starting at the original graph of this morphism and the output morphism between IMAGES of the input and this morphism.
 OrdinaryMorphism compose(OrdinaryMorphism input)
          Construct the composition of the owner-morphism and the input morphism.
 void copyAttrContext(AttrContext other)
           
protected  void deleteTransientContextVariables(Graph g)
           
 void disableUnusedAttrCondition()
          Disable an attr. condition a variable inside is not declared in the variable tuple of this morphism.
 void dispose()
          Remove all graph object mappings and all relations to its source and target graphs.
 void dispose(boolean disposableSource, boolean disposableTarget)
          Remove all graph object mappings and all relations to its source and target graphs.
 boolean doCompose(OrdinaryMorphism morph1, OrdinaryMorphism morph2)
          Construct the composition of the morph1 and morph2 morphisms, where its source graph is the source graph of the morph1 and its target graph is the target graph of the morph2.
 boolean doComposeInherit(OrdinaryMorphism morph1, OrdinaryMorphism morph2)
           
 void enableUnusedAttrCondition()
           
 void fillUpAttrContext(AttrContext other)
           
 void fillUpImageAttrs()
          Iff the value of an attribute member of the image graphobject is unset or is a variable, fill up the value of such attribute member with the value (it should be a constant value) of the same attribute member of the original graphobject.
 void fillUpOriginalAttrs()
          If the value of an attribute member of the original graphobject is unset or is a variable, fill up such attribute value with the value (it should be a constant value) of the same attribute member of the image graphobject.
 AttrContext getAttrContext()
          Return the attribute context that is used for attribute matching.
 AttrManager getAttrManager()
           
 java.util.Enumeration<GraphObject> getCodomain()
          Return the objects of my target graph which are actually taking part in the current morphism mappings.
 java.util.Vector<GraphObject> getCodomainObjects()
           
 OrdinaryMorphism getCoMorphism()
           
 MorphCompletionStrategy getCompletionStrategy()
           
 java.util.Enumeration<GraphObject> getDomain()
          Return the objects of my source graph which are actually taking part in the current morphism mappings.
 java.util.Vector<GraphObject> getDomainObjects()
           
 java.util.Vector<GraphObject> getElementsToCreate()
           
 java.util.Vector<GraphObject> getElementsToDelete()
           
 java.lang.String getErrorMsg()
          Return an error message if this morphism is failed, otherwise - empty message.
 Graph getImage()
          Return its target graph.
 GraphObject getImage(GraphObject o)
          Return the image of the specified object.
 java.util.Enumeration<GraphObject> getInverseImage(GraphObject o)
          Return an Enumeration of the inverse images of the specified object. * Enumeration will be empty when the object is not in codomain. * Enumeration elements are of type GraphObject.
 java.util.List<GraphObject> getInverseImageList(GraphObject o)
           
 java.lang.String getName()
          Return my name.
 Graph getOriginal()
          Return its source graph.
 java.util.Enumeration<Pair<OrdinaryMorphism,OrdinaryMorphism>> getOverlappings(java.lang.Object other, boolean left, boolean union)
          Computes an overlapping set of the graphs: - this.source with other.source if other instance of OrdinaryMorphism and left is true, or - this.target with other.target if other instance of OrdinaryMorphism and left is false, or - this.sorce with other if other instance of Graph and left is true, or - this.target with other if other instance of Graph and left is false, or with respect of the rules if this and other are instances of Rule.
 java.util.Enumeration<Pair<OrdinaryMorphism,OrdinaryMorphism>> getOverlappings(java.lang.Object other, boolean left, int sizeOfInclusions, boolean union)
          Computes an overlapping set of the graphs: - this.source with other.source if other instance of OrdinaryMorphism and left is true, or - this.target with other.target if other instance of OrdinaryMorphism and left is false, or - this.sorce with other if other instance of Graph and left is true, or - this.target with other if other instance of Graph and left is false, or with respect of the rules if this and other are instances of Rule.
 java.util.Vector<Pair<OrdinaryMorphism,OrdinaryMorphism>> getOverlappingsVector(java.lang.Object other, boolean left, boolean union)
           
 java.util.Vector<Pair<OrdinaryMorphism,OrdinaryMorphism>> getOverlappingsVector(java.lang.Object otherObj, boolean left, int sizeOfInclusions, boolean union)
           
 int getSize()
           
 Graph getSource()
          Return its source graph.
 Graph getTarget()
          Return its target graph.
 java.lang.String getTextualComment()
          Return textual comments of this morphism.
 java.util.Hashtable<VarMember,java.util.Vector<Pair<ValueMember,Type>>> getUsageOfInputParameters(AttrContext attrContext)
           
 java.util.Vector<Type> getUsedTypes()
           
 java.util.Vector<Pair<java.lang.String,java.lang.String>> getVariableDeclarations()
          Returns a vector with variable declarations used in LHS and RHS of this graph morphism.
 java.util.Enumeration<GraphObject> intersectCoDomains(OrdinaryMorphism input)
           
 OrdinaryMorphism invert()
          swop domain and range <--->, if possible
 boolean isBijective()
           
 java.lang.String isClassName(java.lang.String name)
           
 boolean isCommutative(Morphism anOther)
           
 boolean isEmpty()
          Return true if its morphism mapping is empty, otherwise - false.
 boolean isEnabled()
          Returns TRUE if this morphism is usable during transformation otherwise FALSE.
 boolean isInjective()
           
 boolean isIsomorphicTo(OrdinaryMorphism h)
           
 boolean isIsomorphicTo(OrdinaryMorphism h, OrdinaryMorphism targetIso)
           
 boolean isMappingChanged()
           
 boolean isNotificationRequired()
           
 boolean isPartial()
          Return true if this is a partial morphism.
 boolean isPartialIsomorphicTo(OrdinaryMorphism h)
           
 boolean isPartialMorphismCompletion()
           
 boolean isSurjective()
           
 boolean isTotal()
          Return true if this is a total morphism.
 boolean isTypeObjectsMapChanged()
           
 void makeAttributeContext()
           
 boolean makeDiagram(OrdinaryMorphism theFirst, OrdinaryMorphism theSecond)
          The current (this) morphism takes two morphisms, such that: this.source == theFirst.target, this.target == theSecond.target as input and this morphism will be completed so that: theFirst o this = theSecond .
 boolean makeDiagram(OrdinaryMorphism theFirst, OrdinaryMorphism theSecond, OrdinaryMorphism theThird)
          The current (this) morphism takes three morphisms, such that: this.source == theFirst.target, theSecond.source == theFirst.source, theThird.source == theSecond.target, this.target == theThird.target as input and this morphism will be completed so that the diagram comutes: theFirst o this == theSecond o theThird .
 boolean makeFullDiagram(OrdinaryMorphism theFirst, OrdinaryMorphism theSecond)
          makeFullDiagram: fuer DISAGG
Der vorliegende Homomorphismus (this) nimmt zwei weitere (theFirst, theSecond) als Input und wird selbst so vervollstaendigt, dass
theFirst o this = theSecond
 boolean makeFullDiagram(OrdinaryMorphism theFirst, OrdinaryMorphism theSecond, OrdinaryMorphism theThird)
          makeFullDiagram: fuer DISAGG
Der vorliegende Homomorphismus (this) nimmt drei weitere (theFirst, theSecond, theThird) als Input und wird selbst so vervollstaendigt, dass Diagramm kommutiert.
 Match makeMatch(Rule rule)
          Construct a Match of the specified Rule from this morphism .
 boolean makeWeakDiagram(OrdinaryMorphism theFirst, OrdinaryMorphism theSecond)
          makeWeakDiagram: fuer DISAGG
Der vorliegende Homomorphismus (this) nimmt zwei weitere (theFirst, theSecond) als Input und wird selbst so vervollstaendigt, dass
theFirst o this <= theSecond
 boolean makeWeakDiagram(OrdinaryMorphism theFirst, OrdinaryMorphism theSecond, OrdinaryMorphism theThird)
          makeWeakDiagram: fuer DISAGG
Der vorliegende Homomorphismus (this) nimmt drei weitere (theFirst, theSecond, theThird) als Input und wird selbst so vervollstaendigt, dass Diagramm schwach kommutiert.
 OrdinaryMorphism morphcopy()
          Make a copy of the source graph, copy of the target graph, and the homomorphism on both graphs.
 boolean nextCompletion()
          Compute next completion: * Invoke this method successively to get all completions.
 boolean nextCompletion(java.util.Enumeration<Node> varnodes, java.util.Enumeration<Arc> varedges)
          Compute next completion: * Invoke this method successively to get all completions for the nodes and edges specified by the Vector varnodes and Vector varedges, only.
 boolean nextCompletionWithConstantsAndVariablesChecking()
          Compute next completion: * Invoke this method successively to get all completions
 boolean nextCompletionWithConstantsAndVariablesChecking(java.util.Enumeration<Node> varnodes, java.util.Enumeration<Arc> varedges)
          Compute next completion: * Invoke this method successively to get all completions
 boolean nextCompletionWithConstantsChecking()
          Compute next completion: * Invoke this method successively to get all completions
 boolean nextCompletionWithConstantsChecking(java.util.Enumeration<Node> varnodes, java.util.Enumeration<Arc> varedges)
          Compute next completion: * Invoke this method successively to get all completions
 java.util.Enumeration<GraphObject> nonMappedImages()
           
 java.util.Enumeration<GraphObject> nonMappedOriginals()
           
protected  void propagateChange(Change ch)
           
 void readMorphism(XMLHelper h)
           
 void removeAllMappings()
           
protected  void removeAttrMapping(AttrInstance o)
           
 void removeAttrMappings()
           
 boolean removeMapping(Arc src, Arc tar)
          Returns TRUE if removed, otherwise - FALSE.
 void removeMapping(GraphObject o)
          Remove the mapping of a given GraphObject.
 boolean removeMapping(Node src, Node tar)
          Returns TRUE if removed, otherwise - FALSE
 void removeUnusedVariableOfAttrContext()
           
 void removeVariableValue(AttrInstance o)
           
 void resetCSPVariableDomainOf(GraphObject go)
          This method should be used after the method removeMapping(GraphObject go) called and befor the method nextCompletion(Enumeration varnodes, Enumeration varedges) performed.
 void setAttrContext(AttrContext ac)
          Set the attribute context that is used for attribute matching.
 void setChanged()
           
 void setCoMorphism(OrdinaryMorphism aCoMorph)
           
 void setCompletionStrategy(MorphCompletionStrategy s)
           
 void setCompletionStrategy(MorphCompletionStrategy s, boolean rewrite)
           
 void setEnabled(boolean enable)
          Enable or disable this morphism to make it usable during transformation.
 void setName(java.lang.String n)
          Set my name.
 void setPartialMorphismCompletion(boolean b)
           
 void setSource(Graph g)
           
 void setTarget(Graph g)
           
 void setTextualComment(java.lang.String text)
          Set textual comments for this morphism.
 void setTypeObjectsMapChanged(boolean b)
           
 OrdinaryMorphism simplecopy()
           
 void unsetCompletionStrategy()
           
 void unsetOriginalAttrsIfExpression()
          Iff the value of an attribute member of the original graphobject is an expression, unset it.
 void updateAttrMappings()
           
 void writeMorphism(XMLHelper h)
           
 
Methods inherited from class agg.util.ExtObservable
finalize
 
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

comment

protected java.lang.String comment

itsCompleter

protected MorphCompletionStrategy itsCompleter

itsAttrMappings

protected java.util.Dictionary<AttrInstance,AttrMapping> itsAttrMappings

itsAttrContext

protected AttrContext itsAttrContext

itsAttrManager

protected AttrManager itsAttrManager

itsTouchedFlag

protected boolean itsTouchedFlag

itsInteractiveFlag

protected boolean itsInteractiveFlag

itsOrig

protected Graph itsOrig

itsImag

protected Graph itsImag

itsDomObjects

protected final java.util.Vector<GraphObject> itsDomObjects

itsCodomObjects

protected final java.util.Vector<GraphObject> itsCodomObjects

itsName

protected java.lang.String itsName

itsCoMorph

protected OrdinaryMorphism itsCoMorph

errorMsg

protected java.lang.String errorMsg

errors

protected java.util.Vector<java.lang.String> errors

enabled

protected boolean enabled

typeObjectsMapChanged

protected boolean typeObjectsMapChanged

partialMorphCompletion

protected boolean partialMorphCompletion

cKeepContext

protected static final AttrContext cKeepContext
Use this constant as a parameter in my constructors or in the initialize() method to indicate that the attribute context in question should not be altered.


removeAttrMapping

protected boolean removeAttrMapping
Constructor Detail

OrdinaryMorphism

protected OrdinaryMorphism()

OrdinaryMorphism

protected OrdinaryMorphism(AttrContext ac)
Parameters:
ac - my attribute context.

OrdinaryMorphism

protected OrdinaryMorphism(Graph orig,
                           Graph img)
Parameters:
orig - my original graph.
img - my image graph.

OrdinaryMorphism

public OrdinaryMorphism(Graph orig,
                        Graph img,
                        AttrContext ac)
Parameters:
orig - my original graph.
img - my image graph.
ac - my attribute context.
Method Detail

isNotificationRequired

public boolean isNotificationRequired()

setTarget

public void setTarget(Graph g)

setSource

public void setSource(Graph g)

isTypeObjectsMapChanged

public boolean isTypeObjectsMapChanged()

setTypeObjectsMapChanged

public void setTypeObjectsMapChanged(boolean b)

isPartialMorphismCompletion

public boolean isPartialMorphismCompletion()

setPartialMorphismCompletion

public void setPartialMorphismCompletion(boolean b)

setEnabled

public void setEnabled(boolean enable)
Enable or disable this morphism to make it usable during transformation.


isEnabled

public boolean isEnabled()
Returns TRUE if this morphism is usable during transformation otherwise FALSE.


getErrorMsg

public java.lang.String getErrorMsg()
Return an error message if this morphism is failed, otherwise - empty message.


addErrorMsg

protected void addErrorMsg(java.lang.String msg)

clearErrorMsg

public void clearErrorMsg()

isCommutative

public final boolean isCommutative(Morphism anOther)

makeMatch

public Match makeMatch(Rule rule)
Construct a Match of the specified Rule from this morphism . The source graph is the LHS of the rule. The mapping of this morphism is used for the match mapping. Returns null when a BadMappingException occurred, otherwise true.


morphcopy

public OrdinaryMorphism morphcopy()
Make a copy of the source graph, copy of the target graph, and the homomorphism on both graphs. The result shall not posses far reaching references onto Rules, GraGras those kinds of objects.


makeDiagram

public boolean makeDiagram(OrdinaryMorphism theFirst,
                           OrdinaryMorphism theSecond)
The current (this) morphism takes two morphisms, such that: this.source == theFirst.target, this.target == theSecond.target as input and this morphism will be completed so that: theFirst o this = theSecond .


makeWeakDiagram

public boolean makeWeakDiagram(OrdinaryMorphism theFirst,
                               OrdinaryMorphism theSecond)
makeWeakDiagram: fuer DISAGG
Der vorliegende Homomorphismus (this) nimmt zwei weitere (theFirst, theSecond) als Input und wird selbst so vervollstaendigt, dass
theFirst o this <= theSecond


makeFullDiagram

public boolean makeFullDiagram(OrdinaryMorphism theFirst,
                               OrdinaryMorphism theSecond)
makeFullDiagram: fuer DISAGG
Der vorliegende Homomorphismus (this) nimmt zwei weitere (theFirst, theSecond) als Input und wird selbst so vervollstaendigt, dass
theFirst o this = theSecond


makeDiagram

public boolean makeDiagram(OrdinaryMorphism theFirst,
                           OrdinaryMorphism theSecond,
                           OrdinaryMorphism theThird)
The current (this) morphism takes three morphisms, such that: this.source == theFirst.target, theSecond.source == theFirst.source, theThird.source == theSecond.target, this.target == theThird.target as input and this morphism will be completed so that the diagram comutes: theFirst o this == theSecond o theThird .


makeWeakDiagram

public boolean makeWeakDiagram(OrdinaryMorphism theFirst,
                               OrdinaryMorphism theSecond,
                               OrdinaryMorphism theThird)
makeWeakDiagram: fuer DISAGG
Der vorliegende Homomorphismus (this) nimmt drei weitere (theFirst, theSecond, theThird) als Input und wird selbst so vervollstaendigt, dass Diagramm schwach kommutiert.


makeFullDiagram

public boolean makeFullDiagram(OrdinaryMorphism theFirst,
                               OrdinaryMorphism theSecond,
                               OrdinaryMorphism theThird)
makeFullDiagram: fuer DISAGG
Der vorliegende Homomorphismus (this) nimmt drei weitere (theFirst, theSecond, theThird) als Input und wird selbst so vervollstaendigt, dass Diagramm kommutiert.


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 ExtObservable
See Also:
Change_ObservableGone

dispose

public void dispose(boolean disposableSource,
                    boolean disposableTarget)
Remove all graph object mappings and all relations to its source and target graphs. Dispose its source graph if disposableSource is TRUE, dispose its target graph if disposableTarget is TRUE.


setName

public final void setName(java.lang.String n)
Description copied from interface: Morphism
Set my name.

Specified by:
setName in interface Morphism

getName

public final java.lang.String getName()
Description copied from interface: Morphism
Return my name.

Specified by:
getName in interface Morphism

setTextualComment

public void setTextualComment(java.lang.String text)
Set textual comments for this morphism.


getTextualComment

public java.lang.String getTextualComment()
Return textual comments of this morphism.


addMapping

public void addMapping(java.util.Vector<GraphObject> listOfGraphObjects)
                throws BadMappingException
This method tries to add morphism mapping between elements of my source graph and elements of the specified list. The elements of this list should be objects (nodes/edges) of my target graph. The order of the list has to be the order of the graph objects of my source graph. It is allowed to put null element into this list. A morphism mapping would be set for non-null elements only. As result a partial (total) graph morphism is done, if no errors occured.

Throws:
BadMappingException

checkCreateMapping

public TypeError checkCreateMapping(Node src,
                                    Node tar)
Returns an error if the type compatibility of the specified nodes failed, otherwise - null.


checkCreateMapping

public TypeError checkCreateMapping(Arc src,
                                    Arc tar)
Returns null if the source and target nodes of the specified edges are already mapped and the type compatibility of these two edges is satisfied, otherwise - an error.


addChild2ParentMapping

public void addChild2ParentMapping(GraphObject o,
                                   GraphObject i)
                            throws BadMappingException
Please note: This method is only for internal use of the critical pair analysis for grammars with node type inheritance. Do not use it for any kind of implementations.

Parameters:
o - is a child node
i - is a parent node
Throws:
BadMappingException

addMapping

public void addMapping(GraphObject o,
                       GraphObject i)
                throws BadMappingException
Map an object of source graph to an object of target graph. The original and image objects have to belong to the same morphism. *

Pre:

    *
  1. o is an element of getOriginal(). *
  2. i is an element of getImage(). *
*

Parameters:
o - the source object of the mapping. *
i - the target object of the mapping. *
Throws:
BadMappingException - if the given mapping violates morphism properties. *

addMapping

public void addMapping(GraphObject o,
                       GraphObject i,
                       boolean mappingPropagation)
                throws BadMappingException
Deprecated. please use addMapping(final GraphObject o, final GraphObject i)

Map an object of source graph to an object of target graph. The image object have not to belong to the same morphism, it will be create implicitly. *

Pre:

    *
  1. o is an element of getOriginal(). *
  2. i is an element of getImage(). *
*

Parameters:
o - the source object of the mapping. *
i - the target object of the mapping. *
Throws:
BadMappingException - if the given mapping violates morphism properties.

addPlainMapping

protected void addPlainMapping(GraphObject o,
                               GraphObject i)
                        throws BadMappingException
Throws:
BadMappingException

checkType

protected boolean checkType(Type orig,
                            Type image)

checkEdgeSourceTargetCompatibility

protected void checkEdgeSourceTargetCompatibility(GraphObject orig,
                                                  GraphObject image)
                                           throws BadMappingException
Throws:
BadMappingException

addAttrMapping

protected void addAttrMapping(AttrInstance o,
                              AttrInstance i)
                       throws BadMappingException
Throws:
BadMappingException

removeAttrMapping

protected void removeAttrMapping(AttrInstance o)

removeVariableValue

public void removeVariableValue(AttrInstance o)

updateAttrMappings

public void updateAttrMappings()

resetCSPVariableDomainOf

public void resetCSPVariableDomainOf(GraphObject go)
This method should be used after the method removeMapping(GraphObject go) called and befor the method nextCompletion(Enumeration varnodes, Enumeration varedges) performed.

Parameters:
go - is an element of my source graph

removeAllMappings

public void removeAllMappings()

removeMapping

public boolean removeMapping(Node src,
                             Node tar)
Returns TRUE if removed, otherwise - FALSE


removeMapping

public boolean removeMapping(Arc src,
                             Arc tar)
Returns TRUE if removed, otherwise - FALSE. Note: The source and target nodes of the specified src and tar edges still mapped. They should be removed explicitly.


removeMapping

public void removeMapping(GraphObject o)
Remove the mapping of a given GraphObject. Any mappings * of incoming or outgoing arcs will be removed as well.

Pre:

    Pre: getImage(o) != null *


clear

public void clear()
Remove all mappings and unset all variables of its attribute context.


removeAttrMappings

public void removeAttrMappings()

isEmpty

public boolean isEmpty()
Return true if its morphism mapping is empty, otherwise - false.


getOriginal

public Graph getOriginal()
Return its source graph.

Specified by:
getOriginal in interface Morphism

getSource

public Graph getSource()
Return its source graph.


getImage

public Graph getImage()
Return its target graph.

Specified by:
getImage in interface Morphism

getTarget

public Graph getTarget()
Return its target graph.


getDomainObjects

public java.util.Vector<GraphObject> getDomainObjects()

getDomain

public java.util.Enumeration<GraphObject> getDomain()
Return the objects of my source graph which are actually taking part in the current morphism mappings.

Specified by:
getDomain in interface Morphism
See Also:
GraphObject

getCodomain

public java.util.Enumeration<GraphObject> getCodomain()
Return the objects of my target graph which are actually taking part in the current morphism mappings.

Specified by:
getCodomain in interface Morphism
See Also:
GraphObject

getCodomainObjects

public java.util.Vector<GraphObject> getCodomainObjects()

getImage

public GraphObject getImage(GraphObject o)
Return the image of the specified object.

Specified by:
getImage in interface Morphism
Returns:
null if the object is not in domain.*

getInverseImage

public java.util.Enumeration<GraphObject> getInverseImage(GraphObject o)
Return an Enumeration of the inverse images of the specified object. * Enumeration will be empty when the object is not in codomain. * Enumeration elements are of type GraphObject.

Specified by:
getInverseImage in interface Morphism
See Also:
GraphObject

getInverseImageList

public java.util.List<GraphObject> getInverseImageList(GraphObject o)

getElementsToCreate

public java.util.Vector<GraphObject> getElementsToCreate()

getElementsToDelete

public java.util.Vector<GraphObject> getElementsToDelete()

setCompletionStrategy

public final void setCompletionStrategy(MorphCompletionStrategy s,
                                        boolean rewrite)

setCompletionStrategy

public final void setCompletionStrategy(MorphCompletionStrategy s)

getCompletionStrategy

public final MorphCompletionStrategy getCompletionStrategy()

unsetCompletionStrategy

public void unsetCompletionStrategy()

canMatch

public boolean canMatch(Graph g,
                        MorphCompletionStrategy strategy)
Return true if my source graph can be a subgraph of the given graph g basically. It can only work for INJECTIVE search.


canComplete

public boolean canComplete()
Return true if this morphism can be completed basically. It can only work for INJECTIVE search.


isMappingChanged

public boolean isMappingChanged()

nextCompletion

public boolean nextCompletion()
Compute next completion: * Invoke this method successively to get all completions.

Returns:
false if there are no more completions.*

nextCompletion

public boolean nextCompletion(java.util.Enumeration<Node> varnodes,
                              java.util.Enumeration<Arc> varedges)
Compute next completion: * Invoke this method successively to get all completions for the nodes and edges specified by the Vector varnodes and Vector varedges, only.

Returns:
false if there are no more completions.*

nextCompletionWithConstantsChecking

public boolean nextCompletionWithConstantsChecking(java.util.Enumeration<Node> varnodes,
                                                   java.util.Enumeration<Arc> varedges)
Compute next completion: * Invoke this method successively to get all completions. *

Returns:
false if there are no more completions.

nextCompletionWithConstantsAndVariablesChecking

public boolean nextCompletionWithConstantsAndVariablesChecking(java.util.Enumeration<Node> varnodes,
                                                               java.util.Enumeration<Arc> varedges)
Compute next completion: * Invoke this method successively to get all completions. *

Returns:
false if there are no more completions.

nextCompletionWithConstantsChecking

public boolean nextCompletionWithConstantsChecking()
Compute next completion: * Invoke this method successively to get all completions. *

Returns:
false if there are no more completions.

nextCompletionWithConstantsAndVariablesChecking

public boolean nextCompletionWithConstantsAndVariablesChecking()
Compute next completion: * Invoke this method successively to get all completions. *

Returns:
false if there are no more completions.

isTotal

public final boolean isTotal()
Return true if this is a total morphism.

Specified by:
isTotal in interface Morphism

getAttrContext

public AttrContext getAttrContext()
Return the attribute context that is used for attribute matching.

See Also:
AttrContext

setAttrContext

public void setAttrContext(AttrContext ac)
Set the attribute context that is used for attribute matching.

See Also:
AttrContext

adaptAttrContextValues

public void adaptAttrContextValues(AttrContext ac)

addToAttrContext

public void addToAttrContext(VarTuple vars)

addToAttrContext

public void addToAttrContext(CondTuple conds)

addToAttrContext

public void addToAttrContext(AttrContext ac)

getAttrManager

public final AttrManager getAttrManager()

setChanged

public void setChanged()
Overrides:
setChanged in class ExtObservable

writeMorphism

public void writeMorphism(XMLHelper h)

readMorphism

public void readMorphism(XMLHelper h)

invert

public OrdinaryMorphism invert()
swop domain and range <--->, if possible


simplecopy

public OrdinaryMorphism simplecopy()

isIsomorphicTo

public boolean isIsomorphicTo(OrdinaryMorphism h)

isIsomorphicTo

public boolean isIsomorphicTo(OrdinaryMorphism h,
                              OrdinaryMorphism targetIso)

isPartial

public boolean isPartial()
Return true if this is a partial morphism.


isPartialIsomorphicTo

public boolean isPartialIsomorphicTo(OrdinaryMorphism h)

isSurjective

public boolean isSurjective()

isInjective

public boolean isInjective()

isBijective

public boolean isBijective()

nonMappedOriginals

public java.util.Enumeration<GraphObject> nonMappedOriginals()

nonMappedImages

public java.util.Enumeration<GraphObject> nonMappedImages()

compose

public OrdinaryMorphism compose(OrdinaryMorphism input)
Construct the composition of the owner-morphism and the input morphism. The source of the output morphism is the source graph of the owner-morphism, the target of the output morphism is the target graph of the input morphism.


doCompose

public boolean doCompose(OrdinaryMorphism morph1,
                         OrdinaryMorphism morph2)
Construct the composition of the morph1 and morph2 morphisms, where its source graph is the source graph of the morph1 and its target graph is the target graph of the morph2. Returns true, if the source-target condition is satisfied, otherwise - false.


doComposeInherit

public boolean doComposeInherit(OrdinaryMorphism morph1,
                                OrdinaryMorphism morph2)

completeDiagram

public OrdinaryMorphism completeDiagram(OrdinaryMorphism input)
Given an input morphism: starting at the original graph of the current morphism, a new morphism is created between both IMAGES such that the diagram commutes. The input morphism is assumed to be injective.


completeDiagram

public boolean completeDiagram(OrdinaryMorphism input,
                               OrdinaryMorphism output)
Given an input morphism: starting at the original graph of this morphism and the output morphism between IMAGES of the input and this morphism. The output morphism will be completed such that the diagram commutes. When it is not possible value to return is false, otherwise true. The input morphism is assumed to be injective.


intersectCoDomains

public java.util.Enumeration<GraphObject> intersectCoDomains(OrdinaryMorphism input)

checkConstants

public boolean checkConstants()
Check if the constant value of the same attribute member * of the original and image graphobjects are equal.


checkVariables

public boolean checkVariables()
Check if the variable of the same attribute member * of the original and image graphobjects are equal.


checkAll

protected boolean checkAll()
Check if the setting of the same attribute member of the original and image graph objects are equal.


makeAttributeContext

public void makeAttributeContext()

fillUpOriginalAttrs

public void fillUpOriginalAttrs()
If the value of an attribute member of the original graphobject is unset or is a variable, fill up such attribute value with the value (it should be a constant value) of the same attribute member of the image graphobject.


fillUpImageAttrs

public void fillUpImageAttrs()
Iff the value of an attribute member of the image graphobject is unset or is a variable, fill up the value of such attribute member with the value (it should be a constant value) of the same attribute member of the original graphobject.


unsetOriginalAttrsIfExpression

public void unsetOriginalAttrsIfExpression()
Iff the value of an attribute member of the original graphobject is an expression, unset it.


fillUpAttrContext

public void fillUpAttrContext(AttrContext other)

copyAttrContext

public void copyAttrContext(AttrContext other)

getUsageOfInputParameters

public java.util.Hashtable<VarMember,java.util.Vector<Pair<ValueMember,Type>>> getUsageOfInputParameters(AttrContext attrContext)

getOverlappings

public java.util.Enumeration<Pair<OrdinaryMorphism,OrdinaryMorphism>> getOverlappings(java.lang.Object other,
                                                                                      boolean left,
                                                                                      boolean union)
Computes an overlapping set of the graphs: - this.source with other.source if other instance of OrdinaryMorphism and left is true, or - this.target with other.target if other instance of OrdinaryMorphism and left is false, or - this.sorce with other if other instance of Graph and left is true, or - this.target with other if other instance of Graph and left is false, or with respect of the rules if this and other are instances of Rule.

Parameters:
union - If true - the overlappings contain disjunion, too. Enumeration elements are of type Pair.
Returns:
A set of overlappings.

getOverlappingsVector

public java.util.Vector<Pair<OrdinaryMorphism,OrdinaryMorphism>> getOverlappingsVector(java.lang.Object other,
                                                                                       boolean left,
                                                                                       boolean union)

getOverlappings

public java.util.Enumeration<Pair<OrdinaryMorphism,OrdinaryMorphism>> getOverlappings(java.lang.Object other,
                                                                                      boolean left,
                                                                                      int sizeOfInclusions,
                                                                                      boolean union)
Computes an overlapping set of the graphs: - this.source with other.source if other instance of OrdinaryMorphism and left is true, or - this.target with other.target if other instance of OrdinaryMorphism and left is false, or - this.sorce with other if other instance of Graph and left is true, or - this.target with other if other instance of Graph and left is false, or with respect of the rules if this and other are instances of Rule.

Parameters:
sizeOfInclusions - The size of graph object inclusions.
union - If true - the overlappings contain disjunion, too. Enumeration elements are of type Pair.
Returns:
A set of overlappings.
See Also:
Pair

getOverlappingsVector

public java.util.Vector<Pair<OrdinaryMorphism,OrdinaryMorphism>> getOverlappingsVector(java.lang.Object otherObj,
                                                                                       boolean left,
                                                                                       int sizeOfInclusions,
                                                                                       boolean union)

setCoMorphism

public void setCoMorphism(OrdinaryMorphism aCoMorph)

getCoMorphism

public OrdinaryMorphism getCoMorphism()

deleteTransientContextVariables

protected void deleteTransientContextVariables(Graph g)

getSize

public int getSize()

compareTo

public boolean compareTo(OrdinaryMorphism morph)

getVariableDeclarations

public java.util.Vector<Pair<java.lang.String,java.lang.String>> getVariableDeclarations()
Returns a vector with variable declarations used in LHS and RHS of this graph morphism. An Element of the vector is a Pair.

See Also:
The first element is a type, the second element is a name of a variable declaration, both elements are of the type String.

isClassName

public java.lang.String isClassName(java.lang.String name)

getUsedTypes

public java.util.Vector<Type> getUsedTypes()

propagateChange

protected final void propagateChange(Change ch)

disableUnusedAttrCondition

public void disableUnusedAttrCondition()
Disable an attr. condition a variable inside is not declared in the variable tuple of this morphism.

Parameters:
attrContext -

enableUnusedAttrCondition

public void enableUnusedAttrCondition()

removeUnusedVariableOfAttrContext

public void removeUnusedVariableOfAttrContext()