agg.xt_basis
Class TypeSet

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

public class TypeSet
extends java.lang.Object

Manages the types of a set of graphs. Especially the graphs in the rules and the host graph of a gratra should use the same set. The type sets for nodes and edges, the type graph and the relation between them will be managed here. Also the methods to check if some graphs, rules, ... are valid typed are implemented here.


Field Summary
static int DISABLED
          Level of type graph check to disable type graph
static int ENABLED
          Level of type graph check to enable type graph and no multiplicity
static int ENABLED_INHERITANCE
          Level of type graph check to enable inheritance relation only
static int ENABLED_MAX
          Level of type graph check to enable type graph and max multiplicity
static int ENABLED_MAX_MIN
          Level of type graph check to enable type graph and max and min multiplicity
static int ENABLED_MIN
          Level of type graph check to enable type graph and min multiplicity
protected  java.lang.String info
           
static int UNDEFINED
          Value for unknown level of type graph check
 
Constructor Summary
TypeSet()
          creates a new type manager. with no types defined and no type graph given.
 
Method Summary
 void adaptTypes(java.util.Enumeration<Type> otherTypes, boolean all)
          Deprecated. please use adaptTypes(TypeSet otherTypes, boolean all)
 void adaptTypes(TypeSet otherTypes, boolean all)
          If the parameter all is true, then a copy of each type of the otherTypes will be created, otherwise only of the not found types.
 TypeError addInheritanceRelation(Type child, Type parent)
          To use this method, a type graph must to be created before.
 Type addType(Type aType)
          Adds the given type to this type manager.
 TypeError addTypeGraphObject(GraphObject newObject)
          checks this new graph object in the type graph.
 Arc addValidInheritanceRelation(Type child, Type parent)
          To use this method, a type graph must to be created and the method checkInheritanceValidity(Type child, Type parent) must be called before.
 Type adoptClan(Type aType)
           
 Type adoptType(Type t)
          Creates a new type that is similar to the specified Type t.
 boolean canRemoveTypeGraphArc(Arc a)
           
 boolean canRemoveTypeGraphNode(Node n)
           
 TypeError checkCreateGraphObject(Graph g, Type nodeType, int currentTypeGraphLevel)
          Returns an error object if the type multiplicity check failed after a node of the specified type created, otherwise - null.
 TypeError checkCreateGraphObject(Graph g, Type edgeType, Node source, Node target, int currentTypeGraphLevel)
          Returns an error object if the type multiplicity check failed after an edge of the specified type created, otherwise - null.
 TypeError checkEdgeTypeMultiplicity(Arc typearc, Graph graph, int currentTypeGraphLevel)
          Checks edge type multiplicity of the specified Arc of the edges of the specified Graph.
 TypeError checkIfEdgeCreatable(Type type, Node src, Node tar)
           
 TypeError checkIfRemovable(Arc arc)
          returns, if the given edge could be removed from its actual graph.
 TypeError checkIfRemovable(Node node)
          returns, if the given node could be removed from its actual graph.
 TypeError checkIfRemovableFromSource(Arc arc)
          returns, if the given arc could be removed from its actual graph.
 TypeError checkIfRemovableFromTarget(Arc arc)
          returns, if the given arc could be removed from its actual graph.
 TypeError checkInheritanceValid(Type child, Type parent)
          Deprecated. replaced by checkInheritanceValidity(Type, Type)
 TypeError checkInheritanceValidity(Type child, Type parent)
          Returns an error in the following cases: parent already exists, reflexive or cyclic inheritance, double attribute names when multiple inheritance used, otherwise - null.
 TypeError checkNodeTypeMultiplicity(Type nodeType, Graph graph, int currentTypeGraphLevel)
          Checks node type multiplicity of the specified node Type of the nodes of the specified Graph.
 TypeError checkType(Arc arc, boolean isComplete)
          checks the given arc, if it is valid typed.
 java.util.Collection<TypeError> checkType(AtomConstraint atomic)
          checks the given atomic, if it is valid typed.
 java.util.Collection<TypeError> checkType(Graph graph)
          checks the given graph, if it is valid typed.
 java.util.Collection<TypeError> checkType(Graph graph, int typeGraphCheckLevel)
          checks the given graph, if it is valid typed.
 TypeError checkType(GraphObject object)
          checks the given graph object, if it is valid typed.
 TypeError checkType(Node node, boolean isComplete)
          checks the given node, if it is valid typed.
 java.util.Collection<TypeError> checkType(OrdinaryMorphism morphism)
          checks the given morphism, if it is valid typed.
 java.util.Collection<TypeError> checkType(Rule rule)
          checks the given rule, if it is valid typed.
 java.util.Collection<TypeError> checkTypeGraph()
          Checks the type graph.
 TypeError checkTypeMaxMultiplicity(Graph graph, int typeGraphCheckLevel)
           
 void clearTypeGraph()
          Remove all nodes and arcs and inheritance relations of the type graph.
 boolean compareTo(TypeSet ts)
           
 boolean compareTypes(TypeSet ts)
          Compare my types with the types of the specified TypeSet ts.
 boolean compareTypes(TypeSet ts, java.util.Vector<Type> differentAttribute, java.util.Vector<Type> differentInheritance, java.util.Vector<Type> differentMultiplicity)
          Compare my types with the types of the specified TypeSet ts.
 boolean contains(TypeSet ts)
           
 boolean containsType(Type type)
          Returns true if the given type is managed by this object.
 Type createType()
           
 Type createType(boolean withAttributes)
           
 Graph createTypeGraph()
          Creates an empty type graph.
 void destroyType(Type type)
          Dispose the specified type.
 void destroyTypeGraph()
           
 void disableTypeGraphCheck()
          Deprecated. use setLevelOfTypeGraphCheck(int)
 void dispose()
           
 java.util.Collection<TypeError> enableTypeGraphCheck()
          Deprecated. use setLevelOfTypeGraphCheck(int)
 Graph extendTypeGraph()
          Creates a new type graph, if it does not already exist.
 void finalize()
           
 TypeError forceRemoveTypeGraphObject(GraphObject tgo)
           
 Graph generateMinimalTypeGraph()
          This method does only work when a type graph does not exists or it is empty, otherwise returns existing type graph.
 AttrManager getAttrManager()
          Returns the AttrManager used to create attributed types
 java.util.Vector<Type> getClan(Type t)
          Returns all child node types of the given node type.
 java.lang.String getHelpInfo()
           
 java.util.Vector<Arc> getInheritanceArcs()
          Returns a set of inheritance edges.
 Type getInheritanceType()
           
 java.util.Vector<Arc> getInheritedArcs(Type parentType)
          Returns a set with all edges to inherit from the specified parent type.
 int getLevelOfTypeGraphCheck()
          returns the level of type graph usage.
 int getMaxMultiplicity(Type type)
           
 int getMaxSourceMultiplicity(Type type, Type srctype, Type tartype)
           
 int getMaxTargetMultiplicity(Type type, Type srctype, Type tartype)
           
 int getMinMultiplicity(Type type)
           
 int getMinSourceMultiplicity(Type type, Type srctype, Type tartype)
           
 int getMinTargetMultiplicity(Type type, Type srctype, Type tartype)
           
 Type getSimilarType(Type t)
          Returns a type which is similar to the specified type: the type names, the graphical representation such as color, node shape of node type or edge style of edge type, the number of attributes, the name and type of attribute member should be equal, otherwise returns null.
 Type getTypeByName(java.lang.String name)
          Returns a type with the specified name if it is found, otherwise null Here the graphical represantation of a node or edge type is not taken in account.
 Type getTypeByNameAndAdditionalRepr(java.lang.String name, java.lang.String addRepr)
          Returns a type with the specified name and additional graphical representation if it is found, otherwise null.
 Type getTypeForName(java.lang.String name)
          Deprecated. Type getTypeByName(String name) should be used
 Graph getTypeGraph()
          Returns the type graph or null, if no type graph was created before.
 Arc getTypeGraphArc(Type t, Type source, Type target)
          Returns the type graph edge of the specified type t, with a source node of the specified type source and a target node of the specified type target, otherwise returns null.
 Node getTypeGraphNode(Type t)
          Returns the type graph node of the specified type or null.
 java.util.List<Type> getTypeList()
           
 java.util.Vector<Type> getTypeOfInheritedArcsInUse(Type parentType)
          Search for the outgoing edges of the parent type and checks whether they are in use or not.
 java.util.Vector<Type> getTypeOfInheritedArcsInUse(Type childType, Type parentType)
          Searchs for the outgoing edges of the parent type and checks whether they are in use or not.
 java.util.Enumeration<Type> getTypes()
          Iterate through all the valid types that may be given to a * GraphObject.
 int getTypesCount()
           
 java.util.Vector<Type> getTypesVec()
          Deprecated. replaced by List getTypeList()
 boolean hasInheritance()
          Returns true, if a type graph exists and it is a type graph with node type inheritance, otherwise returns false.
 boolean importTypeGraph(Graph tGraph, boolean rewrite)
          Imports (integrates) the specified Graph tGraph into my type graph.
 boolean isClanUsed(Type t)
          Returns true, if at least one type of the type inheritance clan specified by the type t was used to create a node of an instance graph.
 boolean isEmpty()
           
 boolean isInheritanceArc(Arc a)
           
 boolean isNewTypeGraphObjectImported()
           
 void refreshInheritance()
           
 void refreshInheritanceArcs()
          Reads my current inheritance data and updates the inheritance edges.
 void refreshInheritanceClans()
           
 void refreshTypeGraphObjects()
           
 boolean removeAllInheritanceRelations(Type child)
          Remove all direct inheritance relations of the specified type.
 boolean removeInheritanceRelation(Type child, Type parent)
          Remove inheritance relation from the specified child type to the specified direct parent type.
 void removeTypeGraph()
           
 TypeError removeTypeGraphObject(GraphObject tgo)
           
 void setHelpInfo(java.lang.String str)
           
