|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectagg.xt_basis.TypeSet
public class TypeSet
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 |
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 |
---|
public static final int UNDEFINED
public static final int DISABLED
public static final int ENABLED_INHERITANCE
public static final int ENABLED
public static final int ENABLED_MAX
public static final int ENABLED_MAX_MIN
public static final int ENABLED_MIN
protected java.lang.String info
Constructor Detail |
---|
public TypeSet()
Method Detail |
---|
public void dispose()
public void finalize()
finalize
in class java.lang.Object
public boolean isEmpty()
public final java.util.Enumeration<Type> getTypes()
Type
. *
Type
public final int getTypesCount()
public final java.util.List<Type> getTypeList()
public final java.util.Vector<Type> getTypesVec()
public final java.util.Vector<Arc> getInheritanceArcs()
public final Type getInheritanceType()
public boolean hasInheritance()
public boolean usesInheritance()
public Type getTypeByNameAndAdditionalRepr(java.lang.String name, java.lang.String addRepr)
null
.
public Type getTypeByName(java.lang.String name)
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
public Type getTypeForName(java.lang.String name)
Type getTypeByName(String name)
should be used
null
public Type getSimilarType(Type t)
null
.
public Node getTypeGraphNode(Type t)
null
.
public Arc getTypeGraphArc(Type t, Type source, Type target)
t
, with
a source node of the specified type source
and a target
node of the specified type target
, otherwise returns
null
.
public Graph getTypeGraph()
null
,
if no type graph was created before.
public void setTypeGraph(Graph typeGraph)
checkType(agg.xt_basis.Graph)
method, you must call checkTypeGraph()
first.
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.public void removeTypeGraph()
public void destroyTypeGraph()
public void adaptTypes(TypeSet otherTypes, boolean all)
all
is true, then a copy
of each type of the otherTypes
will be created,
otherwise only of the not found types.
public void adaptTypes(java.util.Enumeration<Type> otherTypes, boolean all)
all
is true, then a copy will be created
of each type of the otherTypes
,
otherwise only of not found type.
public boolean importTypeGraph(Graph tGraph, boolean rewrite)
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.
public Graph createTypeGraph()
checkType(agg.xt_basis.Graph)
method, you must call
checkTypeGraph()
first.
public Graph generateMinimalTypeGraph()
public Graph extendTypeGraph()
public void clearTypeGraph()
public final Type createType()
public final Type createType(boolean withAttributes)
public Type addType(Type aType)
public Type adoptClan(Type aType)
public Type adoptType(Type t)
public boolean containsType(Type type)
public void destroyType(Type type) throws TypeException
TypeException
public AttrManager getAttrManager()
public java.util.Collection<TypeError> checkTypeGraph()
TypeError
public TypeError addTypeGraphObject(GraphObject newObject)
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.
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()
.TypeError
public TypeError checkInheritanceValid(Type child, Type parent)
checkInheritanceValidity(Type, Type)
public TypeError checkInheritanceValidity(Type child, Type parent)
public boolean isInheritanceArc(Arc a)
public Arc addValidInheritanceRelation(Type child, Type parent)
checkInheritanceValidity(Type child, Type parent)
must be called before.
public TypeError addInheritanceRelation(Type child, Type parent)
public boolean removeAllInheritanceRelations(Type child)
public boolean removeInheritanceRelation(Type child, Type parent)
child
type
to the specified direct parent
type.
public void refreshInheritanceArcs()
public java.util.Vector<Arc> getInheritedArcs(Type parentType)
public java.util.Vector<Type> getTypeOfInheritedArcsInUse(Type parentType)
parentType
-
public java.util.Vector<Type> getTypeOfInheritedArcsInUse(Type childType, Type parentType)
parentType
-
public java.util.Vector<Type> getClan(Type t)
t
- The type which children should be found.
public boolean isClanUsed(Type t)
t
was used to create a node of an instance
graph.
public void refreshInheritanceClans()
public void refreshInheritance()
public boolean canRemoveTypeGraphNode(Node n)
public boolean canRemoveTypeGraphArc(Arc a)
public TypeError removeTypeGraphObject(GraphObject tgo)
public TypeError forceRemoveTypeGraphObject(GraphObject tgo)
public java.util.Collection<TypeError> checkType(Graph graph)
graph
- the graph to check
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()
.checkTypeGraph()
public TypeError checkCreateGraphObject(Graph g, Type nodeType, int currentTypeGraphLevel)
public TypeError checkCreateGraphObject(Graph g, Type edgeType, Node source, Node target, int currentTypeGraphLevel)
public TypeError checkEdgeTypeMultiplicity(Arc typearc, Graph graph, int currentTypeGraphLevel)
typearc
- type arc of the current type graphgraph
- a graph to checkcurrentTypeGraphLevel
-
public TypeError checkNodeTypeMultiplicity(Type nodeType, Graph graph, int currentTypeGraphLevel)
nodeType
- node type of the current type graphgraph
- a graph to checkcurrentTypeGraphLevel
-
public java.util.Collection<TypeError> checkType(Graph graph, int typeGraphCheckLevel)
graph
- the graph to checktypeGraphCheckLevel
- the level of the check
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()
.checkTypeGraph()
public TypeError checkTypeMaxMultiplicity(Graph graph, int typeGraphCheckLevel)
public java.util.Collection<TypeError> checkType(Rule rule)
rule
- the rule to check. The original and image graphs of the rule
and of all NACs will be checked.
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()
.checkTypeGraph()
public java.util.Collection<TypeError> checkType(AtomConstraint atomic)
atomic
- the atomic to check.
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()
.checkTypeGraph()
public java.util.Collection<TypeError> checkType(OrdinaryMorphism morphism)
morphism
- the morphism to check. The image and the original grpah of the
morphism will be checked.
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()
.checkTypeGraph()
public TypeError checkType(Arc arc, boolean isComplete)
arc
- the arc to check.
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()
.checkTypeGraph()
public TypeError checkType(Node node, boolean isComplete)
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.
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()
.checkTypeGraph()
public TypeError checkType(GraphObject object)
object
- the object to check.
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()
.checkTypeGraph()
public java.util.Collection<TypeError> setLevelOfTypeGraphCheck(int level)
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 |
SUCCESS
(an empty Collection), if the type graph is
defined and is usable as type graph. Otherwise you get a
Collection of TypeError
.protected void setLevelOfTypeGraph(int level)
public int getLevelOfTypeGraphCheck()
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 |
public void disableTypeGraphCheck()
setLevelOfTypeGraphCheck(int)
checkTypeGraph()
to turn the type
graph based checks on.
public java.util.Collection<TypeError> enableTypeGraphCheck()
setLevelOfTypeGraphCheck(int)
checkTypeGraph()
to turn the type graph
based checks on.
public boolean compareTo(TypeSet ts)
public boolean compareTypes(TypeSet ts)
public boolean compareTypes(TypeSet ts, java.util.Vector<Type> differentAttribute, java.util.Vector<Type> differentInheritance, java.util.Vector<Type> differentMultiplicity)
public boolean isNewTypeGraphObjectImported()
public boolean contains(TypeSet ts)
public TypeError checkIfRemovable(Node node)
node
- the node to check
TypeError
if the
removing would produce a conflict with the type graph.public TypeError checkIfRemovable(Arc arc)
arc
- the edge to check
TypeError
if the
removing would produce a conflict with the type graph.public TypeError checkIfRemovableFromSource(Arc arc)
arc
- the arc to check
TypeError
if the
removing would produce a conflict with the type graph.public TypeError checkIfRemovableFromTarget(Arc arc)
arc
- the arc to check
TypeError
if the
removing would produce a conflict with the type graph.public TypeError checkIfEdgeCreatable(Type type, Node src, Node tar)
public int getMaxMultiplicity(Type type)
public int getMinMultiplicity(Type type)
public int getMaxSourceMultiplicity(Type type, Type srctype, Type tartype)
public int getMinSourceMultiplicity(Type type, Type srctype, Type tartype)
public int getMaxTargetMultiplicity(Type type, Type srctype, Type tartype)
public int getMinTargetMultiplicity(Type type, Type srctype, Type tartype)
public java.lang.String showTypes()
public java.lang.String showNodeTypes()
public java.lang.String showArcTypes()
public void showTypeNodes()
public void refreshTypeGraphObjects()
public void setHelpInfo(java.lang.String str)
public java.lang.String getHelpInfo()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |