Package org.graffiti.session
Class GraphConstraintChecker
java.lang.Object
org.graffiti.session.GraphConstraintChecker
- All Implemented Interfaces:
EventListener,AttributeListener,EdgeListener,GraphListener,NodeListener,TransactionListener
public class GraphConstraintChecker extends Object implements TransactionListener, GraphListener, EdgeListener, NodeListener, AttributeListener
This class checks constraints on the graph. Constraints can arbitrarily added
an removed.
GraphConstraintChecker is a listener to graph,
nodes, edges and attributes and checks the constraints after every change on
these objects.-
Constructor Summary
Constructors Constructor Description GraphConstraintChecker(Graph g, ConstraintCheckerListener ccl)Constructs a newGraphConstraintCheckerchecking constraints on the specifiedGraph. -
Method Summary
Modifier and Type Method Description voidaddConstraint(GraphConstraint c)Adds another constraint to the set of constraints in this constraint checker.voidcheckConstraints()Checks whether all constraints are satisfied on the specified graph.StringgetState()Returns the state of the constraint checker which contains a message telling which constraints are not satisfied.voidpostAttributeAdded(AttributeEvent e)Called after an attribute has been added.voidpostAttributeChanged(AttributeEvent e)Called after an attribute has been changed.voidpostAttributeRemoved(AttributeEvent e)Called after an attribute has been removed.voidpostDirectedChanged(EdgeEvent e)Called after the edge was set directed or undirected.voidpostEdgeAdded(GraphEvent e)Called after an edge has been added to the graph.voidpostEdgeRemoved(GraphEvent e)Called after an edge has been removed from the graph.voidpostEdgeReversed(EdgeEvent e)Called after the edge has been reversed.voidpostGraphCleared(GraphEvent e)Called after methodclear()has been called on a graph.voidpostInEdgeAdded(NodeEvent e)Called just after an incoming edge has been added to the node.voidpostInEdgeRemoved(NodeEvent e)Called after an incoming edge has been removed from the node.voidpostNodeAdded(GraphEvent e)Called after an edge has been added to the graph.voidpostNodeRemoved(GraphEvent e)Called after a node has been removed from the graph.voidpostOutEdgeAdded(NodeEvent e)Called after an outgoing edge has been added to the node.voidpostOutEdgeRemoved(NodeEvent e)Called after an outgoing edge has been removed from the node.voidpostSourceNodeChanged(EdgeEvent e)Called after the source node of an edge has changed.voidpostTargetNodeChanged(EdgeEvent e)Called after the target node of an edge has changed.voidpostUndirectedEdgeAdded(NodeEvent e)Called after an (undirected) edge has been added to the node.voidpostUndirectedEdgeRemoved(NodeEvent e)Called after an (undirected) edge has been removed from the node.voidpreAttributeAdded(AttributeEvent e)Called just before an attribute is added.voidpreAttributeChanged(AttributeEvent e)Called before a change of an attribute takes place.voidpreAttributeRemoved(AttributeEvent e)Called just before an attribute is removed.voidpreDirectedChanged(EdgeEvent e)Called before the edge is set directed or undirected.voidpreEdgeAdded(GraphEvent e)Called just before an edge is added to the graph.voidpreEdgeRemoved(GraphEvent e)Called just before an edge is removed from the graph.voidpreEdgeReversed(EdgeEvent e)Called before the edge is going to be reversed.voidpreGraphCleared(GraphEvent e)Called before methodclear()is called on a graph.voidpreInEdgeAdded(NodeEvent e)Called just before an incoming edge is added to the node.voidpreInEdgeRemoved(NodeEvent e)Called just before an incoming edge is removed from the node.voidpreNodeAdded(GraphEvent e)Called just before a node is added to the graph.voidpreNodeRemoved(GraphEvent e)Called just before a node is removed from the graph.voidpreOutEdgeAdded(NodeEvent e)Called just before an outgoing edge is added to the node.voidpreOutEdgeRemoved(NodeEvent e)Called just before an outgoing edge is removed from the node.voidpreSourceNodeChanged(EdgeEvent e)Called before a change of the source node of an edge takes place.voidpreTargetNodeChanged(EdgeEvent e)Called before a change of the target node of an edge takes place.voidpreUndirectedEdgeAdded(NodeEvent e)Called just before an (undirected) edge is added to the node.voidpreUndirectedEdgeRemoved(NodeEvent e)Called just before an (undirected) edge is removed from the node.voidremoveConstraint(GraphConstraint c)Removes the specifiedGraphConstraintfrom the set of constraints of this constraint checker.voidtransactionFinished(TransactionEvent e, BackgroundTaskStatusProviderSupportingExternalCall status)Called when a transaction has stopped.voidtransactionStarted(TransactionEvent e)Called when a transaction has started.
-
Constructor Details
-
GraphConstraintChecker
Constructs a newGraphConstraintCheckerchecking constraints on the specifiedGraph.- Parameters:
g- theGraphon which to check the constraints.ccl- theConstraintCheckerListenerreceiving failures of constraints.
-
-
Method Details
-
getState
Returns the state of the constraint checker which contains a message telling which constraints are not satisfied.- Returns:
- the state of the constraint checker which contains a message telling which constraints are not satisfied.
- Throws:
RuntimeException- DOCUMENT ME!
-
addConstraint
Adds another constraint to the set of constraints in this constraint checker.- Parameters:
c- theGraphConstraintto be added to the set of constraints of this constraint checker.
-
checkConstraints
public void checkConstraints()Checks whether all constraints are satisfied on the specified graph. -
postAttributeAdded
Called after an attribute has been added.- Specified by:
postAttributeAddedin interfaceAttributeListener- Parameters:
e- the AttributeEvent detailing the changes.
-
postAttributeChanged
Called after an attribute has been changed.- Specified by:
postAttributeChangedin interfaceAttributeListener- Parameters:
e- the AttributeEvent detailing the changes.
-
postAttributeRemoved
Called after an attribute has been removed.- Specified by:
postAttributeRemovedin interfaceAttributeListener- Parameters:
e- the AttributeEvent detailing the changes.
-
postDirectedChanged
Called after the edge was set directed or undirected.- Specified by:
postDirectedChangedin interfaceEdgeListener- Parameters:
e- the EdgeEvent detailing the changes.
-
postEdgeAdded
Called after an edge has been added to the graph.- Specified by:
postEdgeAddedin interfaceGraphListener- Parameters:
e- the GraphEvent detailing the changes.
-
postEdgeRemoved
Called after an edge has been removed from the graph.- Specified by:
postEdgeRemovedin interfaceGraphListener- Parameters:
e- the GraphEvent detailing the changes.
-
postEdgeReversed
Called after the edge has been reversed.- Specified by:
postEdgeReversedin interfaceEdgeListener- Parameters:
e- the EdgeEvent detailing the changes.
-
postGraphCleared
Called after methodclear()has been called on a graph. No other events (like remove events) are generated.- Specified by:
postGraphClearedin interfaceGraphListener- Parameters:
e- the GraphEvent detailing the changes.
-
postInEdgeAdded
Called just after an incoming edge has been added to the node. (For undirected edges postUndirectedEdgeAdded is called instead.)- Parameters:
e- The NodeEvent detailing the changes.
-
postInEdgeRemoved
Called after an incoming edge has been removed from the node. (For undirected edges postUndirectedEdgeRemoved is called.)- Parameters:
e- The NodeEvent detailing the changes.
-
postNodeAdded
Called after an edge has been added to the graph.- Specified by:
postNodeAddedin interfaceGraphListener- Parameters:
e- the GraphEvent detailing the changes.
-
postNodeRemoved
Called after a node has been removed from the graph. All edges incident to this node have already been removed (preEdgeRemoved and postEdgeRemoved have been called).- Specified by:
postNodeRemovedin interfaceGraphListener- Parameters:
e- the GraphEvent detailing the changes.
-
postOutEdgeAdded
Called after an outgoing edge has been added to the node. (For undirected edges postUndirectedEdgeAdded is called instead.)- Parameters:
e- The NodeEvent detailing the changes.
-
postOutEdgeRemoved
Called after an outgoing edge has been removed from the node. (For undirected edges postUndirectedEdgeRemoved is called.)- Parameters:
e- The NodeEvent detailing the changes.
-
postSourceNodeChanged
Called after the source node of an edge has changed.- Specified by:
postSourceNodeChangedin interfaceEdgeListener- Parameters:
e- the EdgeEvent detailing the changes.
-
postTargetNodeChanged
Called after the target node of an edge has changed.- Specified by:
postTargetNodeChangedin interfaceEdgeListener- Parameters:
e- the EdgeEvent detailing the changes.
-
postUndirectedEdgeAdded
Called after an (undirected) edge has been added to the node. (For directed edges pre- In/Out- EdgeAdded is called.)- Specified by:
postUndirectedEdgeAddedin interfaceNodeListener- Parameters:
e- The NodeEvent detailing the changes.
-
postUndirectedEdgeRemoved
Called after an (undirected) edge has been removed from the node. (For directed edges pre- In/Out- EdgeRemoved is called.)- Specified by:
postUndirectedEdgeRemovedin interfaceNodeListener- Parameters:
e- The NodeEvent detailing the changes.
-
preAttributeAdded
Called just before an attribute is added.- Specified by:
preAttributeAddedin interfaceAttributeListener- Parameters:
e- the AttributeEvent detailing the changes.
-
preAttributeChanged
Called before a change of an attribute takes place.- Specified by:
preAttributeChangedin interfaceAttributeListener- Parameters:
e- the AttributeEvent detailing the changes.
-
preAttributeRemoved
Called just before an attribute is removed.- Specified by:
preAttributeRemovedin interfaceAttributeListener- Parameters:
e- the AttributeEvent detailing the changes.
-
preDirectedChanged
Called before the edge is set directed or undirected.- Specified by:
preDirectedChangedin interfaceEdgeListener- Parameters:
e- the EdgeEvent detailing the changes.
-
preEdgeAdded
Called just before an edge is added to the graph.- Specified by:
preEdgeAddedin interfaceGraphListener- Parameters:
e- the GraphEvent detailing the changes.
-
preEdgeRemoved
Called just before an edge is removed from the graph.- Specified by:
preEdgeRemovedin interfaceGraphListener- Parameters:
e- the GraphEvent detailing the changes.
-
preEdgeReversed
Called before the edge is going to be reversed.- Specified by:
preEdgeReversedin interfaceEdgeListener- Parameters:
e- the EdgeEvent detailing the changes.
-
preGraphCleared
Called before methodclear()is called on a graph. No other events (like remove events) are generated.- Specified by:
preGraphClearedin interfaceGraphListener- Parameters:
e- the GraphEvent detailing the changes.
-
preInEdgeAdded
Called just before an incoming edge is added to the node. (For undirected edges preUndirectedEdgeAdded is called instead.)- Parameters:
e- The NodeEvent detailing the changes.
-
preInEdgeRemoved
Called just before an incoming edge is removed from the node. (For undirected edges preUndirectedEdgeRemoved is called.)- Parameters:
e- The NodeEvent detailing the changes.
-
preNodeAdded
Called just before a node is added to the graph.- Specified by:
preNodeAddedin interfaceGraphListener- Parameters:
e- the GraphEvent detailing the changes.
-
preNodeRemoved
Called just before a node is removed from the graph. This method is called before the incident edges are deleted.- Specified by:
preNodeRemovedin interfaceGraphListener- Parameters:
e- the GraphEvent detailing the changes.
-
preOutEdgeAdded
Called just before an outgoing edge is added to the node. (For undirected edges preUndirectedEdgeAdded is called instead.)- Parameters:
e- The NodeEvent detailing the changes.
-
preOutEdgeRemoved
Called just before an outgoing edge is removed from the node. (For undirected edges preUndirectedEdgeRemoved is called.)- Parameters:
e- The NodeEvent detailing the changes.
-
preSourceNodeChanged
Called before a change of the source node of an edge takes place.- Specified by:
preSourceNodeChangedin interfaceEdgeListener- Parameters:
e- the EdgeEvent detailing the changes.
-
preTargetNodeChanged
Called before a change of the target node of an edge takes place.- Specified by:
preTargetNodeChangedin interfaceEdgeListener- Parameters:
e- the EdgeEvent detailing the changes.
-
preUndirectedEdgeAdded
Called just before an (undirected) edge is added to the node. (For directed edges pre- In/Out- EdgeAdded is called.)- Specified by:
preUndirectedEdgeAddedin interfaceNodeListener- Parameters:
e- The NodeEvent detailing the changes.
-
preUndirectedEdgeRemoved
Called just before an (undirected) edge is removed from the node. (For directed edges pre- In/Out- EdgeRemoved is called.)- Specified by:
preUndirectedEdgeRemovedin interfaceNodeListener- Parameters:
e- The NodeEvent detailing the changes.
-
removeConstraint
Removes the specifiedGraphConstraintfrom the set of constraints of this constraint checker.- Parameters:
c- theGraphConstraintto be removed.- Throws:
NoSuchElementException- if the constraint checker does not contain thisGraphConstraintin his set of constraints.
-
transactionFinished
public void transactionFinished(TransactionEvent e, BackgroundTaskStatusProviderSupportingExternalCall status)Called when a transaction has stopped.- Specified by:
transactionFinishedin interfaceTransactionListener- Parameters:
e- the EdgeEvent detailing the changes.
-
transactionStarted
Called when a transaction has started.- Specified by:
transactionStartedin interfaceTransactionListener- Parameters:
e- the EdgeEvent detailing the changes.
-