protected  void setLevelOfTypeGraph(int level)
           
 java.util.Collection<TypeError> setLevelOfTypeGraphCheck(int level)
          changes the behavior of the type graph check and defines, how the type graph is used.
 void setTypeGraph(Graph typeGraph)
          Use the given graph as the new type graph.
 java.lang.String showArcTypes()
           
 java.lang.String showNodeTypes()
           
 void showTypeNodes()
           
 java.lang.String showTypes()
           
 boolean usesInheritance()
          Returns true, if a type graph exists and it is a type graph with node type inheritance, otherwise returns false.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNDEFINED

public static final int UNDEFINED
Value for unknown level of type graph check

See Also:
Constant Field Values

DISABLED

public static final int DISABLED
Level of type graph check to disable type graph

See Also:
Constant Field Values

ENABLED_INHERITANCE

public static final int ENABLED_INHERITANCE
Level of type graph check to enable inheritance relation only

See Also:
Constant Field Values

ENABLED

public static final int ENABLED
Level of type graph check to enable type graph and no multiplicity

See Also:
Constant Field Values

ENABLED_MAX

public static final int ENABLED_MAX
Level of type graph check to enable type graph and max multiplicity

See Also:
Constant Field Values

ENABLED_MAX_MIN

public static final int ENABLED_MAX_MIN
Level of type graph check to enable type graph and max and min multiplicity

