agg.xt_basis
Class Graph

java.lang.Object
  extended by java.util.Observable
      extended by agg.util.ExtObservable
          extended by agg.xt_basis.Graph
All Implemented Interfaces:
Disposable, XMLObject, com.objectspace.jgl.UnaryFunction, java.io.Serializable, java.util.Observer
Direct Known Subclasses:
SubGraph, TypeGraph

public class Graph
extends ExtObservable
implements java.util.Observer, XMLObject, com.objectspace.jgl.UnaryFunction

This class extends simple graphs with the possibility to have arcs between nodes.

See Also:
Serialized Form

Field Summary
protected  boolean attributed
           
protected  boolean changed
           
protected  java.lang.String comment
           
protected  boolean completeGraph
          true, if this graph is a complete graph.
protected  java.lang.String info
           
protected  java.util.Vector<Arc> itsArcs
           
protected  AttrContext itsAttrContext
           
protected  AttrManager itsAttrManager
           
protected  java.lang.String itsName
           
protected  java.util.Vector<Node> itsNodes
           
protected  java.util.Hashtable<java.lang.String,java.util.List<GraphObject>> itsTypeObjectsMap
           
protected  TypeSet itsTypes
          object for creating types, checking types and holding the type graph
protected  java.util.List<OrdinaryMorphism> itsUsingMorphs
           
protected  java.lang.String kind
           
protected  java.util.List<java.util.Observer> observer
           
 
Fields inherited from interface com.objectspace.jgl.UnaryFunction
serialVersionUID
 
Constructor Summary
Graph()
          Creates an empty graph with an empty TypeSet.
Graph(boolean completeGraph)
          Creates an empty graph with an empty TypeSet.
Graph(TypeSet aTypeSet)
          Creates an empty graph with the specified TypeSet.
Graph(TypeSet aTypeSet, boolean completeGraph)
          Creates an empty graph with the specified TypeSet.
 
Method Summary
 void addArc(Arc a)
          Adds the specified edge to my edges.
 boolean addCopyOfGraph(Graph g, boolean disabledTypeGraphOnly)
          Tries to add a copy of the specified graph to my elements.
 void addNode(Node n)
          Adds the specified node to my nodes.
 void addObserver(java.util.Observer o)
           
 void addUsingMorph(OrdinaryMorphism m)
          Stores the specified morphism if it is its source or target graph.
 boolean areAnyAttributesOfArcsSet()
           
 boolean areAnyAttributesOfNodesSet()
           
 TypeError checkConnectValid(Type edgeType, Node source, Node target)
          Checks if the specified edge to create is allowed.
 TypeError checkCreateGraphObject(Type nodeType, int currentTypeGraphLevel)
          Returns en error if the type multiplicity check failed after a node of the specified type would be created, otherwise - null.
 TypeError checkCreateGraphObject(Type edgeType, Node source, Node target, int currentTypeGraphLevel)
          Returns en error if the type multiplicity check failed after an edge of the specified type would be created, otherwise - null.
protected  void checkIsomorphicInclusions(java.util.Vector<OrdinaryMorphism> inclusions)
           
 void clear()
          Delete all of my graph objects.
 boolean compareTo(Graph g)
           
 boolean contains(Graph g)
           
 boolean contains(Graph g, MorphCompletionStrategy mcs)
           
 Graph copy()
          Returns a flat copy (without references) of this graph.
 Graph copy(java.util.Hashtable<GraphObject,GraphObject> orig2copy)
          Makes a copy of this graph
 Graph copy(TypeSet types)
          Returns a copy of this graph using specified type set.
 Arc copyArc(Arc orig, Node src, Node tar)
          Creates a new Arc as a copy of the orig.
 Graph copyLight(TypeSet typeSet)
           
 Node copyNode(Node orig)
          Creates a new node as a copy of the specified orig.
 Arc createArc(Type type, Node src, Node tar)
          Creates and add a new Arc of the specified type, source and target nodes, which must be part of this graph.
 Node createNode(Node orig)
          Deprecated. use the method copyNode(Node orig)
 Node createNode(Type type)
          Creates and adds a new Node of the specified type.
 Type createType()
          Deprecated. moved to TypeSet
 void deleteObserver(java.util.Observer o)
           
 void destroyArc(Arc arc)
          Deletes the specified arc.
 void destroyArc(Arc arc, boolean checkFirst)
          Deletes the specified arc.
 void destroyArc(Arc arc, boolean checkFirst, boolean forceDestroy)
          Deletes the specified arc.
 void destroyNode(Node node)
          Deletes a Node.
 void destroyNode(Node node, boolean checkFirst)
          Deletes a Node.
 void destroyNode(Node node, boolean checkFirst, boolean forceDestroy)
          Deletes a Node.
 void destroyObject(GraphObject obj)
           
 boolean destroyObjectsOfType(Type t)
           
 java.util.Vector<java.lang.String> destroyObjectsOfTypes(java.util.Vector<Type> types)
           
 void destroyType(Type type)
          Deprecated. moved to TypeSet
 void dispose()
          Prepares this graph for garbage collection, so cut all connections to other objects and dispose all graph object contained.
 java.lang.Object execute(java.lang.Object obj)
          Deprecated. use copyNode(agg.xt_basis.Node) or copyArc(agg.xt_basis.Arc, agg.xt_basis.Node, agg.xt_basis.Node), this method cannot work properly in case a type graph is defined and in use.
protected  void fillTypeObjectsMap()
           
 void finalize()
           
 void forceDestroyObject(GraphObject obj)
           
 java.util.Vector<OrdinaryMorphism> generateAllSubgraphs(int sizeOfInclusions, boolean union, boolean withIsomorphic)
          Returns a set of OrdinaryMorphism, where the source graph is a subGraph and the target graph is this graph.
 java.util.Vector<OrdinaryMorphism> generateAllSubgraphsWithInclusionsOfSize(int i, java.util.Vector<GraphObject> itsGOSet, java.util.Vector<OrdinaryMorphism> inclusions, boolean withIsomorphic)
          Returns a set of OrdinaryMorphism, where the source graph is a subGraph and the target graph is this graph.
 java.util.Enumeration<Arc> getArcs()
          Iterate through my Arcs.
 java.util.Vector<Arc> getArcs(GraphObject src, GraphObject tar)
          Returns edges found between specified source and target objects.
 java.util.Vector<Arc> getArcs(Type t, GraphObject src, GraphObject tar)
          Iterate through my edges to find edges of the specified type between the specified source and target.
 int getArcsCount()
           
 java.util.List<Arc> getArcsList()
           
 AttrContext getAttrContext()
           
 AttrManager getAttrManager()
           
 java.util.Enumeration<GraphObject> getElements()
          Iterate through my nodes and arcs.
 java.util.Enumeration<GraphObject> getElementsOfType(GraphObject type)
          Iterate through my Nodes and Arcs * to find all elements of type with specified type.
 java.util.Enumeration<GraphObject> getElementsOfType(java.lang.String typeName)
          Iterate through my nodes and arcs to find all elements of type with specified typeName.
 java.util.Enumeration<GraphObject> getElementsOfType(Type type)
          Iterate through my nodes and arcs to find all elements of type with specified type.
 java.util.Enumeration<GraphObject> getElementsOfType(Type type, Type src, Type tar)
          Iterate through my arcs to find all elements of type with specified type, source and target.
 java.util.Vector<GraphObject> getElementsOfTypeAsVector(GraphObject type)
          Iterate through my Nodes and Arcs to find all elements of type with specified type.
 java.util.Vector<GraphObject> getElementsOfTypeAsVector(java.lang.String typeName)
          Iterate through my Nodes and Arcs to find all elements of type with specified typeName.
 java.util.Vector<GraphObject> getElementsOfTypeAsVector(Type type)
          Iterate through my Nodes and Arcs to find all elements of type with specified type.
 java.util.Vector<GraphObject> getElementsOfTypeAsVector(Type type, boolean withChildren)
           
 java.util.Vector<GraphObject> getElementsOfTypeAsVector(Type type, Type src, Type tar)
          Iterate through my edges to find all edges of the specified type.
 java.lang.String getHelpInfo()
           
 java.lang.String getHelpInfoAboutNAC()
           
 java.lang.String getHelpInfoAboutPAC()
           
 java.lang.String getHelpInfoAboutVariableEquality()
           
 int getIndexOf(GraphObject obj)
          Deprecated. use getIndexOfNode or getIndexOfArc
 int getIndexOfArc(GraphObject obj)
           
 int getIndexOfNode(GraphObject obj)
           
 OrdinaryMorphism getIsomorphicWith(Graph g)
          Tries to compute an isomorphic morphism of this graph into the specified graph g.
 java.util.Vector<OrdinaryMorphism> getIsomorphicWith(Graph g, boolean all)
          Tries to compute all isomorphic morphisms of this graph into the specified graph g.
 java.util.Vector<OrdinaryMorphism> getIsomorphicWith(Graph g, java.util.Hashtable<GraphObject,GraphObject> map)
          Tries to compute isomorphic morphisms of this graph into the specified graph.
 java.lang.String getKind()
          A kind is a role of a graph in a grammar, for exmpl.: a type graph - TG, a host graph - HOST, the left graph of a rule - LHS, the right graph of a rule - RHS, a NAC graph - NAC, a PAC graph - PAC and so on.
 java.lang.String getName()
           
 java.util.Enumeration<Node> getNodes()
           
 java.util.Vector<Node> getNodes(Type t)
          Returns nodes of the specified type.
 java.util.Vector<Node> getNodesByCompareType(Type t)
          Iterate through my nodes to find nodes with type equal to the specified type.
 java.util.Vector<Node> getNodesByParentType(Type t)
          Iterate through my nodes to find related nodes of the specified type.
 int getNodesCount()
           
 java.util.List<Node> getNodesList()
           
 java.util.List<java.util.Observer> getObservers()
           
 java.util.Enumeration<Pair<OrdinaryMorphism,OrdinaryMorphism>> getOverlappings(Graph g, boolean withIsomorphic)
          Computes an overlapping set without disjoint union.
 java.util.Enumeration<Pair<OrdinaryMorphism,OrdinaryMorphism>> getOverlappings(Graph g, boolean disjunion, boolean withIsomorphic)
          Computes an overlapping set.
 java.util.Enumeration<Pair<OrdinaryMorphism,OrdinaryMorphism>> getOverlappings(Graph g, int sizeOfInclusions, boolean withIsomorphic)
          Computes an overlapping set without the disjoint union.
 java.util.Enumeration<Pair<OrdinaryMorphism,OrdinaryMorphism>> getOverlappings(Graph g, int sizeOfInclusions, boolean disjunion, boolean withIsomorphic)
          Computes an overlapping set.
 java.util.Vector<java.util.Hashtable<GraphObject,GraphObject>> getPartialMorphismIntoSet(java.util.Vector<GraphObject> set)
          Tries to compute partial morphisms of this graph into the specified set of graph objects.
 java.util.Vector<VarMember> getSameVariablesOfAttributes()
           
 int getSize()
           
 int getSizeOfArcs()
          Deprecated. replaced by getArcsCount()
 int getSizeOfNodes()
          Deprecated. replaced by getNodesCount()
 java.lang.String getTextualComment()
          Return textual comments of this graph.
 java.util.Vector<java.lang.String> getTypeNamesOfGraphObjects()
          Returns type names of nodes and edges of this graph.
 java.util.Hashtable<java.lang.String,java.util.List<GraphObject>> getTypeObjectsMap()
          Returns object domains for used types.
 java.util.Enumeration<Type> getTypes()
          Deprecated. moved to TypeSet
 TypeSet getTypeSet()
          Returns its type set.
 java.util.Vector<Type> getUsedAndInheritedTypes()
           
 java.util.Vector<Type> getUsedTypes()
           
 java.util.Vector<java.lang.String> getVariableNamesOfAttributes()
           
 boolean glue(GraphObject keep, GraphObject glue)
          Tries to glue two graph objects.
 Graph graphcopy()
          The method returns a flat copy of the graph itself.
 Graph graphcopy(Graph g)
          Pre-condition: this graph has to be empty and has to use the same type set as the Graph g .
 Graph graphcopy(int n)
          Returns a flat copy of the graph itself.
 void graphDidChange()
           
 boolean isArc(Arc obj)
          Returns true if its arcs contain the specified arc.
