agg.xt_basis
Class BaseFactory

java.lang.Object
  extended by agg.xt_basis.BaseFactory

public class BaseFactory
extends java.lang.Object

A factory class for Graphs, Morphisms, Rules, Matches.


Field Summary
protected static BaseFactory theBaseFactory
           
 
Constructor Summary
BaseFactory()
           
 
Method Summary
 Graph cloneGraph(Graph graph)
          Returns a clone of the graph.
 Rule cloneRule(Rule rule)
          Returns a clone of the rule.
 Rule cloneRule(Rule rule, TypeSet types)
          Returns a clone of the rule using specified types.
 Pair<Rule,Pair<OrdinaryMorphism,OrdinaryMorphism>> constructIsomorphicRule(OrdinaryMorphism h)
          Construct a rule r out of the given morphism h.
 Pair<Rule,Pair<OrdinaryMorphism,OrdinaryMorphism>> constructIsomorphicRule(OrdinaryMorphism h, boolean replaceExpressionByVar, boolean replaceConstantByVar)
          Construct a rule r out of the given morphism h.
 Rule constructRule(OrdinaryMorphism h)
          Construct a new rule from the given morphism h.
 Rule constructRuleFromMorph(OrdinaryMorphism h)
          Construct a new rule from the given morphism h.
 AtomConstraint createAtomic(TypeSet types, java.lang.String name)
          Create an parent atomic to construct an atomic graph constraint.
 GraGra createGraGra()
          Create a new gragra with its own type set and a host graph inclusive.
 GraGra createGraGra(boolean withGraph)
          Create a new gragra with its own type set and a host graph optionally.
 Graph createGraph()
           
 Graph createGraph(TypeSet types)
           
 GraTra createGraTra()
          Create a new graphtransformation unit GraTra
 Match createMatch(Rule rule, Graph graph)
          Create an empty match morphism between the left side of the given rule and my start graph.
 Match createMatch(Rule rule, Graph graph, boolean implicit)
          Create an empty match between the left side of the given rule and a start graph.
 Match createMatch(Rule rule, Graph graph, boolean implicit, java.lang.String helpMarkOfVars)
          Create an empty match between the left side of the given rule and a start graph.
 OrdinaryMorphism createMatchfromMorph(OrdinaryMorphism base, AttrContext base_context)
           
 boolean createMatchfromMorph(OrdinaryMorphism baseMorph, OrdinaryMorphism targetMatch, AttrContext base_context)
           
 OrdinaryMorphism createMorphfromMorph(OrdinaryMorphism base, AttrContext base_context)
           
 OrdinaryMorphism createMorphism(Graph orig, Graph img)
          Create an ordinary morphism.
 OrdinaryMorphism createMorphism(Graph orig, Graph img, boolean implicit)
          Create an ordinary morphism.
 OrdinaryMorphism createMorphism(Graph orig, Graph img, boolean implicit, java.lang.String helpMarkOfVars)
          Create an ordinary morphism.
 TypeSet createTypeSet()
           
 VarMember declareVariable(AttrHandler attrHandler, java.lang.String typeName, java.lang.String name, VarTuple tuple)
           
 void declareVariable(Graph g, VarTuple tuple)
          Adds nondeclared variable of attributes to the specified variable tuple.
 void destroyGraGra(GraGra gg)
          Dispose the specified gragra and remove from the gragra list.
 void destroyGraph(Graph graph)
          Dispose the specified graph.
 void destroyMatch(OrdinaryMorphism match)
          Dispose the specified match morphism.
 void destroyMorphism(OrdinaryMorphism morph)
          Dispose the specified morphism.
 void extendAttrContextVariableByPrefix(Rule rule, java.lang.String prefix, java.lang.String oppositePrefix)
           
 OrdinaryMorphism extendGraphByGraph(Graph gToExtend, Graph g)
           
protected  OrdinaryMorphism extendLeftGraphByNAC(OrdinaryMorphism isoLeft, OrdinaryMorphism nac)
           
 Pair<OrdinaryMorphism,OrdinaryMorphism> extendLeftGraphByNAC(Rule r, OrdinaryMorphism nac)
           
 Pair<OrdinaryMorphism,OrdinaryMorphism> extendRightGraphByNAC(Rule r, OrdinaryMorphism nacL)
           
 int getCountOfGraGras()
           
 java.util.Enumeration<GraGra> getGraGras()
           
 Pair<Rule,Pair<OrdinaryMorphism,OrdinaryMorphism>> makeAbstractInverseRule(Rule r)
          Make abstract inverse rule : R -> L That means: - copy RHS to LHS of the result rule, - copy LHS to RHS of the result rule, - convert rule morphism, - replace attr. expression of RHS by variable, - attr. conditions will be ignored, - NACs will be ignored.
 Pair<Rule,Pair<OrdinaryMorphism,OrdinaryMorphism>> makeInverseRule(Rule r)
          Make abstract inverse rule : R -> L.
 Match makeMatch(Rule rule, OrdinaryMorphism morph)
          Makes a match for a rule and a morphism from the left hand side to a graph.
 Match makeMatch(Rule rule, OrdinaryMorphism morph, java.lang.String helpMarkOfVars)
          Makes a match for a rule and a morphism from the left hand side of a rule to the target graph of a morphism.
 void notify(GraGra gg)
           
 void removeGraGra(GraGra gg)
          Remove the specified gragra from the gragra list.
 void renameSimilarVariable(OrdinaryMorphism m1, OrdinaryMorphism m2)
          Rename variable in the attribute context of the OrdinaryMorphism m2, if a similar variable is already used in the attribute context of the OrdinaryMorphism m1.
 void renameSimilarVariable(Rule r1, Rule r2)
          Rename variable in the attribute context of the Rule r2, if a similar variable is already used in the attribute context of the Rule r1.
 void renameVariableOfCondition(CondTuple conds, java.lang.String from, java.lang.String to)
           
 void renameVariableOfExpression(ValueTuple value, java.lang.String from, java.lang.String to)
           
static BaseFactory theFactory()
           
 void trimAttrContextVariableByPrefix(Rule rule, java.lang.String prefix, java.lang.String oppositePrefix)
           
 void unsetAllTransientAttrValuesOfRule(Rule r)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

theBaseFactory

protected static BaseFactory theBaseFactory
Constructor Detail

BaseFactory

public BaseFactory()
Method Detail

theFactory

public static BaseFactory theFactory()

createGraGra

public GraGra createGraGra()
Create a new gragra with its own type set and a host graph inclusive.


createGraGra

public GraGra createGraGra(boolean withGraph)
Create a new gragra with its own type set and a host graph optionally.


destroyGraGra

public void destroyGraGra(GraGra gg)
Dispose the specified gragra and remove from the gragra list.


removeGraGra

public void removeGraGra(GraGra gg)
Remove the specified gragra from the gragra list.


getGraGras

public java.util.Enumeration<GraGra> getGraGras()

getCountOfGraGras

public int getCountOfGraGras()

notify

public void notify(GraGra gg)

createGraTra

public GraTra createGraTra()
Create a new graphtransformation unit GraTra


createGraph

public final Graph createGraph()

createGraph

public final Graph createGraph(TypeSet types)

createTypeSet

public final TypeSet createTypeSet()

destroyGraph

public final void destroyGraph(Graph graph)
Dispose the specified graph.


constructRuleFromMorph

public Rule constructRuleFromMorph(OrdinaryMorphism h)
Construct a new rule from the given morphism h. The left graph of the rule is the source graph and the right graph of the rule is the target graph of the morphism h, the object mappings are similar to the mappings of the morphism h, too.


constructIsomorphicRule

public Pair<Rule,Pair<OrdinaryMorphism,OrdinaryMorphism>> constructIsomorphicRule(OrdinaryMorphism h)
Construct a rule r out of the given morphism h. The left graph of the rule r is a graph isomorphic to the source graph of the morphism h, the right graph of the rule r is a graph isomorphic to the target graph of the morphism h, the object mappings are identical to the mappings of the morphism h. Returns a Pair with : the first element is the new rule, the second element is a Pair with two elements of OrdinaryMorphism: an isomorphic copy of the source graph of the morphism h and an somorphic copy of the target graph of the morphism h.


constructIsomorphicRule

public Pair<Rule,Pair<OrdinaryMorphism,OrdinaryMorphism>> constructIsomorphicRule(OrdinaryMorphism h,
                                                                                  boolean replaceExpressionByVar,
                                                                                  boolean replaceConstantByVar)
Construct a rule r out of the given morphism h. The left graph of the rule r is a graph isomorphic to the source graph of the morphism h, the right graph of the rule r is a graph isomorphic to the target graph of the morphism h, the object mappings are identical to the mappings of the morphism h. Returns a Pair with : the first element is the new rule, the second element is a Pair with two elements of OrdinaryMorphism: an isomorphic copy of the source graph of the morphism h and an somorphic copy of the target graph of the morphism h.


constructRule

public Rule constructRule(OrdinaryMorphism h)
Construct a new rule from the given morphism h. The left graph of the rule is a copy of the source graph and the right graph of the rule r is a copy of the target graph of the morphism h, the object mappings are similar to the mappings of the morphism h.


makeAbstractInverseRule

public Pair<Rule,Pair<OrdinaryMorphism,OrdinaryMorphism>> makeAbstractInverseRule(Rule r)
Make abstract inverse rule : R -> L That means: - copy RHS to LHS of the result rule, - copy LHS to RHS of the result rule, - convert rule morphism, - replace attr. expression of RHS by variable, - attr. conditions will be ignored, - NACs will be ignored. Note: the specified Rule r has to be injective, otherwise returns null. Returns a Pair where: - Rule is a new inverted rule, - first OrdinaryMorphism is an isocopy of LHS, - second OrdinaryMorphism is an isocopy of RHS of the original rule r.


makeInverseRule

public Pair<Rule,Pair<OrdinaryMorphism,OrdinaryMorphism>> makeInverseRule(Rule r)
Make abstract inverse rule : R -> L. That means: - copy RHS to LHS of the result rule, - copy LHS to RHS of the result rule, - convert rule morphism, - convert NACs, - replace attr. expression of RHS by variable, - convert attr. conditions . Note: the specified rule r has to be injective, otherwise returns null.


extendRightGraphByNAC

public Pair<OrdinaryMorphism,OrdinaryMorphism> extendRightGraphByNAC(Rule r,
                                                                     OrdinaryMorphism nacL)

extendLeftGraphByNAC

public Pair<OrdinaryMorphism,OrdinaryMorphism> extendLeftGraphByNAC(Rule r,
                                                                    OrdinaryMorphism nac)

extendLeftGraphByNAC

protected OrdinaryMorphism extendLeftGraphByNAC(OrdinaryMorphism isoLeft,
                                                OrdinaryMorphism nac)

unsetAllTransientAttrValuesOfRule

public void unsetAllTransientAttrValuesOfRule(Rule r)

cloneGraph

public Graph cloneGraph(Graph graph)
Returns a clone of the graph.


cloneRule

public Rule cloneRule(Rule rule)
Returns a clone of the rule.


cloneRule

public Rule cloneRule(Rule rule,
                      TypeSet types)
Returns a clone of the rule using specified types.


extendGraphByGraph

public OrdinaryMorphism extendGraphByGraph(Graph gToExtend,
                                           Graph g)
                                    throws java.lang.Exception
Throws:
java.lang.Exception

createAtomic

public final AtomConstraint createAtomic(TypeSet types,
                                         java.lang.String name)
Create an parent atomic to construct an atomic graph constraint.


createMorphism

public final OrdinaryMorphism createMorphism(Graph orig,
                                             Graph img)
Create an ordinary morphism.


createMorphism

public final OrdinaryMorphism createMorphism(Graph orig,
                                             Graph img,
                                             boolean implicit)
Create an ordinary morphism. The original or image graph objects can have unset attribute members. If implicit is TRUE a variable will be used as value of those attribute members.

Parameters:
orig - The original graph.
img - The image graph.
implicit - If true, all unset attributes of the target graph will get a variable as value.
Returns:
The new ordinary morphism.

createMorphism

public final OrdinaryMorphism createMorphism(Graph orig,
                                             Graph img,
                                             boolean implicit,
                                             java.lang.String helpMarkOfVars)
Create an ordinary morphism. The original or image graph objects can have unset attribute members. If implicit is TRUE a variable will be used as value of those attribute members.

Parameters:
orig - The original graph.
img - The image graph.
implicit - If true, all unset attributes of the target graph will get a variable as value.
helpMarkOfVars - The help name of the implicitly set variables.
Returns:
The new ordinary morphism.

declareVariable

public VarMember declareVariable(AttrHandler attrHandler,
                                 java.lang.String typeName,
                                 java.lang.String name,
                                 VarTuple tuple)

declareVariable

public void declareVariable(Graph g,
                            VarTuple tuple)
Adds nondeclared variable of attributes to the specified variable tuple.

Parameters:
g - graph which nodes and edges are searched for nondeclared variables
tuple - variable tuple to declare new variables

createMatchfromMorph

public final OrdinaryMorphism createMatchfromMorph(OrdinaryMorphism base,
                                                   AttrContext base_context)

createMatchfromMorph

public final boolean createMatchfromMorph(OrdinaryMorphism baseMorph,
                                          OrdinaryMorphism targetMatch,
                                          AttrContext base_context)

createMorphfromMorph

public final OrdinaryMorphism createMorphfromMorph(OrdinaryMorphism base,
                                                   AttrContext base_context)

destroyMorphism

public final void destroyMorphism(OrdinaryMorphism morph)
Dispose the specified morphism.


createMatch

public final Match createMatch(Rule rule,
                               Graph graph)
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.

Parameters:
rule - The rule.
graph - The graph.
Returns:
The new match.

createMatch

public final Match createMatch(Rule rule,
                               Graph graph,
                               boolean implicit)
Create an empty match between the left side of the given rule and a 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. The graph objects can have unset attribute members. If implicit is TRUE a variable will be used as value of those attribute members.

Parameters:
rule - The rule.
graph - The graph.
Returns:
The new match.

createMatch

public final Match createMatch(Rule rule,
                               Graph graph,
                               boolean implicit,
                               java.lang.String helpMarkOfVars)
Create an empty match between the left side of the given rule and a 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. The graph objects can have unset attribute members. If implicit is TRUE a variable will be used as value of those attribute members.

Parameters:
rule - The rule.
graph - The graph.
Returns:
The new match.

makeMatch

public Match makeMatch(Rule rule,
                       OrdinaryMorphism morph)
Makes a match for a rule and a morphism from the left hand side to a graph. The mapping of the morphism will be to a mapping of the match. The graph objects can have unset attribute members. A variable will be used as value of those attribute members.

Parameters:
rule - The rule.
morph - The morphism.
Returns:
The new match.

makeMatch

public Match makeMatch(Rule rule,
                       OrdinaryMorphism morph,
                       java.lang.String helpMarkOfVars)
Makes a match for a rule and a morphism from the left hand side of a rule to the target graph of a morphism. The mapping of the morphism will be to a mapping of the match. The graph objects can have unset attribute members. A variable will be used as value of those attribute members.

Parameters:
rule - The rule.
morph - The morphism.
Returns:
The new match.

destroyMatch

public final void destroyMatch(OrdinaryMorphism match)
Dispose the specified match morphism.


extendAttrContextVariableByPrefix

public void extendAttrContextVariableByPrefix(Rule rule,
                                              java.lang.String prefix,
                                              java.lang.String oppositePrefix)

trimAttrContextVariableByPrefix

public void trimAttrContextVariableByPrefix(Rule rule,
                                            java.lang.String prefix,
                                            java.lang.String oppositePrefix)

renameSimilarVariable

public void renameSimilarVariable(Rule r1,
                                  Rule r2)
Rename variable in the attribute context of the Rule r2, if a similar variable is already used in the attribute context of the Rule r1.


renameSimilarVariable

public void renameSimilarVariable(OrdinaryMorphism m1,
                                  OrdinaryMorphism m2)
Rename variable in the attribute context of the OrdinaryMorphism m2, if a similar variable is already used in the attribute context of the OrdinaryMorphism m1.


renameVariableOfCondition

public void renameVariableOfCondition(CondTuple conds,
                                      java.lang.String from,
                                      java.lang.String to)

renameVariableOfExpression

public void renameVariableOfExpression(ValueTuple value,
                                       java.lang.String from,
                                       java.lang.String to)