See Also:
Constant Field Values

ENABLED_MIN

public static final int ENABLED_MIN
Level of type graph check to enable type graph and min multiplicity

See Also:
Constant Field Values

info

protected java.lang.String info
Constructor Detail

TypeSet

public TypeSet()
creates a new type manager. with no types defined and no type graph given.

Method Detail

dispose

public void dispose()

finalize

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

isEmpty

public boolean isEmpty()

getTypes

public final java.util.Enumeration<Type> getTypes()
Iterate through all the valid types that may be given to a * GraphObject. Enumeration elements are of type Type. *

See Also:
Type

getTypesCount

public final int getTypesCount()

getTypeList

public final java.util.List<Type> getTypeList()
Returns:
a list with node/edge types

getTypesVec

public final java.util.Vector<Type> getTypesVec()
Deprecated. replaced by List getTypeList()

Returns:
a list with node/edge types

getInheritanceArcs

public final java.util.Vector<Arc> getInheritanceArcs()
Returns a set of inheritance edges. An inheritance edge is especial edge kind. It is not in the edge set of a type graph and it cannot be get by typeSet.getTypeGraph().getArcs().


getInheritanceType

public final Type getInheritanceType()

hasInheritance

public boolean hasInheritance()
Returns true, if a type graph exists and it is a type graph with node type inheritance, otherwise returns false.


