agg.xt_basis
Class GraGra

java.lang.Object
  extended by agg.xt_basis.GraGra
All Implemented Interfaces:
Disposable, XMLObject
Direct Known Subclasses:
SubGraGra

public class GraGra
extends java.lang.Object
implements Disposable, XMLObject

GraGra provides the functionality of a simple graph grammar, consisting of exactly one graph (the "host graph"), an arbitrary number of graph rules, and an arbitrary number of match morphisms from the rules into the start graph.

The implementation serves as a factory for Types, Rules and Matches.


Field Summary
protected  java.lang.String comment
           
protected  java.lang.String dirName
          Directory name for saving
protected  java.lang.String fileName
          File name for saving
protected  java.util.List<java.lang.String> gratraOptions
          The list of my transformation options (only option names)
protected  java.util.List<AtomConstraint> itsAtomics
          The set of my atomic graph constraints.
protected  java.util.List<Formula> itsConstraints
          The set of my constraints ( formulae ).
protected  Graph itsGraph
          My host graph.
protected  java.util.List<Graph> itsGraphs
           
protected  java.util.List<Match> itsMatches
          The set of my matches.
protected  java.lang.String itsName
           
protected  java.util.List<Pair<java.lang.String,java.util.List<java.lang.String>>> itsPackages
          The set of the used packages of the Java classes.
protected  java.util.List<Rule> itsRules
          The set of my rules.
protected  Graph itsStartGraph
          My start graph.
protected  java.util.List<Pair<java.util.Vector<Pair<java.lang.String,java.lang.String>>,java.lang.String>> ruleSequences
           
protected  MorphCompletionStrategy strategy
          Match completion strategy
protected  TypeSet typeSet
          My type set used in graphs and rules.
 
Constructor Summary
protected GraGra()
          Construct myself as an independent new graph grammar.
  GraGra(boolean withGraph)
          Construct myself as an independent new graph grammar.
  GraGra(Graph g)
          Constructs a graph grammar with the given graph as host graph.
  GraGra(TypeSet newTypeSet)
          Construct myself as an independent new graph grammar with a type set and/or type graph specified by the TypeSet newTypeSet
  GraGra(TypeSet newTypeSet, boolean withGraph)
          Construct myself as an independent new graph grammar.
 