protected  boolean isArcAttributeSet(java.util.Vector<GraphObject> storeOfFailedObjs)
           
 boolean isAttributed()
           
 boolean isCompleteGraph()
          Returns true, if this graph is a complete graph.
 boolean isElement(GraphObject obj)
          Returns true if it contains the specified graph object.
 boolean isEmpty()
           
 boolean isGraph(java.util.Vector<GraphObject> goSet)
          Returns true if the given set of graph objects represents a valid graph.
 boolean isIsomorphicTo(Graph g)
          Return an Enumeration of all of my subgraphs (not including myself). * Enumeration elements are of type SubGraph.
 boolean isNacGraph()
          return TRUE if this graph is a NAC graph
 boolean isNode(Node obj)
          Returns true if its nodes contain the specified node.
protected  boolean isNodeAttributeSet(java.util.Vector<GraphObject> storeOfFailedObjs)
           
 boolean isNotificationRequired()
           
 OrdinaryMorphism isomorphicCopy()
          Returns an isomorphism between this graph and its ad-hoc-created copy.
 OrdinaryMorphism isoToCopy()
          Deprecated. replaced by isomorphicCopy()
 OrdinaryMorphism isoToCopy(int n)
          Deprecated. replaced by isomorphicCopy()
 boolean isPacGraph()
          return TRUE if this graph is a PAC graph
 boolean isReadyForTransform()
          Returns false if not all attributes of its graph objects are set, otherwise - true.
 boolean isReadyForTransform(java.util.Vector<GraphObject> storeOfFailedObjs)
          Returns false if not all attributes of its graph objects are set, otherwise - true.
 boolean isTypeGraph()
          Returns true if this graph is used as a type graph.
 boolean isUsingType(GraphObject t)
          Returns true if this graph uses the specified type.
 boolean isUsingType(Type t)
           
 boolean isUsingVariable(VarMember v)
           
protected  Arc newArc(Type t, Node src, Node tar)
          Creates and adds a new arc.
protected  Node newNode(Type t)
          Creates and adds a new node.
 java.util.Enumeration<Pair<OrdinaryMorphism,OrdinaryMorphism>> overlapSet(Graph g, int memoNumber, boolean withIsomorphic)
          Computes all possible overlappings (withoutdisjoint union) of this and another graph g.
 java.util.Enumeration<Pair<OrdinaryMorphism,OrdinaryMorphism>> overlapSet(Graph g, int memoNumber, boolean union, boolean withIsomorphic)
          Compute all possible overlappings of this and another graph g.
 java.util.Enumeration<Pair<OrdinaryMorphism,OrdinaryMorphism>> overlapSet(Graph g, int sizeOfInclusions, int memoNumber, boolean union, boolean withIsomorphic)
          Computes possible overlappings with defined size of inclusions of this and another graph g.
protected  void propagateChange(Change ch)
           
protected  void removeArc(Arc a)
           
protected  void removeNode(Node n)
           
 boolean removeUsingMorph(OrdinaryMorphism m)
          Removes the specified morphism from stored morphisms.
 OrdinaryMorphism reverseIsomorphicCopy()
          Returns an isomorphism between ad-hoc-created copy and this graph.
 void setAttrContext(AttrContext context)
           
 void setCompleteGraph(boolean complete)
          A complete graph is not allowed to use variables in attributes of its node and edges.
 void setHelpInfo(java.lang.String str)
          The user of AGG APIs can set help info for his own purposes.
 void setKind(java.lang.String aKind)
          A kind is a role of a graph in a grammar, for exmpl.: a type graph - TG, a host graph - HOST, the left graph of a rule - LHS, the right graph of a rule - RHS, a NAC graph - NAC, a PAC graph - PAC and so on.
 void setNacGraph(boolean isNAC)
          Deprecated. not more needed, set already implicitely
 void setName(java.lang.String n)
           
 void setNotificationRequired(boolean b)
           
 void setObservers(java.util.List<?> o)
           
 void setPacGraph(boolean isPAC)
          Deprecated. not more needed, set already implicitely
 void setTextualComment(java.lang.String text)
          Set textual comments (description) of this graph.
 void setTypeSet(TypeSet types)
          Set the given type set to its type set.