usesInheritance

public boolean usesInheritance()
Returns true, if a type graph exists and it is a type graph with node type inheritance, otherwise returns false.


getTypeByNameAndAdditionalRepr

public Type getTypeByNameAndAdditionalRepr(java.lang.String name,
                                           java.lang.String addRepr)
Returns a type with the specified name and additional graphical representation if it is found, otherwise null.


getTypeByName

public Type getTypeByName(java.lang.String name)
Returns a type with the specified name if it is found, otherwise null Here the graphical represantation of a node or edge type is not taken in account. That can be a problem, when there exists a node type and an edge type with equal names. The method Type getTypeByNameAndAdditionalRepr(String name, String addRepr) should be used.


getTypeForName

public Type getTypeForName(java.lang.String name)
Deprecated. Type getTypeByName(String name) should be used

Returns a type with the specified name or null


getSimilarType

public Type getSimilarType(Type t)
Returns a type which is similar to the specified type: the type names, the graphical representation such as color, node shape of node type or edge style of edge type, the number of attributes, the name and type of attribute member should be equal, otherwise returns null.


getTypeGraphNode

public Node getTypeGraphNode(Type t)
Returns the type graph node of the specified type or null.


getTypeGraphArc

public Arc getTypeGraphArc(Type t,
                           Type source,
                           Type target)
Returns the type graph edge of the specified type t, with a source node of the specified type source and a target node of the specified type target, otherwise returns null.


getTypeGraph

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


setTypeGraph

public void setTypeGraph(Graph typeGraph)
Use the given graph as the new type graph. To use the checkType(agg.xt_basis.Graph) method, you must call checkTypeGraph() first.

Parameters:
typeGraph - a Graph with this TypeSet and only one node of each type. Or null, if the type graph check should no longer be used.

removeTypeGraph

public void removeTypeGraph()

destroyTypeGraph

public void destroyTypeGraph()

adaptTypes

public void adaptTypes(TypeSet otherTypes,
                       boolean all)
If the parameter all is true, then a copy of each type of the otherTypes will be created, otherwise only of the not found types.


adaptTypes

public void adaptTypes(java.util.Enumeration<Type> otherTypes,
                       boolean all)
Deprecated. please use adaptTypes(TypeSet otherTypes, boolean all)

If the parameter all is true, then a copy will be created of each type of the otherTypes, otherwise only of not found type.


importTypeGraph

public boolean importTypeGraph(Graph tGraph,
                               boolean rewrite)
Imports (integrates) the specified Graph tGraph into my type graph. The tGraph has to be a type graph, too. If the parameter rewrite is true, my types would be adapted to the types imported, otherwise they have to be equal. Returns true, if the import was successful, otherwise false.


createTypeGraph

public Graph createTypeGraph()
Creates an empty type graph. If a type graph was defined, it will be lost. To use the checkType(agg.xt_basis.Graph) method, you must call checkTypeGraph() first.