Method Summary
 boolean addAtomic(AtomConstraint ac)
           
 boolean addConstraint(Formula f)
           
 boolean addGraph(Graph g)
           
 void addGraTraOption(java.lang.String opt)
           
 boolean addImportGraph(Graph g)
          Add a copy of the Graph g to the list of my (host) graphs.
 boolean addImportGraph(Graph g, boolean adapt)
          Add a copy of the Graph g to the list of my (host) graphs.
 boolean addImportRule(Rule r)
          Add a copy of the Rule r to the list of my rules.
 boolean addImportRule(Rule r, boolean adapt)
          Add a copy of the Rule r to the list of my rules.
 void addPackage(Pair<java.lang.String,java.util.List<java.lang.String>> p)
           
 boolean addRule(Rule r)
           
 boolean addRuleScheme(agg.xt_agt.RuleScheme rs)
          Development stage only.
 boolean adoptTypes(java.util.Enumeration<Type> types)
           
 boolean checkAtomics(boolean checkAtomicValidityOnly)
           
 java.lang.String checkEdgeTypeMultiplicity(Arc typeArc)
          Checks all graphs of this GraGra due to edge type multiplicity of the specified type Arc of the current type graph.
 boolean checkGraphConsistency(Graph g)
          Returns TRUE if the graph g satisfies all graph constraints of this graph grammar.
 boolean checkGraphConsistency(Graph g, java.util.List<Formula> constraints)
          Returns TRUE if the graph g satisfies the specified container with graph constraints of this graph grammar.
 boolean checkGraphConstraints(boolean validity)
          This method checks if all graph constraints (formulas) are valid and then when parameter validity is TRUE if the host graph is consistent.
 Pair<java.lang.Object,java.lang.String> checkInheritedAttributesValid()
           
 java.lang.String checkNodeTypeMultiplicity(Node typeNode)
          Checks all graphs of this GraGra due to node type multiplicity of the specified type Node of the current type graph.
 void clearRuleConstraints()
           
 void clearRuleConstraints(AtomConstraint ac)
           
 void clearRuleConstraints(Formula f)
           
 Graph cloneGraph()
          Create a copy of my host graph.
 Rule cloneRule(Rule r)
          Create a copy of the rule r.
 boolean compareConstraintsTo(GraGra gragra)
           
 boolean compareRulesTo(GraGra gragra, boolean checkLayer)
           
 boolean compareTo(GraGra gragra)
           
 boolean compareTo(GraGra gragra, boolean transOption)
           
 java.lang.String convertConstraints()
          Converts all constraints (formulas) to post application conditions for all rules.
 AtomConstraint createAtomic(java.lang.String name)
           
 Formula createConstraint(java.lang.String name)
           
 Match createMatch(Rule rule)
          Create an empty match morphism between the left side of the given rule and my start graph.
 Rule createRule()
          Create an empty rule.
 agg.xt_agt.RuleScheme createRuleScheme()
          Development stage only.
 Type createType()
          Create a new type for typing of GraphObjects.
 Type createType(boolean withAttributes)
          Create a new type for typing of GraphObjects.
 Graph createTypeGraph()
          Creates an empty type graph.
 void destroyAllAtomics()
           
 void destroyAllConstraints()
           
 void destroyAllGraphs()
          Destroy all my host graphs.
 void destroyAllMatches()
           
 void destroyAllRules()
           
 void destroyAtomic(AtomConstraint a)
           
 void destroyConstraint(Formula f)
           
 void destroyGraph(Graph g)
          Remove the specified graph from my host graphs and destroy it.
 java.util.Vector<java.lang.String> destroyGraphObjectsOfType(Type t, boolean fromTypeGraph)
           
 java.util.Vector<java.lang.String> destroyGraphObjectsOfTypeFromGraphConstraints(Type t)
           
 boolean destroyGraphObjectsOfTypeFromHostGraph(Type t)
           
 java.util.Vector<java.lang.String> destroyGraphObjectsOfTypeFromRules(Type t)
           
 java.util.Vector<java.lang.String> destroyGraphObjectsOfTypes(java.util.Vector<Type> ts, boolean fromTypeGraph)
           
 java.util.Vector<java.lang.String> destroyGraphObjectsOfTypesFromGraphConstraints(java.util.Vector<Type> ts)
           
 java.util.Vector<java.lang.String> destroyGraphObjectsOfTypesFromHostGraph(java.util.Vector<Type> ts)
           
 java.util.Vector<java.lang.String> destroyGraphObjectsOfTypesFromRules(java.util.Vector<Type> ts)
           
 void destroyMatch(Match match)
          Dispose the specified match.
 void destroyMatches(Graph g)
           
 void destroyRule(Rule rule)
          Dispose the specified rule.
 void destroyStartGraph()
           
 void destroyType(Type type)
          Dispose the specified type.
 void destroyTypeGraph()
          Dispose the type graph.
 void dismissRuleApplicability()
           
 void dispose()
          Prepare myself for garbage collection.
 Type doAttrTypesExist()
           
 void enableRuleLayer(int l, boolean enabled)
           
 void finalize()
           
 java.util.Vector<Rule> getApplicableRules(Graph g, MorphCompletionStrategy aStrategy)
          Returns applicable rules due to the specified host graph and morphism completion strategy.
 java.util.Vector<Rule> getApplicableRules(MorphCompletionStrategy aStrategy)
          Returns applicable rules due to the specified morphism completion strategy and current host graph.
 java.util.Enumeration<AtomConstraint> getAtomics()
          Iterate through all of my atomic graph constraints.
 java.lang.String getConsistencyErrorMsg()
           
 java.util.Enumeration<Formula> getConstraints()
          Iterate through all of my constraints (formulae).
 java.util.List<Formula> getConstraintsForLayer(int l)
          Returns constraints (formulae) for the specified layer.
 java.util.Vector<Formula> getConstraintsForPriority(int p)
          Returns constraints (formulae) for the specified rule priority.
 java.util.Vector<Formula> getConstraintsVec()
          Deprecated. replaced by getListOfConstraints()
 int getCountOfGraphs()
           
 java.lang.String getDirName()
          Gets the directory name for saving the gragra
 java.util.Vector<java.lang.String> getEnabledLayers()
           
 java.util.Vector<java.lang.String> getEnabledPriorities()
           
 java.util.List<Rule> getEnabledRules()
           
 java.lang.String getFileName()
          Gets the file name for saving the gragra
 java.util.List<Formula> getGlobalConstraints()
          Returns constraints (formulae) that should be satisfied for all layers of a layered grammar.
 Graph getGraph()
          Returns my current host graph.
 Graph getGraph(int indx)
          Returns a host graph on the specified index or null.
 Graph getGraph(java.lang.String name)
          Returns a host graph with the specified name.
 java.util.Enumeration<Graph> getGraphs()
          Deprecated. replaced by getListOfGraphs()
 java.util.Vector<Graph> getGraphsVec()
          Deprecated. replaced by getListOfGraphs()
 java.util.Vector<java.lang.String> getGraTraOptions()
           
 int getIndexOfGraph()
          Returns the index of my current host graph.
 java.util.Vector<java.lang.String> getLayers()
           
 int getLevelOfTypeGraphCheck()
          returns the level of type graph usage in the type set.
 java.util.List<Evaluable> getListOfAtomicObjects()
           
 java.util.List<AtomConstraint> getListOfAtomics()
          Returns a list of my atomic graph constraints.
 java.util.List<Formula> getListOfConstraints()
          Returns a list of my constraints (formulae).
 java.util.List<Rule> getListOfEnabledRules()
           
 java.util.List<Graph> getListOfGraphs()
          Returns a list of my host graphs.
 java.util.List<Rule> getListOfRules()
          Iterate through all of my rules.
 Match getMatch(Rule rule, Graph g)
          Iterate through all of the matches existing between the given rule and all graphs of this grammar.
 java.util.Enumeration<Match> getMatches(Rule rule)
          Iterate through all of the matches existing between the given rule and the start graph.
 MorphCompletionStrategy getMorphismCompletionStrategy()
           
 int getMultiplicityErrorKind()
           
 java.lang.String getName()
          Return my name.
 java.util.Vector<Rule> getNonInjectiveRules()
           
 java.util.Vector<Pair<java.lang.String,java.util.List<java.lang.String>>> getPackages()
           
 java.util.Vector<java.lang.String> getPriorities()
           
 Rule getRule(int ruleIndx)
           
 Rule getRule(java.lang.String name)
           
 java.util.Enumeration<Rule> getRules()
          Iterate through all of my rules.
 java.util.Vector<Pair<java.util.Vector<Pair<java.lang.String,java.lang.String>>,java.lang.String>> getRuleSequences()
          Returns the rule sequences.
 java.util.Vector<Rule> getRulesForLayer(int l)
           
 java.util.Vector<Rule> getRulesVec()
          Deprecated. replaced by getListOfRules()
 Graph getStartGraph()
          Return my start graph.
 java.lang.String getTextualComment()
          Return textual comments of this grammar.
 Graph getTypeGraph()
          Returns the type graph or null, if no type graph was created before.
 java.util.Enumeration<Type> getTypes()
          Iterate through all of the types that may be assigned to GraphObjects.
 TypeSet getTypeSet()
          returns the type manger used in this gragra and in all its graphs.
 boolean hasRuleChangedEvailability()
           
 boolean hasRuleChangedLayer()
           
 boolean hasRuleChangedPriority()
           
 boolean importGraph(Graph g)
          Reset my host graph by the Graph g.
 boolean importGraph(Graph g, boolean adapt)
          Reset my host graph by the Graph g.
 boolean importTypeGraph(Graph g, boolean rewrite)
          Adds the specified Graph g to the current type graph if it exists or to a new created type graph otherwise.
 boolean isElement(Graph g)
          Return true, if the specified Graph g is once of my host graphs, otherwise - false.
 boolean isElement(Rule r)
          Return true, if the Rule r is element of my rules otherwise - false.
 Pair<java.lang.Object,java.lang.String> isGraphConstraintReadyForTransform()
          Checks atomic graph constraints.
 boolean isGraphReadyForTransform()
           
 boolean isLayered()
           
 boolean isPriority()
           
 Pair<java.lang.Object,java.lang.String> isReadyToTransform()
          Checks the types, rules and graph constraints of this grammar.
 Pair<java.lang.Object,java.lang.String> isReadyToTransform(boolean prepareRuleInfo)
          Checks the types, rules and graph constraints of this grammar.
 boolean isRuleLayerEnabled(int l)
           
 boolean isUsingType(GraphObject t)
          Returns true if this gragra uses the specified type.
 void load(java.lang.String filename)
           
 void oneRuleHasChangedEvailability()
           
 void oneRuleHasChangedLayer()
           
 void oneRuleHasChangedPriority()
           
 void prepareRuleInfo()
          Prepares info about rule: does rule create, delete, change something.
 void read(java.lang.String filename)
           
 void refreshConstraintsForLayer()
           
 void refreshConstraintsForPriority()
           
 boolean removeAtomic(AtomConstraint ac)
           
 boolean removeGraph(Graph g)
          Remove the specified graph from my graphs.
 void removeGraTraOption(java.lang.String opt)
           
 void removePackage(Pair<java.lang.String,java.util.Vector<java.lang.String>> p)
           
 boolean removeRule(Rule r)
           
 void removeTypeGraph()
           
 boolean resetGraph()
          Reset my host graph by my start graph.
 boolean resetGraph(Graph g)
          Reset my host graph by the Graph g.
 boolean resetGraph(int atIndex, Graph g)
           
 boolean resetGraphWithoutGuarantee(Graph g)
          Reset my host graph by the Graph g without type guarantee.
 void save(java.lang.String filename)
           
 void setDirName(java.lang.String str)
          Sets the directory name for saving the gragra
 void setFileName(java.lang.String str)
          Sets the file name for saving the gragra
 void setGraTraOptions(MorphCompletionStrategy strat)
          Set morphism completion strategy by the specified strategy.
 void setGraTraOptions(java.util.Vector<java.lang.String> opts)
           
 java.util.Collection<TypeError> setLevelOfTypeGraphCheck(int level)
          changes the behavior of the type graph check and defines, how the type graph is used.
 void setMorphismCompletionStrategy(MorphCompletionStrategy strat)
          Set morphism completion strategy by the specified strategy.
 void setMorphismCompletionStrategyOfGraphConstraints()
           
 void setName(java.lang.String n)
          Set my name.
 void setPackages(java.util.Vector<Pair<java.lang.String,java.util.List<java.lang.String>>> n)
           
 void setRuleLayer(RuleLayer rl)
          Sets my rule layer
 void setRuleSequences(java.util.Vector<Pair<java.util.Vector<Pair<java.lang.String,java.lang.String>>,java.lang.String>> sequences)
          Set the rule sequences.
 void setStartGraph(Graph g)
          Sets my start graph to Graph g.
 void setTextualComment(java.lang.String text)
          Set textual comments for this grammar.
 void setUsedClassPackages()
           
 void sortConstraintsByLayer()
          Sort constraints (formulae) by layer.
 void sortConstraintsByPriority()
          Sort constraints (formulae) by priority.
 void sortRulesByLayer()
          Sort rules by layer.
 void sortRulesByPriority()
          Sort rules by rule priority.
 void storeUsedClassPackages()
           
 void unsetLayerTriggerRule()
           
 void XreadObject(XMLHelper h)
          reads the properties and values of all elements of this gragra from an element called <GraphTransformationSystem> in the XML file opened by the given XMLHelper.
 void XwriteObject(XMLHelper h)
          Save the properties and values of all elements of this gragra in an own element in the XML file saved by the given XMLHelper.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

