net.xqhs.graphs.context
Class ContextGraph

java.lang.Object
  extended by net.xqhs.util.config.Config
      extended by net.xqhs.util.logging.Unit
          extended by net.xqhs.graphs.graph.SimpleGraph
              extended by net.xqhs.graphs.matchingPlatform.TrackingGraph
                  extended by net.xqhs.graphs.matchingPlatform.GMPImplementation.PrincipalGraph
                      extended by net.xqhs.graphs.context.ContextGraph
All Implemented Interfaces:
Instant.TickReceiver, Graph, GraphMatchingPlatform.PlatformPrincipalGraph, GraphMatchingPlatform.PlatformShadowGraph, net.xqhs.util.config.Configurable

public class ContextGraph
extends GMPImplementation.PrincipalGraph
implements Instant.TickReceiver


Nested Class Summary
static class ContextGraph.ContextEdge
           
 
Nested classes/interfaces inherited from class net.xqhs.graphs.matchingPlatform.TrackingGraph
TrackingGraph.Operation, TrackingGraph.Transaction
 
Nested classes/interfaces inherited from class net.xqhs.graphs.graph.SimpleGraph
SimpleGraph.NodeData
 
Nested classes/interfaces inherited from class net.xqhs.util.config.Config
net.xqhs.util.config.Config.ConfigLockedException
 
Field Summary
(package private)  CCMImplementation parent
           
(package private)  Instant.TimeKeeper theTime
           
(package private)  java.util.PriorityQueue<java.util.Map.Entry<Instant,ContextGraph.ContextEdge>> validityQueue
           
 
Fields inherited from class net.xqhs.graphs.matchingPlatform.TrackingGraph
history, isShadow, keepHistory, sequence, shadowQueues, transactionQueue
 
Fields inherited from class net.xqhs.graphs.graph.SimpleGraph
EDGE_LINE, EDGE_SEPARATOR, EDGE_TARGET, edges, nodes
 
Fields inherited from class net.xqhs.util.logging.Unit
DEFAULT_LEVEL, DEFAULT_UNIT_NAME
 
Constructor Summary
ContextGraph(CCMImplementation platform)
           
ContextGraph(CCMImplementation platform, java.util.Queue<TrackingGraph.Transaction> transactionsLink, int initialSequence, ContextGraph initialGraph)
           
 
Method Summary
protected  void addTransaction(TrackingGraph.Transaction t)
          Handles adding of new transactions to the history and to shadow graphs queues.
 ContextGraph createShadowGraph()
          Creates a new shadow graph of this graph, based on the current state of the graph.
protected  ContextGraph performOperation(GraphComponent component, TrackingGraph.Operation operation, boolean externalCall)
          Internal method for performing one operation upon the current state of the graph.
protected  ContextGraph setTimeKeeper(Instant.TimeKeeper time)
           
 void tick(Instant.TimeKeeper ticker, Instant now)
           
 
Methods inherited from class net.xqhs.graphs.matchingPlatform.TrackingGraph
add, addAll, applyTransaction, applyTransactionInternal, canIncrement, createShadow, createShadowQueue, getNextSequenceOperations, getSequence, incrementSequence, incrementSequence, incrementSequenceFastForward, incrementSequenceInternal, isShadow, keepHistory, readFrom, remove, removeAll, toString, toString, toStringBasic
 
Methods inherited from class net.xqhs.graphs.graph.SimpleGraph
addEdge, addNode, computeDistancesFromUndirected, contains, getComponents, getEdges, getInEdges, getNodes, getNodesNamed, getOutEdges, getUnitName, m, n, removeEdge, removeNode, size, toDot
 
Methods inherited from class net.xqhs.util.logging.Unit
compose, dbg, doExit, getDefaultUnitName, l, le, lf, li, lock, lockedR, lr, lr, lw, setLink, setLink, setLogDisplay, setLogEnsureNew, setLoggerClass, setLoggerType, setLoggerTypeClass, setLogLevel, setLogReporter, setUnitName, setUnitName
 
Methods inherited from class net.xqhs.util.config.Config
build, ensureLocked, locked, lockedEx, makeDefaults
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.xqhs.graphs.matchingPlatform.GraphMatchingPlatform.PlatformPrincipalGraph
getSequence
 
Methods inherited from interface net.xqhs.graphs.matchingPlatform.GraphMatchingPlatform.PlatformShadowGraph
canIncrement, getNextSequenceOperations, getSequence, incrementSequence, incrementSequence, incrementSequenceFastForward
 
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
 

Field Detail

theTime

Instant.TimeKeeper theTime

parent

CCMImplementation parent

validityQueue

java.util.PriorityQueue<java.util.Map.Entry<Instant,ContextGraph.ContextEdge>> validityQueue
Constructor Detail

ContextGraph

public ContextGraph(CCMImplementation platform)

ContextGraph

public ContextGraph(CCMImplementation platform,
                    java.util.Queue<TrackingGraph.Transaction> transactionsLink,
                    int initialSequence,
                    ContextGraph initialGraph)
Method Detail

createShadowGraph

public ContextGraph createShadowGraph()
Description copied from interface: GraphMatchingPlatform.PlatformPrincipalGraph
Creates a new shadow graph of this graph, based on the current state of the graph.

Specified by:
createShadowGraph in interface GraphMatchingPlatform.PlatformPrincipalGraph
Overrides:
createShadowGraph in class GMPImplementation.PrincipalGraph
Returns:
the newly created shadow graph.

setTimeKeeper

protected ContextGraph setTimeKeeper(Instant.TimeKeeper time)

performOperation

protected ContextGraph performOperation(GraphComponent component,
                                        TrackingGraph.Operation operation,
                                        boolean externalCall)
Description copied from class: TrackingGraph
Internal method for performing one operation upon the current state of the graph.

If externalCall is true, the method also creates a new transaction with the operation and adds it to shadow queues and to the history. Otherwise, these operations are handled elsewhere.

This method should be overridden by any extending classes needing to do anything with the newly added components. If it is the case, the overriding method should also check if they should throw the exception.

Overrides:
performOperation in class TrackingGraph
Parameters:
component - - the component contained in the operation.
operation - - the operation to perform.
externalCall - - true if the method is called by an add or remove method, and the transaction should be added.
Returns:
the graph itself.

addTransaction

protected void addTransaction(TrackingGraph.Transaction t)
Description copied from class: TrackingGraph
Handles adding of new transactions to the history and to shadow graphs queues.

Overrides:
addTransaction in class TrackingGraph
Parameters:
t - - the transaction to add.

tick

public void tick(Instant.TimeKeeper ticker,
                 Instant now)
Specified by:
tick in interface Instant.TickReceiver