generateMinimalTypeGraph

public Graph generateMinimalTypeGraph()
This method does only work when a type graph does not exists or it is empty, otherwise returns existing type graph. Creates a new type graph, if it does not already exist. Tries to create a unique type graph node / edge object for all already used node / edge types. Creates an inheritance edge for each existing inheritance relation. The level of type graph check should be set to TypeSet.DISABLED.

Returns:
type graph

extendTypeGraph

public Graph extendTypeGraph()
Creates a new type graph, if it does not already exist. Tries to extend the type graph by a unique type graph node / edge object for already used node / edge type that does not have an object in the type graph. Creates an inheritance edge for existing inheritance relation that does not have an inheritance edge in the type graph. The level of type graph check should be set to TypeSet.DISABLED.

Returns:
type graph

clearTypeGraph

public void clearTypeGraph()
Remove all nodes and arcs and inheritance relations of the type graph.


createType

public final Type createType()

createType

public final Type createType(boolean withAttributes)

addType

public Type addType(Type aType)
Adds the given type to this type manager. This should only called with independent types, types can't be part of two manager.


adoptClan

public Type adoptClan(Type aType)

adoptType

public Type adoptType(Type t)
Creates a new type that is similar to the specified Type t.


containsType

public boolean containsType(Type type)
Returns true if the given type is managed by this object.


destroyType

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

Throws:
TypeException

getAttrManager

public AttrManager getAttrManager()
Returns the AttrManager used to create attributed types


checkTypeGraph

public java.util.Collection<TypeError> checkTypeGraph()
Checks the type graph. The method must be called before edge type multiplicity will be set and before this TypeSet will check graphs, rules, etc. above the type graph. To turn off the type graph based checks use the method turnTypeGraphCheckOff()

Returns:
An empty Collection if for all node types exists exactly one node and for all edge/arc types exists at least one edge in the type graph, but not more then one of a type between the same nodes. If there were errors in the type graph a Collection with objects of class agg.xt_basis.TypeError will returned. For each mismatch an object will delivered. You can check if there were errors with Collection.isEmpty.
See Also:
TypeError

addTypeGraphObject

public TypeError addTypeGraphObject(GraphObject newObject)
checks this new graph object in the type graph. This method will only find a wrong object, if the type graph was checked first (see checkTypeGraph()). This method is designed to use before adding an object to the type graph, so the type graph will be used even if the check found mismatches.

Returns:
An empty Collection if for all node types exists exactly one node and for all edge/arc types exists at least one edge in the type graph, but not more then one of a type between the same nodes. If there were errors in the type graph a Collection with objects of class TypeError will returned. For each mismatch an object will delivered. You can check if there were errors with Collection.isEmpty().
See Also:
TypeError

checkInheritanceValid

public TypeError checkInheritanceValid(Type child,
                                       Type parent)
Deprecated. replaced by checkInheritanceValidity(Type, Type)

Returns an error in the following cases: parent already exists, reflexive or cyclic inheritance, double attribute names when multiple inheritance used, otherwise - null.


checkInheritanceValidity

public TypeError checkInheritanceValidity(Type child,
                                          Type parent)
Returns an error in the following cases: parent already exists, reflexive or cyclic inheritance, double attribute names when multiple inheritance used, otherwise - null.


isInheritanceArc

public boolean isInheritanceArc(Arc a)

addValidInheritanceRelation

public Arc addValidInheritanceRelation(Type child,
                                       Type parent)
To use this method, a type graph must to be created and the method checkInheritanceValidity(Type child, Type parent) must be called before.


addInheritanceRelation

public TypeError addInheritanceRelation(Type child,
                                        Type parent)
To use this method, a type graph must to be created before.


removeAllInheritanceRelations

public boolean removeAllInheritanceRelations(Type child)
Remove all direct inheritance relations of the specified type.


removeInheritanceRelation