protected  java.lang.String showArcs()
           
protected  java.lang.String showGraph()
           
protected  java.lang.String showNodes()
           
 java.lang.String toString()
           
 void unsetAttributeValueWhereVariable()
           
 void unsetCriticalObjects()
           
 void unsetTransientAttrValues()
           
 void update(java.util.Observable obs, java.lang.Object change)
           
 void updateTypeObjectsMap()
          Refreshs object domains for used types.
 void XreadObject(XMLHelper h)
          Implements the interface of XMLObject
 void XwriteObject(XMLHelper h)
          Implements the interface of XMLObject
 
Methods inherited from class agg.util.ExtObservable
setChanged
 
Methods inherited from class java.util.Observable
clearChanged, countObservers, deleteObservers, hasChanged, notifyObservers, notifyObservers
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

kind

protected java.lang.String kind

comment

protected java.lang.String comment

itsName

protected java.lang.String itsName

itsNodes

protected final java.util.Vector<Node> itsNodes

itsArcs

protected final java.util.Vector<Arc> itsArcs

itsUsingMorphs

protected final java.util.List<OrdinaryMorphism> itsUsingMorphs

itsAttrContext

protected AttrContext itsAttrContext

itsAttrManager

protected AttrManager itsAttrManager

observer

protected java.util.List<java.util.Observer> observer

itsTypes

protected TypeSet itsTypes
object for creating types, checking types and holding the type graph


itsTypeObjectsMap

protected final java.util.Hashtable<java.lang.String,java.util.List<GraphObject>> itsTypeObjectsMap

completeGraph

protected boolean completeGraph
true, if this graph is a complete graph. So it is not a sub graph or possible sub graph of another graph. (esp. the working graph).


attributed

protected boolean attributed

info

protected java.lang.String info

changed

protected boolean changed
Constructor Detail

Graph

public Graph()
Creates an empty graph with an empty TypeSet. Use Graph(boolean), to create a complete graph (a host graph).


Graph

public Graph(TypeSet aTypeSet)
Creates an empty graph with the specified TypeSet. Use Graph(TypeSet,boolean), to create a complete graph (a host graph).


Graph

public Graph(boolean completeGraph)
Creates an empty graph with an empty TypeSet.

Parameters:
completeGraph - true, to create a host graph

Graph

public Graph(TypeSet aTypeSet,
             boolean completeGraph)
Creates an empty graph with the specified TypeSet.

Parameters:
aTypeSet - the TypeSet to use
completeGraph - true, to create a host graph
Method Detail

addObserver

public void addObserver(java.util.Observer o)
Overrides:
addObserver in class java.util.Observable
See Also:
Observable.addObserver(java.util.Observer)

deleteObserver

public void deleteObserver(java.util.Observer o)
Overrides:
deleteObserver in class java.util.Observable
See Also:
Observable.deleteObserver(java.util.Observer)

getObservers

public java.util.List<java.util.Observer> getObservers()

setObservers

public void setObservers(java.util.List<?> o)

getKind

public java.lang.String getKind()
A kind is a role of a graph in a grammar, for exmpl.: a type graph - TG, a host graph - HOST, the left graph of a rule - LHS, the right graph of a rule - RHS, a NAC graph - NAC, a PAC graph - PAC and so on.

Returns:
the kind of this graph
See Also:
GraphKind

setKind

public void setKind(java.lang.String aKind)
A kind is a role of a graph in a grammar, for exmpl.: a type graph - TG, a host graph - HOST, the left graph of a rule - LHS, the right graph of a rule - RHS, a NAC graph - NAC, a PAC graph - PAC and so on.

See Also:
GraphKind

setNotificationRequired

public void setNotificationRequired(boolean b)

isNotificationRequired

public boolean isNotificationRequired()

setTypeSet

public void setTypeSet(TypeSet types)
Set the given type set to its type set.

Parameters:
types - a type set which contains all types already used in this graph. This won't be checked.

getTypeSet

public TypeSet getTypeSet()
Returns its type set.


addCopyOfGraph

public boolean addCopyOfGraph(Graph g,
                              boolean disabledTypeGraphOnly)
Tries to add a copy of the specified graph to my elements. The existing type graph should be disabled.

Parameters:
g -
Returns:
true if a copy was added, otherwise - false.

copyLight

public Graph copyLight(TypeSet typeSet)

copy

public Graph copy(TypeSet types)
Returns a copy of this graph using specified type set. The specified type set should be compatible to its type set.


copy

public Graph copy(java.util.Hashtable<GraphObject,GraphObject> orig2copy)
Makes a copy of this graph

Parameters:
orig2copy - the specified table is used to store pairs (original, copy), where an original is a node/edge of this graph and a copy is a copied node/edge of the graph copy.
Returns:
a copy of this graph or null if an error occurred

graphcopy

public Graph graphcopy(int n)
Returns a flat copy of the graph itself. The mappings of original nodes / arcs and copied nodes / arcs are stored in a Hashtable of the class CopyMemory. The method CopyMemory.REQUEST(n) returns an appropriate Hashtable.

Parameters:
n - can be 1 or 2.

graphcopy

public Graph graphcopy()
The method returns a flat copy of the graph itself.


copy

public Graph copy()
Returns a flat copy (without references) of this graph.