itsGraphs

protected final transient java.util.List<Graph> itsGraphs

itsRules

protected final transient java.util.List<Rule> itsRules
The set of my rules. Elements are of type Rule.


itsAtomics

protected final transient java.util.List<AtomConstraint> itsAtomics
The set of my atomic graph constraints.


itsConstraints

protected final transient java.util.List<Formula> itsConstraints
The set of my constraints ( formulae ).


gratraOptions

protected final transient java.util.List<java.lang.String> gratraOptions
The list of my transformation options (only option names)


itsMatches

protected final transient java.util.List<Match> itsMatches
The set of my matches. Elements are of type Match.


ruleSequences

protected transient java.util.List<Pair<java.util.Vector<Pair<java.lang.String,java.lang.String>>,java.lang.String>> ruleSequences

itsPackages

protected final transient java.util.List<Pair<java.lang.String,java.util.List<java.lang.String>>> itsPackages
The set of the used packages of the Java classes. These classes might be used for attributing. The first element of a Pair is the name of an attribute handler, the second - a list of class names.


typeSet

protected transient TypeSet typeSet
My type set used in graphs and rules. It contains types of nodes and edges and evtl. a type graph.


itsGraph

protected transient Graph itsGraph
My host graph. It can be changed.


itsStartGraph

protected transient Graph itsStartGraph
My start graph. It cannot be changed. At the beginning the start is equal to the host graph. It will be used to reset my host graph.


itsName

protected transient java.lang.String itsName

comment

protected transient java.lang.String comment

strategy

protected transient MorphCompletionStrategy strategy
Match completion strategy


dirName

protected transient java.lang.String dirName
Directory name for saving


fileName

protected transient java.lang.String fileName
File name for saving

Constructor Detail

GraGra

protected GraGra()
Construct myself as an independent new graph grammar.


GraGra

public GraGra(boolean withGraph)
Construct myself as an independent new graph grammar.


GraGra

public GraGra(TypeSet newTypeSet)
Construct myself as an independent new graph grammar with a type set and/or type graph specified by the TypeSet newTypeSet


GraGra

public GraGra(TypeSet newTypeSet,
              boolean withGraph)
Construct myself as an independent new graph grammar.


GraGra

public GraGra(Graph g)
Constructs a graph grammar with the given graph as host graph.

Method Detail

getPackages

public java.util.Vector<Pair<java.lang.String,java.util.List<java.lang.String>>> getPackages()

setPackages

public void setPackages(java.util.Vector<Pair<java.lang.String,java.util.List<java.lang.String>>> n)

addPackage

public void addPackage(Pair<java.lang.String,java.util.List<java.lang.String>> p)

removePackage

public void removePackage(Pair<java.lang.String,java.util.Vector<java.lang.String>> p)

addGraph

public boolean addGraph(Graph g)

destroyGraph

public void destroyGraph(Graph g)
Remove the specified graph from my host graphs and destroy it. The current host graph and the specified graph have to be different.


destroyAllGraphs

public void destroyAllGraphs()
Destroy all my host graphs.


removeGraph

public boolean removeGraph(Graph g)
Remove the specified graph from my graphs. Return FALSE if the specified graph does not belong to my graphs. The current host graph and the specified graph have to be different.


isElement

public boolean isElement(Rule r)
Return true, if the Rule r is element of my rules otherwise - false.


isElement

public boolean isElement(Graph g)
Return true, if the specified Graph g is once of my host graphs, otherwise - false.


isPriority

public boolean isPriority()

isLayered

public boolean isLayered()

getLayers

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

getEnabledLayers

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

getPriorities

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

getEnabledPriorities

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

resetGraph

public boolean resetGraph(Graph g)
Reset my host graph by the Graph g. The types of the graph g have to be similar of my types.


resetGraph

public boolean resetGraph(int atIndex,
                          Graph g)

resetGraph

public boolean resetGraph()
Reset my host graph by my start graph.


resetGraphWithoutGuarantee

public boolean resetGraphWithoutGuarantee(Graph g)
Reset my host graph by the Graph g without type guarantee. The types of the graph g should be similar to my types.


importTypeGraph

public boolean importTypeGraph(Graph g,
                               boolean rewrite)
Adds the specified Graph g to the current type graph if it exists or to a new created type graph otherwise. The Graph g is a type graph, g.isTypeGraph() should return true. The type graph check should be disabled. The new node/edge types of the Graph g are added to the current types. The current type graph structure and the structure of the Graph g are united dis-jointly. Double occurrence of the nodes/arcs are possible and they have to be resolved manually by the user.