public boolean removeInheritanceRelation(Type child,
                                         Type parent)
Remove inheritance relation from the specified child type to the specified direct parent type.


refreshInheritanceArcs

public void refreshInheritanceArcs()
Reads my current inheritance data and updates the inheritance edges.


getInheritedArcs

public java.util.Vector<Arc> getInheritedArcs(Type parentType)
Returns a set with all edges to inherit from the specified parent type.


getTypeOfInheritedArcsInUse

public java.util.Vector<Type> getTypeOfInheritedArcsInUse(Type parentType)
Search for the outgoing edges of the parent type and checks whether they are in use or not.

Parameters:
parentType -
Returns:
a set with used types of inherited edges or an empty set

getTypeOfInheritedArcsInUse

public java.util.Vector<Type> getTypeOfInheritedArcsInUse(Type childType,
                                                          Type parentType)
Searchs for the outgoing edges of the parent type and checks whether they are in use or not.

Parameters:
parentType -
Returns:
a set with used types of inherit edges or an empty set

getClan

public java.util.Vector<Type> getClan(Type t)
Returns all child node types of the given node type.

Parameters:
t - The type which children should be found.
Returns:
A vector of child types.

isClanUsed

public boolean isClanUsed(Type t)
Returns true, if at least one type of the type inheritance clan specified by the type t was used to create a node of an instance graph.


refreshInheritanceClans

public void refreshInheritanceClans()

refreshInheritance

public void refreshInheritance()

canRemoveTypeGraphNode

public boolean canRemoveTypeGraphNode(Node n)

canRemoveTypeGraphArc

public boolean canRemoveTypeGraphArc(Arc a)

removeTypeGraphObject

public TypeError removeTypeGraphObject(GraphObject tgo)

forceRemoveTypeGraphObject

public TypeError forceRemoveTypeGraphObject(GraphObject tgo)

checkType

public java.util.Collection<TypeError> checkType(Graph graph)
checks the given graph, if it is valid typed. If the TypeSet of the graph is not this object, the types of the nodes and edges must be also defined here. If in this TypeSet a proofed type graph is used, there must be a morphism from the given graph into the type graph (But a different algorithmus will be used).

Parameters:
graph - the graph to check
Returns:
An empty Collection if the given graph is valid typed. If there were type errors in the graph a Collection with objects of class TypeError will returned. For each mismatch an object will delivered. You can check if there were errors with Collection.isEmpty().
See Also:
checkTypeGraph()

checkCreateGraphObject

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


checkCreateGraphObject

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


checkEdgeTypeMultiplicity

public TypeError checkEdgeTypeMultiplicity(Arc typearc,
                                           Graph graph,
                                           int currentTypeGraphLevel)
Checks edge type multiplicity of the specified Arc of the edges of the specified Graph.

Parameters:
typearc - type arc of the current type graph
graph - a graph to check
currentTypeGraphLevel -
Returns:
null if multiplicity is satisfied, otherwise an error object

checkNodeTypeMultiplicity

public TypeError checkNodeTypeMultiplicity(Type nodeType,
                                           Graph graph,
                                           int currentTypeGraphLevel)
Checks node type multiplicity of the specified node Type of the nodes of the specified Graph.

Parameters:
nodeType - node type of the current type graph
graph - a graph to check
currentTypeGraphLevel -
Returns:
null if multiplicity is satisfied, otherwise an error object

checkType

public java.util.Collection<TypeError> checkType(Graph graph,
                                                 int typeGraphCheckLevel)
checks the given graph, if it is valid typed. The TypeSet of the graph has to be this object.

Parameters:
graph - the graph to check
typeGraphCheckLevel - the level of the check
Returns:
An empty Collection if the given graph is valid typed. If there were type errors in the graph a Collection with objects of class TypeError will returned. For each mismatch an object will delivered. You can check if there were errors with Collection.isEmpty().
See Also:
checkTypeGraph()

checkTypeMaxMultiplicity