graphcopy

public Graph graphcopy(Graph g)
Pre-condition: this graph has to be empty and has to use the same type set as the Graph g .


dispose

public void dispose()
Prepares this graph for garbage collection, so cut all connections to other objects and dispose all graph object contained.

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

finalize

public void finalize()
Overrides:
finalize in class ExtObservable

update

public final void update(java.util.Observable obs,
                         java.lang.Object change)
Specified by:
update in interface java.util.Observer

setName

public final void setName(java.lang.String n)

getName

public final java.lang.String getName()

setHelpInfo

public void setHelpInfo(java.lang.String str)
The user of AGG APIs can set help info for his own purposes. He takes care of usage and unset this help info, too.

Parameters:
str - help info

getHelpInfo

public java.lang.String getHelpInfo()

getHelpInfoAboutVariableEquality

public java.lang.String getHelpInfoAboutVariableEquality()

getHelpInfoAboutPAC

public java.lang.String getHelpInfoAboutPAC()

getHelpInfoAboutNAC

public java.lang.String getHelpInfoAboutNAC()

setTextualComment

public void setTextualComment(java.lang.String text)
Set textual comments (description) of this graph. This description can be used in AGG GUI.


getTextualComment

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


createType

public final Type createType()
Deprecated. moved to TypeSet


destroyType

public void destroyType(Type type)
                 throws TypeException
Deprecated. moved to TypeSet

Throws:
TypeException

getTypes

public final java.util.Enumeration<Type> getTypes()
Deprecated. moved to TypeSet

See Also:
Type

getUsedTypes

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

getUsedAndInheritedTypes

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

addNode

public void addNode(Node n)
Adds the specified node to my nodes. The type of the specified node has to be in my type set.


removeNode

protected void removeNode(Node n)

addArc

public void addArc(Arc a)
Adds the specified edge to my edges. The type of the specified edge has to be in my type set.


removeArc

protected void removeArc(Arc a)

newNode

protected Node newNode(Type t)
                throws TypeException
Creates and adds a new node.

Throws:
TypeException

createNode

public Node createNode(Type type)
                throws TypeException
Creates and adds a new Node of the specified type.

Throws:
TypeException

createNode

public Node createNode(Node orig)
                throws TypeException
Deprecated. use the method copyNode(Node orig)

Throws:
TypeException

copyNode

public Node copyNode(Node orig)
              throws TypeException
Creates a new node as a copy of the specified orig. Only type and attributes are copied, the structural context (incoming/outgoing arcs) - is not.

Throws:
TypeException

destroyNode

public void destroyNode(Node node)
                 throws TypeException
Deletes a Node. Dangling arcs are deleted implicitly. The node is removed from this graph and from all morphism mappings using this node.

Throws:
TypeException - If this graph is a type graph, and there are nodes of this type node in one of other graphs, an exception is thrown.

destroyNode

public void destroyNode(Node node,
                        boolean checkFirst)
                 throws TypeException
Deletes a Node. Dangling arcs are deleted implicitly. The node is removed from this graph and from all morphism mappings using this node. If the specified parameter checkFirst is false, the arc is destroyed without any checks.

Throws:
TypeException - If this graph is a type graph, and there are nodes of this type node in one of other graphs, an exception is thrown.

destroyNode

public void destroyNode(Node node,
                        boolean checkFirst,
                        boolean forceDestroy)
                 throws TypeException
Deletes a Node. Dangling arcs are deleted implicitly. The node is removed from this graph and from all morphism mappings using this node. If the specified parameter checkFirst is false, the arc is destroyed without any checks.

Throws:
TypeException - If this graph is a type graph, and there are nodes of this type node in one of other graphs, an exception is thrown when forceDestroy is false, otherwise - does thrown any exception.

newArc

protected Arc newArc(Type t,
                     Node src,
                     Node tar)
              throws TypeException
Creates and adds a new arc.

Throws:
TypeException

createArc

public Arc createArc(Type type,
                     Node src,
                     Node tar)
              throws TypeException
Creates and add a new Arc of the specified type, source and target nodes, which must be part of this graph.

Throws:
TypeException

copyArc

public Arc copyArc(Arc orig,
                   Node src,
                   Node tar)
            throws TypeException
Creates a new Arc as a copy of the orig. Only its type and attributes are copied, the structural context (source, target) - is not. The specified source src and target tar objects must be a part of this graph, but this is not checked here.

Throws:
TypeException

destroyArc

public void destroyArc(Arc arc)
                throws TypeException
Deletes the specified arc. The arc will be removed from this graph and from all morphism mappings with this arc.

Throws:
TypeException - If this graph is a type graph, and there are arcs of this type arc in one of other graphs, an exception is thrown.

destroyArc

public void destroyArc(Arc arc,
                       boolean checkFirst)
                throws TypeException
Deletes the specified arc. The arc will be removed from this graph and from all morphism mappings with this arc. If the specified parameter checkFirst is false, the arc is destroyed without any checks.

Throws:
TypeException - If this graph is a type graph, and there are arcs of this type arc in one of other graphs, an exception is thrown.

destroyArc

public void destroyArc(Arc arc,
                       boolean checkFirst,
                       boolean forceDestroy)
                throws TypeException
Deletes the specified arc. The arc will be removed from this graph and from all morphism mappings with this arc. If the specified parameter checkFirst is false, the arc is destroyed without any checks.

Throws:
TypeException - If this graph is a type graph, and there are arcs of this type arc in one of other graphs, an exception is thrown when forceDestroy is false, otherwise - does thrown any exception.