importGraph

public boolean importGraph(Graph g)
Reset my host graph by the Graph g. The types of the graph objects of the Graph g have to be similar to my types.


importGraph

public boolean importGraph(Graph g,
                           boolean adapt)
Reset my host graph by the Graph g. If the parameter adapt is true, the types of the Graph g are tried to be adapted to my types. The types with the same name are equal. Otherwise, the types of the Graph g should be found among my types.


addImportGraph

public boolean addImportGraph(Graph g)
Add a copy of the Graph g to the list of my (host) graphs. The types of the Graph g have to be similar to my types.


addImportGraph

public boolean addImportGraph(Graph g,
                              boolean adapt)
Add a copy of the Graph g to the list of my (host) graphs. If the parameter adapt is true, the types of the Graph g are tried to be adapted to my types. The types with the same name are equal. Otherwise, the types of the Graph g should be found among my types.


addImportRule

public boolean addImportRule(Rule r)
Add a copy of the Rule r to the list of my rules. The types of the Rule r have to be similar to my types.


addImportRule

public boolean addImportRule(Rule r,
                             boolean adapt)
Add a copy of the Rule r to the list of my rules. If the parameter adapt is true, the types of the Rule r are tried to be adapted to my types. The types with the same name are similar. Otherwise, the types of the Rule r should be found among my types.


adoptTypes

public boolean adoptTypes(java.util.Enumeration<Type> types)

dispose

public void dispose()
Description copied from interface: Disposable
Prepare myself for garbage collection.

Specified by:
dispose in interface Disposable

finalize

public void finalize()
Overrides:
finalize in class java.lang.Object

addRule

public boolean addRule(Rule r)

removeRule

public boolean removeRule(Rule r)

removeTypeGraph

public void removeTypeGraph()

setName

public final void setName(java.lang.String n)
Set my name.


getName

public final java.lang.String getName()
Return my name.


setTextualComment

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


getTextualComment

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


setDirName

public void setDirName(java.lang.String str)
Sets the directory name for saving the gragra


getDirName

public java.lang.String getDirName()
Gets the directory name for saving the gragra


setFileName

public void setFileName(java.lang.String str)
Sets the file name for saving the gragra


getFileName

public java.lang.String getFileName()
Gets the file name for saving the gragra


getGraph

public final Graph getGraph()
Returns my current host graph.


getIndexOfGraph

public int getIndexOfGraph()
Returns the index of my current host graph.


getGraph

public final Graph getGraph(java.lang.String name)
Returns a host graph with the specified name.


getGraph

public final Graph getGraph(int indx)
Returns a host graph on the specified index or null.


getGraphs

public final java.util.Enumeration<Graph> getGraphs()
Deprecated. replaced by getListOfGraphs()

Returns a collection of my host graphs.


getCountOfGraphs

public final int getCountOfGraphs()

getListOfGraphs

public final java.util.List<Graph> getListOfGraphs()
Returns a list of my host graphs.


getGraphsVec

public final java.util.Vector<Graph> getGraphsVec()
Deprecated. replaced by getListOfGraphs()

Returns a Vector of my host graphs.


getStartGraph

public final Graph getStartGraph()
Return my start graph. At the beginning the start graph is similar to my current host graph. In process the host graph will be changed, the start graph lieves unchanged.


setStartGraph

public void setStartGraph(Graph g)
Sets my start graph to Graph g. The type set of the graph g has to be similar to my host graph.


destroyStartGraph

public void destroyStartGraph()

getListOfRules

public final java.util.List<Rule> getListOfRules()
Iterate through all of my rules.

See Also:
Rule

getListOfEnabledRules

public java.util.List<Rule> getListOfEnabledRules()

oneRuleHasChangedLayer

public void oneRuleHasChangedLayer()

hasRuleChangedLayer

public boolean hasRuleChangedLayer()

oneRuleHasChangedPriority

public void oneRuleHasChangedPriority()

hasRuleChangedPriority

public boolean hasRuleChangedPriority()

oneRuleHasChangedEvailability

public void oneRuleHasChangedEvailability()

hasRuleChangedEvailability

public boolean hasRuleChangedEvailability()

getRules

public final java.util.Enumeration<Rule> getRules()
Iterate through all of my rules.

See Also:
Rule

getRulesVec

public final java.util.Vector<Rule> getRulesVec()
Deprecated. replaced by getListOfRules()


getRulesForLayer

public java.util.Vector<Rule> getRulesForLayer(int l)

enableRuleLayer

public void enableRuleLayer(int l,
                            boolean enabled)

isRuleLayerEnabled

public boolean isRuleLayerEnabled(int l)

getRule

public final Rule getRule(int ruleIndx)

getRule

public final Rule getRule(java.lang.String name)

getMorphismCompletionStrategy

public MorphCompletionStrategy getMorphismCompletionStrategy()

getListOfAtomicObjects

public final java.util.List<Evaluable> getListOfAtomicObjects()

getAtomics

public final java.util.Enumeration<AtomConstraint> getAtomics()
Iterate through all of my atomic graph constraints.

See Also:
AtomConstraint

getListOfAtomics

public final java.util.List<AtomConstraint> getListOfAtomics()
Returns a list of my atomic graph constraints.

See Also:
AtomConstraint

getListOfConstraints

public final java.util.List<Formula> getListOfConstraints()
Returns a list of my constraints (formulae).

See Also:
Formula

getConstraints

public final java.util.Enumeration<Formula> getConstraints()
Iterate through all of my constraints (formulae).

See Also:
Formula

getConstraintsVec

public final java.util.Vector<Formula> getConstraintsVec()
Deprecated. replaced by getListOfConstraints()

Returns all of my constraints (formulae).

See Also:
Formula

getGlobalConstraints

public java.util.List<Formula> getGlobalConstraints()
Returns constraints (formulae) that should be satisfied for all layers of a layered grammar. In case of a non-layered grammar it returns all its constraints. Vector elements are of type Formula.

See Also:
Formula

getConstraintsForLayer

public java.util.List<Formula> getConstraintsForLayer(int l)
Returns constraints (formulae) for the specified layer. Vector elements are of type Formula.

See Also:
Formula

getConstraintsForPriority

public java.util.Vector<Formula> getConstraintsForPriority(int p)
Returns constraints (formulae) for the specified rule priority. If p is -1, returns all constraints. Vector elements are of type Formula.

See Also:
Formula

refreshConstraintsForLayer

public void refreshConstraintsForLayer()

refreshConstraintsForPriority

public void refreshConstraintsForPriority()

createRule

public Rule createRule()
Create an empty rule.


createRuleScheme

public agg.xt_agt.RuleScheme createRuleScheme()
Development stage only.

Returns:
RuleScheme

addRuleScheme

public boolean addRuleScheme(agg.xt_agt.RuleScheme rs)
Development stage only.


sortRulesByPriority

public void sortRulesByPriority()
Sort rules by rule priority.


sortRulesByLayer

public void sortRulesByLayer()
Sort rules by layer.


sortConstraintsByLayer

public void sortConstraintsByLayer()
Sort constraints (formulae) by layer.


sortConstraintsByPriority

public void sortConstraintsByPriority()
Sort constraints (formulae) by priority.


cloneGraph

public Graph cloneGraph()
Create a copy of my host graph.


cloneRule

public Rule cloneRule(Rule r)
Create a copy of the rule r.


createAtomic

public AtomConstraint createAtomic(java.lang.String name)

addAtomic

public boolean addAtomic(AtomConstraint ac)

removeAtomic

public boolean removeAtomic(AtomConstraint ac)

createConstraint

public Formula createConstraint(java.lang.String name)

addConstraint

public boolean addConstraint(Formula f)

destroyTypeGraph

public void destroyTypeGraph()
Dispose the type graph.


destroyRule

public void destroyRule(Rule rule)
Dispose the specified rule.


destroyAllRules

public void destroyAllRules()

destroyAtomic

public void destroyAtomic(AtomConstraint a)

destroyAllAtomics

public void destroyAllAtomics()

destroyConstraint

public void destroyConstraint(Formula f)

destroyAllConstraints

public void destroyAllConstraints()

destroyGraphObjectsOfType

public java.util.Vector<java.lang.String> destroyGraphObjectsOfType(Type t,
                                                                    boolean fromTypeGraph)

destroyGraphObjectsOfTypes

public java.util.Vector<java.lang.String> destroyGraphObjectsOfTypes(java.util.Vector<Type> ts,
                                                                     boolean fromTypeGraph)

destroyGraphObjectsOfTypeFromHostGraph

public boolean destroyGraphObjectsOfTypeFromHostGraph(Type t)

destroyGraphObjectsOfTypesFromHostGraph

public java.util.Vector<java.lang.String> destroyGraphObjectsOfTypesFromHostGraph(java.util.Vector<Type> ts)

destroyGraphObjectsOfTypeFromRules

public java.util.Vector<java.lang.String> destroyGraphObjectsOfTypeFromRules(Type t)

destroyGraphObjectsOfTypesFromRules

public java.util.Vector<java.lang.String> destroyGraphObjectsOfTypesFromRules(java.util.Vector<Type> ts)

destroyGraphObjectsOfTypeFromGraphConstraints

public java.util.Vector<java.lang.String> destroyGraphObjectsOfTypeFromGraphConstraints(Type t)

destroyGraphObjectsOfTypesFromGraphConstraints

public java.util.Vector<java.lang.String> destroyGraphObjectsOfTypesFromGraphConstraints(java.util.Vector<Type> ts)

getMatches

public final java.util.Enumeration<Match> getMatches(Rule rule)
Iterate through all of the matches existing between the given rule and the start graph. Enumeration elements are of type Match.

See Also:
Match

getMatch

public final Match getMatch(Rule rule,
                            Graph g)
Iterate through all of the matches existing between the given rule and all graphs of this grammar. Returns the match for the specified rule and graph if such is found, otherwise null.


createMatch

public Match createMatch(Rule rule)
Create an empty match morphism between the left side of the given rule and my start graph. Note that this does not yield a valid match (unless the left side of the given rule is empty), because matches have to be total morphisms.


destroyMatch

public void destroyMatch(Match match)
Dispose the specified match.


destroyMatches