public TypeError checkTypeMaxMultiplicity(Graph graph,
                                          int typeGraphCheckLevel)

checkType

public java.util.Collection<TypeError> checkType(Rule rule)
checks the given rule, if it is valid typed. If the TypeSet of the contained graphs is not this object, the types of the nodes and edges must be also defined here. If in this TypeSet a proofed type graph is used, there must be a morphism from the given graphs into the type graph.

Parameters:
rule - the rule to check. The original and image graphs of the rule and of all NACs will be checked.
Returns:
An empty Collection if the given rule is valid typed. If there were type errors in the rule a Collection with objects of class TypeError will returned. For each mismatch an object will delivered. You can check if there were errors with Collection.isEmpty().
See Also:
checkTypeGraph()

checkType

public java.util.Collection<TypeError> checkType(AtomConstraint atomic)
checks the given atomic, if it is valid typed. If the TypeSet of the contained graphs is not this object, the types of the nodes and edges must be also defined here. If in this TypeSet a proofed type graph is used, there must be a morphism from the given graphs into the type graph.

Parameters:
atomic - the atomic to check.
Returns:
An empty Collection if the given atomic is valid typed. If there were type errors in the atomic a Collection with objects of class TypeError will returned. For each mismatch an object will delivered. You can check if there were errors with Collection.isEmpty().
See Also:
checkTypeGraph()

checkType

public java.util.Collection<TypeError> checkType(OrdinaryMorphism morphism)
checks the given morphism, if it is valid typed. If the TypeSet of the contained graph is not this object, the types of the nodes and edges must be also defined here. If in this TypeSet a proofed type graph is used, there must be a morphism from the given graphs into the type graph.

Parameters:
morphism - the morphism to check. The image and the original grpah of the morphism will be checked.
Returns:
An empty Collection if the given morphism is valid typed. If there were type errors in the morphism a Collection with objects of class TypeError will returned. For each mismatch an object will delivered. You can check if there were errors with Collection.isEmpty().
See Also:
checkTypeGraph()

checkType

public TypeError checkType(Arc arc,
                           boolean isComplete)
checks the given arc, if it is valid typed. The TypeSet of the graph which contains the arc must be this object. If in this TypeSet a proofed type graph is used, this arc must be represented there.

Parameters:
arc - the arc to check.
Returns:
An empty Collection if the given arc is valid typed. If there were type errors in the arc a Collection with objects of class TypeError will returned. For each mismatch an object will delivered. You can check if there were errors with Collection.isEmpty().
See Also:
checkTypeGraph()

checkType

public TypeError checkType(Node node,
                           boolean isComplete)
checks the given node, if it is valid typed. The TypeSet of the graph which contains the node must be this object. If in this TypeSet a proofed type graph is used, this node must be represented there.

Parameters:
node - the node to check.
isComplete - true, if the containing graph is not a subgraph so we will also check for minimum multiplicity if activated.
Returns:
An empty Collection if the given node is valid typed. If there were type errors in the node a Collection with objects of class TypeError will returned. For each mismatch an object will delivered. You can check if there were errors with Collection.isEmpty().
See Also:
checkTypeGraph()

checkType

public TypeError checkType(GraphObject object)
checks the given graph object, if it is valid typed. The TypeSet of the graph which contains the object must be this object. If in this TypeSet a proofed type graph is used, this object must be represented there.

Parameters:
object - the object to check.
Returns:
An empty Collection if the given object is valid typed. If there were type errors in the arc a Collection with objects of class TypeError will returned. For each mismatch an object will delivered. You can check if there were errors with Collection.isEmpty().
See Also:
checkTypeGraph()

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.

Parameters:
level -
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.
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.
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.
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 working graph must
Returns:
SUCCESS (an empty Collection), if the type graph is defined and is usable as type graph. Otherwise you get a Collection of TypeError.

setLevelOfTypeGraph

protected void setLevelOfTypeGraph(int level)