destroyObject

public void destroyObject(GraphObject obj)
                   throws TypeException
Throws:
TypeException

forceDestroyObject

public void forceDestroyObject(GraphObject obj)
                        throws TypeException
Throws:
TypeException

destroyObjectsOfType

public boolean destroyObjectsOfType(Type t)

destroyObjectsOfTypes

public java.util.Vector<java.lang.String> destroyObjectsOfTypes(java.util.Vector<Type> types)

getNodes

public java.util.Enumeration<Node> getNodes()

getNodesList

public java.util.List<Node> getNodesList()

getNodesCount

public int getNodesCount()

getArcs

public java.util.Enumeration<Arc> getArcs()
Iterate through my Arcs.

See Also:
*

getArcsList

public java.util.List<Arc> getArcsList()

getArcsCount

public int getArcsCount()

getArcs

public java.util.Vector<Arc> getArcs(GraphObject src,
                                     GraphObject tar)
Returns edges found between specified source and target objects.


getNodes

public java.util.Vector<Node> getNodes(Type t)
Returns nodes of the specified type.


getNodesByParentType

public java.util.Vector<Node> getNodesByParentType(Type t)
Iterate through my nodes to find related nodes of the specified type.


getNodesByCompareType

public java.util.Vector<Node> getNodesByCompareType(Type t)
Iterate through my nodes to find nodes with type equal to the specified type.


getArcs

public java.util.Vector<Arc> getArcs(Type t,
                                     GraphObject src,
                                     GraphObject tar)
Iterate through my edges to find edges of the specified type between the specified source and target.


getTypeNamesOfGraphObjects

public java.util.Vector<java.lang.String> getTypeNamesOfGraphObjects()
Returns type names of nodes and edges of this graph. If a type is unnamed, returns "[UNNAMED_NODE]" or "[UNNAMED_EDGE]". The order of the type names is the order of the node and edges of this graph.


getIndexOf

public int getIndexOf(GraphObject obj)
Deprecated. use getIndexOfNode or getIndexOfArc


getIndexOfNode

public int getIndexOfNode(GraphObject obj)

getIndexOfArc

public int getIndexOfArc(GraphObject obj)

getElements

public java.util.Enumeration<GraphObject> getElements()
Iterate through my nodes and arcs.

See Also:
GraphObject

getElementsOfType

public java.util.Enumeration<GraphObject> getElementsOfType(java.lang.String typeName)
Iterate through my nodes and arcs to find all elements of type with specified typeName.

See Also:
GraphObject

getElementsOfTypeAsVector

public java.util.Vector<GraphObject> getElementsOfTypeAsVector(java.lang.String typeName)
Iterate through my Nodes and Arcs to find all elements of type with specified typeName.

See Also:
GraphObject

getElementsOfType

public java.util.Enumeration<GraphObject> getElementsOfType(Type type)
Iterate through my nodes and arcs to find all elements of type with specified type.

See Also:
GraphObject

getElementsOfTypeAsVector

public java.util.Vector<GraphObject> getElementsOfTypeAsVector(Type type)
Iterate through my Nodes and Arcs to find all elements of type with specified type.

See Also:
GraphObject

getElementsOfTypeAsVector

public java.util.Vector<GraphObject> getElementsOfTypeAsVector(Type type,
                                                               boolean withChildren)

getElementsOfType

public java.util.Enumeration<GraphObject> getElementsOfType(Type type,
                                                            Type src,
                                                            Type tar)
Iterate through my arcs to find all elements of type with specified type, source and target.

See Also:
GraphObject

getElementsOfTypeAsVector

public java.util.Vector<GraphObject> getElementsOfTypeAsVector(Type type,
                                                               Type src,
                                                               Type tar)
Iterate through my edges to find all edges of the specified type. For all these edges holds: the source is of the specified src type and the target is of the specified tar type.

See Also:
GraphObject

getElementsOfType

public java.util.Enumeration<GraphObject> getElementsOfType(GraphObject type)
Iterate through my Nodes and Arcs * to find all elements of type with specified type.

See Also:
GraphObject

getElementsOfTypeAsVector

public java.util.Vector<GraphObject> getElementsOfTypeAsVector(GraphObject type)
Iterate through my Nodes and Arcs to find all elements of type with specified type.

See Also:
GraphObject

setAttrContext

public void setAttrContext(AttrContext context)

getAttrContext

public AttrContext getAttrContext()

getAttrManager

public AttrManager getAttrManager()

propagateChange

protected void propagateChange(Change ch)

addUsingMorph

public void addUsingMorph(OrdinaryMorphism m)
Stores the specified morphism if it is its source or target graph.

Parameters:
m -

removeUsingMorph

public boolean removeUsingMorph(OrdinaryMorphism m)
Removes the specified morphism from stored morphisms.


isEmpty

public boolean isEmpty()

isElement

public boolean isElement(GraphObject obj)
Returns true if it contains the specified graph object.


isNode

public boolean isNode(Node obj)
Returns true if its nodes contain the specified node.


isArc

public boolean isArc(Arc obj)
Returns true if its arcs contain the specified arc.


isUsingType

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


isUsingType

public boolean isUsingType(Type t)

isUsingVariable

public boolean isUsingVariable(VarMember v)

clear

public void clear()
Delete all of my graph objects.

Post: isEmpty()*


glue

public boolean glue(GraphObject keep,
                    GraphObject glue)