public void destroyMatches(Graph g)

destroyAllMatches

public void destroyAllMatches()

createTypeGraph

public Graph createTypeGraph()
Creates an empty type graph. If a type graph was already defined, it will be lost.


getTypeGraph

public Graph getTypeGraph()
Returns the type graph or null, if no type graph was created before.


createType

public Type createType()
Create a new type for typing of GraphObjects. Using the TypeSet for creating a new type. *


createType

public Type createType(boolean withAttributes)
Create a new type for typing of GraphObjects. Using the TypeSet for creating a new type. *


isUsingType

public boolean isUsingType(GraphObject t)
Returns true if this gragra uses the specified type.


getTypeSet

public TypeSet getTypeSet()
returns the type manger used in this gragra and in all its graphs.


getTypes

public java.util.Enumeration<Type> getTypes()
Iterate through all of the types that may be assigned to GraphObjects. Enumeration elements are of type Type.

See Also:
Type

destroyType

public void destroyType(Type type)
                 throws TypeException
Dispose the specified type.

Throws:
TypeException

setLevelOfTypeGraphCheck

public java.util.Collection<TypeError> setLevelOfTypeGraphCheck(int level)
changes the behavior of the type graph check and defines, how the type graph is used. The host graph must satisfies the new level, so it is checked first. If the host graph satisfies the constraints, an empty collection will be returned and a collection of TypeError if there were problems during the test.

Parameters:
level - } *
TypeSet.DISABLED The type graph will be ignored, so all graphs can contain objects with types undefined in the type graph. Multiplicity will be also ignored.
TypeSet.ENABLED The type graph will be basicaly used, so all graphs can only contain objects with types defined in the type graph. But the multiplicity will not be checked.
TypeSet.ENABLED_MAX The type graph will be basicaly used, so all graphs can only contain objects with types defined in the type graph. Multiplicities in all graphs should satisfy the defined maximum constraints.
TypeSet.ENABLED_MAX_MIN The type graph will be used, so all graphs can only contain objects with types defined in the type graph. Multiplicities in all graphs must satisfy the defined maximum constraints and the host graph must

getLevelOfTypeGraphCheck

public int getLevelOfTypeGraphCheck()
returns the level of type graph usage in the type set.

Returns:
TypeSet.DISABLED The type graph will be ignored, so all graphs can contain objects with types undefined in the type graph. Multiplicity will be also ignored.
TypeSet.ENABLED The type graph will be basicaly used, so all graphs can only contain objects with types defined in the type graph. But the multiplicity will not be checked.
TypeSet.ENABLED_MAX The type graph will be basicaly used, so all graphs can only contain objects with types defined in the type graph. Multiplicities in all graphs should satisfy the defined maximum constraints.
TypeSet.ENABLED_MAX_MIN The type graph will be used, so all graphs can only contain objects with types defined in the type graph. Multiplicities in all graphs must satisfy the defined maximum constraints and the hosting graph must

setMorphismCompletionStrategyOfGraphConstraints

public void setMorphismCompletionStrategyOfGraphConstraints()

checkNodeTypeMultiplicity

public java.lang.String checkNodeTypeMultiplicity(Node typeNode)
Checks all graphs of this GraGra due to node type multiplicity of the specified type Node of the current type graph.

Parameters:
typeNode -
Returns:
null if all graphs satisfy multiplicity constraint, otherwise - a string with names of failed graphs

checkEdgeTypeMultiplicity

public java.lang.String checkEdgeTypeMultiplicity(Arc typeArc)
Checks all graphs of this GraGra due to edge type multiplicity of the specified type Arc of the current type graph.

Parameters:
typeArc -
Returns:
null if all graphs satisfy multiplicity constraint, otherwise - a string with names of failed graphs

getMultiplicityErrorKind

public int getMultiplicityErrorKind()

checkGraphConstraints

public boolean checkGraphConstraints(boolean validity)
This method checks if all graph constraints (formulas) are valid and then when parameter validity is TRUE if the host graph is consistent.


checkGraphConsistency

public boolean checkGraphConsistency(Graph g)
Returns TRUE if the graph g satisfies all graph constraints of this graph grammar. Pre-condition: The graph constraints have to be valid and the graph g is a graph of the graph set defined with this grammar.


checkGraphConsistency

public boolean checkGraphConsistency(Graph g,
                                     java.util.List<Formula> constraints)
Returns TRUE if the graph g satisfies the specified container with graph constraints of this graph grammar. If the parameter constraints is null, all constraints of this grammar should be satisfied. Pre-condition: The graph constraints have to be valid and the graph g is a graph of the graph set defined with this grammar.


checkAtomics

public boolean checkAtomics(boolean checkAtomicValidityOnly)

getConsistencyErrorMsg

public java.lang.String getConsistencyErrorMsg()

convertConstraints

public java.lang.String convertConstraints()
Converts all constraints (formulas) to post application conditions for all rules. Returns empty message if all atomic graph constraints are valid and converting for each rule was successful, otherwise - error message.


clearRuleConstraints

public void clearRuleConstraints(AtomConstraint ac)

clearRuleConstraints

public void clearRuleConstraints(Formula f)

clearRuleConstraints

public void clearRuleConstraints()

setRuleLayer

public void setRuleLayer(RuleLayer rl)
Sets my rule layer


unsetLayerTriggerRule

public void unsetLayerTriggerRule()

getGraTraOptions

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

setGraTraOptions

public void setGraTraOptions(java.util.Vector<java.lang.String> opts)

addGraTraOption

public void addGraTraOption(java.lang.String opt)

removeGraTraOption

public void removeGraTraOption(java.lang.String opt)

setMorphismCompletionStrategy

public void setMorphismCompletionStrategy(MorphCompletionStrategy strat)
Set morphism completion strategy by the specified strategy.


setGraTraOptions

public void setGraTraOptions(MorphCompletionStrategy strat)
Set morphism completion strategy by the specified strategy.


compareTo

public boolean compareTo(GraGra gragra,
                         boolean transOption)

compareTo

public boolean compareTo(GraGra gragra)

compareRulesTo

public boolean compareRulesTo(GraGra gragra,
                              boolean checkLayer)

compareConstraintsTo

public boolean compareConstraintsTo(GraGra gragra)

getNonInjectiveRules

public java.util.Vector<Rule> getNonInjectiveRules()

isGraphReadyForTransform

public boolean isGraphReadyForTransform()

prepareRuleInfo

public void prepareRuleInfo()
Prepares info about rule: does rule create, delete, change something.


isReadyToTransform

public Pair<java.lang.Object,java.lang.String> isReadyToTransform(boolean prepareRuleInfo)
Checks the types, rules and graph constraints of this grammar. Prepares infos of rules if prepareRuleInfo is true.

Returns:
Pair object or null. A Pair object contains the failed element of the grammar. This element is the Pair.first object which can be of type agg.xt_basis.Type, agg.xt_basis.Rule or agg.cons.AtomConstraint. The second object is a message of type String which is a text about failed object.

isReadyToTransform

public Pair<java.lang.Object,java.lang.String> isReadyToTransform()
Checks the types, rules and graph constraints of this grammar.

Returns:
Pair object or null. A Pair object contains the failed element of the grammar. This element is the Pair.first object which can be of type agg.xt_basis.Type, agg.xt_basis.Rule or agg.cons.AtomConstraint. The second object is a message of type String which is a text about failed object.

isGraphConstraintReadyForTransform

public Pair<java.lang.Object,java.lang.String> isGraphConstraintReadyForTransform()
Checks atomic graph constraints.

Returns:
The first failed agg.cons.AtomConstraint object or null, if all graph constraints were OK.

doAttrTypesExist

public Type doAttrTypesExist()

checkInheritedAttributesValid

public Pair<java.lang.Object,java.lang.String> checkInheritedAttributesValid()

getEnabledRules

public java.util.List<Rule> getEnabledRules()

getApplicableRules

public java.util.Vector<Rule> getApplicableRules(MorphCompletionStrategy aStrategy)
Returns applicable rules due to the specified morphism completion strategy and current host graph.


getApplicableRules

public java.util.Vector<Rule> getApplicableRules(Graph g,
                                                 MorphCompletionStrategy aStrategy)
Returns applicable rules due to the specified host graph and morphism completion strategy.


dismissRuleApplicability

public void dismissRuleApplicability()

storeUsedClassPackages

public void storeUsedClassPackages()

setUsedClassPackages

public void setUsedClassPackages()

setRuleSequences

public void setRuleSequences(java.util.Vector<Pair<java.util.Vector<Pair<java.lang.String,java.lang.String>>,java.lang.String>> sequences)
Set the rule sequences. The first Vector element of a Pair is a rule subsequence. The first String element of a Pair is a rule name. The second element of a Pair represents the iteration count of a rule subsequence or of an individual rule. The value for the iteration count may be "*" or a decimal. The rule sequences can be used for graph transformation.


getRuleSequences

public java.util.Vector<Pair<java.util.Vector<Pair<java.lang.String,java.lang.String>>,java.lang.String>> getRuleSequences()
Returns the rule sequences. The first Vector element of a Pair is a rule subsequence. The first String element of a Pair is a rule name. The second element of a Pair represents the iteration count of a rule subsequence or of an individual rule. The value for the iteration count may be "*" or a decimal.


save

public void save(java.lang.String filename)

load

public void load(java.lang.String filename)
          throws java.lang.Exception
Throws:
java.lang.Exception

read

public void read(java.lang.String filename)
          throws java.lang.Exception
Throws:
java.lang.Exception

XwriteObject

public void XwriteObject(XMLHelper h)
Save the properties and values of all elements of this gragra in an own element in the XML file saved by the given XMLHelper.

Specified by:
XwriteObject in interface XMLObject
Parameters:
h - an XMLHelper, without an open element for this gragra.
See Also:
saveXML(agg.util.XMLHelper)

XreadObject

public void XreadObject(XMLHelper h)
reads the properties and values of all elements of this gragra from an element called <GraphTransformationSystem> in the XML file opened by the given XMLHelper.

Specified by:
XreadObject in interface XMLObject
Parameters:
h - an XMLHelper, with an not yet opened element for this gragra.
See Also:
loadXML(agg.util.XMLHelper)