net.xqhs.graphs.matchingPlatform
Interface GraphMatchingPlatform.PlatformShadowGraph

All Superinterfaces:
Graph
All Known Implementing Classes:
ContextGraph, GMPImplementation.PrincipalGraph
Enclosing interface:
GraphMatchingPlatform

public static interface GraphMatchingPlatform.PlatformShadowGraph
extends Graph

Interface for graphs that are shadows of a master graph (most likely the platform principal graph).

Author:
Andrei Olaru

Method Summary
 boolean canIncrement()
           
 java.util.Map<GraphComponent,TrackingGraph.Operation> getNextSequenceOperations()
          Retrieves the operations that will be applied at the next sequence increment.
 int getSequence()
           
 int incrementSequence()
          Takes one transaction from the graph's transaction queue and applies it to the current state of the graph.
 int incrementSequence(int targetSequence)
          Takes several transactions from the graph's transaction queue and applies them to the current state of the graph, in order to reach the target sequence number.
 int incrementSequenceFastForward()
          Brings the graph up to date with its master graph, transaction by transaction.
 
Methods inherited from interface net.xqhs.graphs.graph.Graph
add, addAll, addEdge, addNode, contains, getComponents, getEdges, getInEdges, getNodes, getNodesNamed, getOutEdges, m, n, remove, removeAll, removeEdge, removeNode, size
 

Method Detail

getSequence

int getSequence()
Returns:
the current sequence number of the shadow graph.

getNextSequenceOperations

java.util.Map<GraphComponent,TrackingGraph.Operation> getNextSequenceOperations()
Retrieves the operations that will be applied at the next sequence increment.

Returns:
the operations to be performed, or null if the shadow is synchronized with its master.

canIncrement

boolean canIncrement()
Returns:
true if there are transactions in the transaction queue that can be applied to the current state of the graph.
Throws:
java.lang.IllegalStateException - if the method is called on a graph that is not a shadow graph.

incrementSequence

int incrementSequence()
Takes one transaction from the graph's transaction queue and applies it to the current state of the graph.

Returns:
the new current sequence number.
Throws:
java.lang.IllegalStateException - if the method is called on a graph that is not a shadow graph.

incrementSequence

int incrementSequence(int targetSequence)
Takes several transactions from the graph's transaction queue and applies them to the current state of the graph, in order to reach the target sequence number.

Parameters:
targetSequence - - the sequence number to reach before stopping.
Returns:
the new current sequence number. If there are enough transactions in the queue, it is equal to the targetSequence.
Throws:
java.lang.IllegalStateException - if the method is called on a graph that is not a shadow graph.

incrementSequenceFastForward

int incrementSequenceFastForward()
Brings the graph up to date with its master graph, transaction by transaction.

Returns:
the new current sequence number.
Throws:
java.lang.IllegalStateException - if the method is called on a graph that is not a shadow graph.