Tries to glue two graph objects. The context of the graph object to keep will be extended by out- and in-edges of the glue object. The unset attributes of the keep object will get the attribute value of the glue object if it is a constant. At the end the glue object will be destroyed.


isReadyForTransform

public boolean isReadyForTransform()
Returns false if not all attributes of its graph objects are set, otherwise - true.


isNodeAttributeSet

protected boolean isNodeAttributeSet(java.util.Vector<GraphObject> storeOfFailedObjs)

isArcAttributeSet

protected boolean isArcAttributeSet(java.util.Vector<GraphObject> storeOfFailedObjs)

isReadyForTransform

public boolean isReadyForTransform(java.util.Vector<GraphObject> storeOfFailedObjs)
Returns false if not all attributes of its graph objects are set, otherwise - true. The specified Vector storeOfFailedObjs will contain nodes and edges which are not initialized completely.


isIsomorphicTo

public boolean isIsomorphicTo(Graph g)
Return an Enumeration of all of my subgraphs (not including myself). * Enumeration elements are of type SubGraph.

See Also:
*

getIsomorphicWith

public OrdinaryMorphism getIsomorphicWith(Graph g)
Tries to compute an isomorphic morphism of this graph into the specified graph g.

Parameters:
g - is target graph of the result morphism
Returns:
an isomorphic morphism or null.

getIsomorphicWith

public java.util.Vector<OrdinaryMorphism> getIsomorphicWith(Graph g,
                                                            java.util.Hashtable<GraphObject,GraphObject> map)
Tries to compute isomorphic morphisms of this graph into the specified graph.

Parameters:
g - the target graph of a morphism
map - contains morphism mappings : keys are elements of this graph, values are elements of the graph g.
Returns:
computed isomorphic morphisms or null

getIsomorphicWith

public java.util.Vector<OrdinaryMorphism> getIsomorphicWith(Graph g,
                                                            boolean all)
Tries to compute all isomorphic morphisms of this graph into the specified graph g.

Parameters:
g - is target graph of morphisms
all - is true - compute all possible isomorphic morphisms, otherwise - only first one.
Returns:
computed isomorphic morphisms or null

isomorphicCopy

public OrdinaryMorphism isomorphicCopy()
Returns an isomorphism between this graph and its ad-hoc-created copy.


isoToCopy

public OrdinaryMorphism isoToCopy(int n)
Deprecated. replaced by isomorphicCopy()

Returns an isomorphism between this graph and its ad-hoc-created copy.


isoToCopy

public OrdinaryMorphism isoToCopy()
Deprecated. replaced by isomorphicCopy()

Returns an isomorphism between this graph and its ad-hoc-created copy.


reverseIsomorphicCopy

public OrdinaryMorphism reverseIsomorphicCopy()
Returns an isomorphism between ad-hoc-created copy and this graph.


overlapSet

public java.util.Enumeration<Pair<OrdinaryMorphism,OrdinaryMorphism>> overlapSet(Graph g,
                                                                                 int memoNumber,
                                                                                 boolean withIsomorphic)
Computes all possible overlappings (withoutdisjoint union) of this and another graph g. The return value is an eneration of pairs of morphisms. Each pair consists of a morphism from me to the overlap graph and a morphism from the other graph to the overlap graph. The overlappings are not computed for graphs with variables as attributes.


overlapSet

public java.util.Enumeration<Pair<OrdinaryMorphism,OrdinaryMorphism>> overlapSet(Graph g,
                                                                                 int memoNumber,
                                                                                 boolean union,
                                                                                 boolean withIsomorphic)
Compute all possible overlappings of this and another graph g. The return value is an eneration of pairs of morphisms. Each pair consists of a morphism from me to the overlap graph and a morphism from the other graph to the overlap graph. The overlappings are computed for graphs with variables as attributes, too.


overlapSet

public java.util.Enumeration<Pair<OrdinaryMorphism,OrdinaryMorphism>> overlapSet(Graph g,
                                                                                 int sizeOfInclusions,
                                                                                 int memoNumber,
                                                                                 boolean union,
                                                                                 boolean withIsomorphic)
Computes possible overlappings with defined size of inclusions of this and another graph g. The return value is an eneration of pairs of morphisms. Each pair consists of a morphism from me to the overlap graph and a morphism from the other graph to the overlap graph. The overlappings are computed for graphs with variables as attributes, too.


getOverlappings

public java.util.Enumeration<Pair<OrdinaryMorphism,OrdinaryMorphism>> getOverlappings(Graph g,
                                                                                      boolean withIsomorphic)
Computes an overlapping set without disjoint union.

Parameters:
g - The graph to overlap with

getOverlappings

public java.util.Enumeration<Pair<OrdinaryMorphism,OrdinaryMorphism>> getOverlappings(Graph g,
                                                                                      boolean disjunion,
                                                                                      boolean withIsomorphic)
Computes an overlapping set.

Parameters:
g - The graph to overlap with
disjunion - true if disjoint union is wanted

getOverlappings

public java.util.Enumeration<Pair<OrdinaryMorphism,OrdinaryMorphism>> getOverlappings(Graph g,
                                                                                      int sizeOfInclusions,
                                                                                      boolean withIsomorphic)
Computes an overlapping set without the disjoint union.

Parameters:
g - The graph to overlap with

getOverlappings

public java.util.Enumeration<Pair<OrdinaryMorphism,OrdinaryMorphism>> getOverlappings(Graph g,
                                                                                      int sizeOfInclusions,
                                                                                      boolean disjunion,
                                                                                      boolean withIsomorphic)
Computes an overlapping set.

Parameters:
g - The graph to overlap with
disjunion - true if disjoint union is wanted

XwriteObject

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

Specified by:
XwriteObject in interface XMLObject

XreadObject

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

Specified by:
XreadObject in interface XMLObject

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

showGraph

protected java.lang.String showGraph()

showNodes

protected java.lang.String showNodes()

showArcs

protected java.lang.String showArcs()

generateAllSubgraphs

public java.util.Vector<OrdinaryMorphism> generateAllSubgraphs(int sizeOfInclusions,
                                                               boolean union,
                                                               boolean withIsomorphic)
Returns a set of OrdinaryMorphism, where the source graph is a subGraph and the target graph is this graph.


generateAllSubgraphsWithInclusionsOfSize

public java.util.Vector<OrdinaryMorphism> generateAllSubgraphsWithInclusionsOfSize(int i,
                                                                                   java.util.Vector<GraphObject> itsGOSet,
                                                                                   java.util.Vector<OrdinaryMorphism> inclusions,
                                                                                   boolean withIsomorphic)
Returns a set of OrdinaryMorphism, where the source graph is a subGraph and the target graph is this graph.


isGraph

public boolean isGraph(java.util.Vector<GraphObject> goSet)
Returns true if the given set of graph objects represents a valid graph.

Parameters:
goSet - a Vector of GraphObjects
See Also:
GraphObject, TypeSet.checkType(Graph)

isTypeGraph

public boolean isTypeGraph()
Returns true if this graph is used as a type graph. This works only if this graph is registered as type graph in its own TypeSet.


isAttributed

public boolean isAttributed()

areAnyAttributesOfNodesSet

public boolean areAnyAttributesOfNodesSet()

areAnyAttributesOfArcsSet

public boolean areAnyAttributesOfArcsSet()

isCompleteGraph

public boolean isCompleteGraph()
Returns true, if this graph is a complete graph. A complete graph is not allowed to use variables in attributes of its node and edges. The host graph of a gragra is always a complete graph.


setCompleteGraph

public void setCompleteGraph(boolean complete)
A complete graph is not allowed to use variables in attributes of its node and edges.


isNacGraph

public boolean isNacGraph()
return TRUE if this graph is a NAC graph


setNacGraph

public void setNacGraph(boolean isNAC)
Deprecated. not more needed, set already implicitely

mark the graph as a NAC graph


isPacGraph

public boolean isPacGraph()
return TRUE if this graph is a PAC graph


setPacGraph

public void setPacGraph(boolean isPAC)
Deprecated. not more needed, set already implicitely

mark the graph as a PAC graph


compareTo

public boolean compareTo(Graph g)

contains

public boolean contains(Graph g)

contains

public boolean contains(Graph g,
                        MorphCompletionStrategy mcs)

getSize

public int getSize()

getSizeOfNodes

public int getSizeOfNodes()
Deprecated. replaced by getNodesCount()


getSizeOfArcs

public int getSizeOfArcs()
Deprecated. replaced by getArcsCount()


checkIsomorphicInclusions

protected void checkIsomorphicInclusions(java.util.Vector<OrdinaryMorphism> inclusions)

checkConnectValid

public TypeError checkConnectValid(Type edgeType,
                                   Node source,
                                   Node target)
Checks if the specified edge to create is allowed.


checkCreateGraphObject

public TypeError checkCreateGraphObject(Type nodeType,
                                        int currentTypeGraphLevel)
Returns en error if the type multiplicity check failed after a node of the specified type would be created, otherwise - null.


checkCreateGraphObject

public TypeError checkCreateGraphObject(Type edgeType,
                                        Node source,
                                        Node target,
                                        int currentTypeGraphLevel)
Returns en error if the type multiplicity check failed after an edge of the specified type would be created, otherwise - null.


getVariableNamesOfAttributes

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

getSameVariablesOfAttributes

public java.util.Vector<VarMember> getSameVariablesOfAttributes()

execute

public final java.lang.Object execute(java.lang.Object obj)
Deprecated. use copyNode(agg.xt_basis.Node) or copyArc(agg.xt_basis.Arc, agg.xt_basis.Node, agg.xt_basis.Node), this method cannot work properly in case a type graph is defined and in use.

Specified by:
execute in interface com.objectspace.jgl.UnaryFunction

graphDidChange

public void graphDidChange()

unsetCriticalObjects

public void unsetCriticalObjects()

unsetTransientAttrValues

public void unsetTransientAttrValues()

unsetAttributeValueWhereVariable

public void unsetAttributeValueWhereVariable()

getPartialMorphismIntoSet

public java.util.Vector<java.util.Hashtable<GraphObject,GraphObject>> getPartialMorphismIntoSet(java.util.Vector<GraphObject> set)
Tries to compute partial morphisms of this graph into the specified set of graph objects.

Parameters:
set - is target of morphisms
Returns:
set of computed partial morphisms, where keys are objects of this graph, values - objects of the specified target set

getTypeObjectsMap

public java.util.Hashtable<java.lang.String,java.util.List<GraphObject>> getTypeObjectsMap()
Returns object domains for used types. The key of a node type is built by type.convertToKey(), the key of an arc type by srcNodeType.convertToKey()+type.convertToKey()+tarNodeType.convertToKey().


updateTypeObjectsMap

public void updateTypeObjectsMap()
Refreshs object domains for used types.


fillTypeObjectsMap

protected void fillTypeObjectsMap()