getLevelOfTypeGraphCheck

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

Returns:
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.
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.
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.
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 working graph must

disableTypeGraphCheck

public void disableTypeGraphCheck()
Deprecated. use setLevelOfTypeGraphCheck(int)

marks the type graph as unchecked, so no longer the type graph will be used for type checks. Use checkTypeGraph() to turn the type graph based checks on.


enableTypeGraphCheck

public java.util.Collection<TypeError> enableTypeGraphCheck()
Deprecated. use setLevelOfTypeGraphCheck(int)

marks the type graph as checked, so no longer the type graph will be used for type checks. Use checkTypeGraph() to turn the type graph based checks on.


compareTo

public boolean compareTo(TypeSet ts)

compareTypes

public boolean compareTypes(TypeSet ts)
Compare my types with the types of the specified TypeSet ts. Returns true, if the types are compatible, otherwise false.


compareTypes

public boolean compareTypes(TypeSet ts,
                            java.util.Vector<Type> differentAttribute,
                            java.util.Vector<Type> differentInheritance,
                            java.util.Vector<Type> differentMultiplicity)
Compare my types with the types of the specified TypeSet ts. Fill the specified container with types that have equal name but different attributes, inheritance, multiplicity. Returns true, if the types are compatible, otherwise false.


isNewTypeGraphObjectImported

public boolean isNewTypeGraphObjectImported()

contains

public boolean contains(TypeSet ts)

checkIfRemovable

public TypeError checkIfRemovable(Node node)
returns, if the given node could be removed from its actual graph.

Parameters:
node - the node to check
Returns:
null, if the removing is allowed or a TypeError if the removing would produce a conflict with the type graph.

checkIfRemovable

public TypeError checkIfRemovable(Arc arc)
returns, if the given edge could be removed from its actual graph.

Parameters:
arc - the edge to check
Returns:
null, if the removing is allowed or a TypeError if the removing would produce a conflict with the type graph.

checkIfRemovableFromSource

public TypeError checkIfRemovableFromSource(Arc arc)
returns, if the given arc could be removed from its actual graph. This method ignores the multiplicity constraints for the target node. It should only be used, if the target node should be destroyed.

Parameters:
arc - the arc to check
Returns:
null, if the removing is allowed or a TypeError if the removing would produce a conflict with the type graph.

checkIfRemovableFromTarget

public TypeError checkIfRemovableFromTarget(Arc arc)
returns, if the given arc could be removed from its actual graph. This method ignores the multiplicity constraints for the source node. It should only be used, if the source node should be destroyed.

Parameters:
arc - the arc to check
Returns:
null, if the removing is allowed or a TypeError if the removing would produce a conflict with the type graph.

checkIfEdgeCreatable

public TypeError checkIfEdgeCreatable(Type type,
                                      Node src,
                                      Node tar)

getMaxMultiplicity

public int getMaxMultiplicity(Type type)

getMinMultiplicity

public int getMinMultiplicity(Type type)

getMaxSourceMultiplicity

public int getMaxSourceMultiplicity(Type type,
                                    Type srctype,
                                    Type tartype)

getMinSourceMultiplicity

public int getMinSourceMultiplicity(Type type,
                                    Type srctype,
                                    Type tartype)

getMaxTargetMultiplicity

public int getMaxTargetMultiplicity(Type type,
                                    Type srctype,
                                    Type tartype)

getMinTargetMultiplicity

public int getMinTargetMultiplicity(Type type,
                                    Type srctype,
                                    Type tartype)

showTypes

public java.lang.String showTypes()

showNodeTypes

public java.lang.String showNodeTypes()

showArcTypes

public java.lang.String showArcTypes()

showTypeNodes

public void showTypeNodes()

refreshTypeGraphObjects

public void refreshTypeGraphObjects()

setHelpInfo

public void setHelpInfo(java.lang.String str)

getHelpInfo

public java.lang.String getHelpInfo()