de.grogra.graph.impl
public class GraphManager extends PersistenceManager implements Graph, SharedObjectProvider
Lockable.DeadLockExceptionSharedObjectProvider.Binding| Modifier and Type | Field and Description |
|---|---|
LongToIntHashMap |
baseMap
A mapping of each node ID (participating in integration) to an index into
the rate vector is stored here.
|
static I18NBundle |
I18N |
static java.lang.String |
META_GRAPH |
double[] |
rate
Stores a reference to the rate vector.
|
static GraphManager |
STATIC |
static GraphState |
STATIC_STATE |
makeLockBRANCH_EDGE, CONTAINMENT_EDGE, CONTAINMENT_END_EDGE, EDGENODE_IN_EDGE, EDGENODE_OUT_EDGE, ELLIPSE_SYMBOL, MAIN_GRAPH, MARK_EDGE, MIN_NORMAL_BIT_INDEX, MIN_UNUSED_EDGE, MIN_UNUSED_EDGE_BIT, NOTIFIES_EDGE, PERSISTENT, PERSISTENT_DELETED, RECTANGLE_SYMBOL, REFINEMENT_EDGE, RHOMBUS_SYMBOL, ROUND_RECTANGLE_SYMBOL, SPECIAL_EDGE_MASK, SPECIAL_EDGE_OF_SOURCE_BIT, STD_EDGE_5, STD_EDGE_6, SUCCESSOR_EDGE, TRANSIENT| Constructor and Description |
|---|
GraphManager(PersistenceConnection cx,
java.lang.String key,
boolean logLifeCycle,
boolean checkLock) |
| Modifier and Type | Method and Description |
|---|---|
void |
accept(java.lang.Object start,
Visitor v,
ArrayPath placeInPath) |
static void |
acceptGraph(Node root,
Visitor v,
ArrayPath pathToUse) |
void |
addAttributeChangeListener(AttributeChangeListener l) |
void |
addAttributeChangeListener(java.lang.Object object,
boolean asNode,
AttributeChangeListener l) |
void |
addChangeBoundaryListener(ChangeBoundaryListener l) |
void |
addEdgeChangeListener(EdgeChangeListener l) |
void |
addEdgeChangeListener(java.lang.Object object,
boolean asNode,
EdgeChangeListener l) |
void |
addMetaNode(Node node,
Transaction t) |
void |
addSharedObjectListener(java.beans.PropertyChangeListener l) |
int |
allocateBitMark(boolean resetOnDispose) |
int |
allocateObjectMark(boolean resetOnDispose) |
protected void |
completeTransaction(Transaction t,
boolean commit) |
boolean |
contains(Node root,
java.lang.String name)
Check if the graph contains a node with the specified name.
|
BooleanMap |
createBooleanMap() |
<V> ObjectMap<V> |
createObjectMap() |
GraphState |
createStaticState(ThreadContext tc) |
protected Transaction |
createTransaction(java.lang.Thread thread) |
protected TransactionApplier |
createXAApplier() |
void |
disposeBitMark(int handle,
boolean resetAll) |
void |
disposeBitMark(int handle,
boolean resetAll,
boolean onlyNodes) |
void |
disposeObjectMark(int handle,
boolean resetAll) |
void |
disposeObjectMark(int handle,
boolean resetAll,
boolean onlyNodes) |
void |
dumpNodeStatistics(java.io.OutputStream out) |
void |
dumpNodeStatistics(java.io.PrintWriter out) |
protected void |
enterWriteLock() |
protected void |
executeInAllowedThread(java.lang.Runnable r) |
AttributeAccessor |
getAccessor(java.lang.Object object,
boolean asNode,
Attribute attribute)
Returns an attribute accessor for the given attribute on the given
object.
|
Attribute[] |
getAttributes(java.lang.Object object,
boolean asNode)
Returns the set of attributes which are available for the given object.
|
int |
getColor(java.lang.Object object,
boolean asNode) |
Attribute[] |
getDependent(java.lang.Object object,
boolean asNode,
Attribute a)
Returns the set of attributes whose values depend on the given
attribute
a for the given object. |
java.lang.Object |
getDescription(java.lang.Object object,
boolean asNode,
java.lang.String type)
Returns a description for the given object.
|
int |
getEdgeBits(java.lang.Object edge)
Returns the edge bits of an edge.
|
Extent |
getExtent(java.lang.Class type) |
Extent |
getExtent(Type type) |
java.lang.Object |
getFirstEdge(java.lang.Object node)
Returns the first edge of the linked list of edges of
node. |
int |
getGraphSize()
Number of nodes in the main graph.
|
int |
getGraphSize(java.lang.String key)
Number of nodes of the specified graph.
|
long |
getId(java.lang.Object node)
Returns a unique identifier for the given
node. |
Instantiator |
getInstantiator(java.lang.Object node) |
int |
getLifeCycleState(java.lang.Object object,
boolean asNode)
Returns the life cycle state of the given object as part of this graph.
|
GraphState |
getMainState()
Returns the main graph state.
|
int |
getMetaGraphSize()
Number of nodes in the meta graph.
|
java.lang.String |
getName(java.lang.Object object,
boolean asNode)
Returns a name for the given object.
|
java.lang.Object |
getNextEdge(java.lang.Object edge,
java.lang.Object parentNode)
Returns the edge after
edge in the linked list
of edges of node. |
java.lang.Object |
getNodeForId(long id)
Returns the node identified by
id. |
Node |
getNodeForName(Node root,
java.lang.String name)
Check if the graph contains a node with the specified name and possibly returns it.
|
Node |
getNodeForName(java.lang.String name) |
Node |
getObject(long id) |
java.lang.Object |
getObjectForName(boolean node,
java.lang.String name)
Returns the object with the given name.
|
ObjectAttribute |
getParentAttribute()
Defines the derived attribute which has as value the parent object.
|
java.lang.Object |
getProperty(java.lang.String key) |
java.lang.String |
getProviderName() |
Node |
getRoot()
Returns the root node of the
Graph.MAIN_GRAPH of this graph. |
java.lang.Object |
getRoot(java.lang.String key)
Returns the root node for the given root key.
|
java.lang.String[] |
getRootKeys()
Returns the root keys for the graph.
|
void |
getScales(java.util.ArrayList<ScaleClass> scales) |
void |
getScalesInternal(Node node,
java.util.ArrayList<ScaleClass> scales) |
int |
getScaleValue(Node node)
Get node in type graph representing the type of the input node
|
java.lang.Object |
getSourceNode(java.lang.Object edge)
Returns the source node of
edge. |
SpecialEdgeDescriptor[] |
getSpecialEdgeDescriptors(java.lang.Object node,
boolean asSource) |
Node |
getSRoot()
Returns the root of the Structure of scales
|
java.util.Map |
getStateMap() |
int |
getSymbol(java.lang.Object object,
boolean asNode) |
java.lang.Object |
getTargetNode(java.lang.Object edge)
Returns the target node of
edge. |
EdgePattern |
getTreePattern()
Defines the pattern used for the construction of this graph's tree.
|
java.lang.Object |
getTypeNode(Node node)
Get node in type graph representing the type of the input node
|
Node |
getTypeRoot()
Returns the root of the type graph for the graph
|
boolean[] |
getVisibleScales() |
void |
initMainState(java.util.concurrent.Executor sync) |
protected void |
invokeRun(LockProtectedRunnable task,
boolean sameThread,
Lock lock) |
protected boolean |
isAllowedThread(boolean write) |
protected void |
leaveWriteLock() |
void |
logDataOnPersistenceChange(boolean value) |
protected void |
makePersistentImpl(PersistenceCapable o,
long id,
Transaction t) |
protected void |
makeTransientImpl(PersistenceCapable o,
Transaction t) |
protected void |
prepareCompletion(Transaction t,
boolean commit) |
long |
prepareId(PersistenceCapable node) |
void |
readExtent(PersistenceInputStream in) |
ResolvableReference |
readReference(PersistenceInput in) |
void |
rebuildExtents() |
void |
removeAllFromExtent()
Removes all nodes in graph from extent.
|
void |
removeAttributeChangeListener(AttributeChangeListener l) |
void |
removeAttributeChangeListener(java.lang.Object object,
boolean asNode,
AttributeChangeListener l) |
void |
removeChangeBoundaryListener(ChangeBoundaryListener l) |
void |
removeEdgeChangeListener(EdgeChangeListener l) |
void |
removeEdgeChangeListener(java.lang.Object object,
boolean asNode,
EdgeChangeListener l) |
void |
removeMetaNode(Node node,
Transaction t) |
void |
removeSharedObjectListener(java.beans.PropertyChangeListener l) |
void |
setMakePersistentTransitive(boolean value) |
void |
setProperty(java.lang.String key,
java.lang.Object value) |
void |
setRoot(java.lang.String key,
Node root) |
void |
setVisibleScales(boolean[] visibleScales) |
void |
suppressLogging(boolean value) |
java.lang.String |
toXLString(boolean qualified)
Parses the GraphManager.MAIN_GRAPH and generates a textual representation of it.
|
java.lang.String |
toXLString(boolean qualified,
boolean ids)
Parses the GraphManager.MAIN_GRAPH and generates a textual representation of it.
|
java.lang.String |
toXLString(boolean qualified,
java.lang.String rootKey,
boolean ids)
Parses the graph from the rootKey and generates a textual representation of it.
|
protected void |
transactionApplied(Transaction.Data xa,
boolean rollback,
Transaction t) |
void |
writeExtent(GraphOutput out,
Node root) |
void |
writeExtent(PersistenceOutputStream out) |
void |
writeObject(Shareable object,
PersistenceOutput out) |
addXAListener, beginTransaction, close, getActiveTransaction, getBindings, getConnection, getId, getLog, getStamp, getTransaction, getTransactionData, getTransactions, idUsed, initNonlocalTransactionNotifier, localTransactionCommitted, localTransactionRolledBack, makePersistent, makePersistent, makeTransient, nextId, removeXAListener, transactionCommitted, undoexecute, execute, executeForcedly, executeForcedly, getMaxWaitingTime, getQueueLength, isLockedclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitexecute, execute, executeForcedly, executeForcedly, getMaxWaitingTime, getQueueLength, isLockedpublic final LongToIntHashMap baseMap
public static final I18NBundle I18N
public static final java.lang.String META_GRAPH
public double[] rate
de.grogra.rgg.model.PropertyRuntime.GraphProperty#defRateAssign()public static final GraphManager STATIC
public static final GraphState STATIC_STATE
public GraphManager(PersistenceConnection cx, java.lang.String key, boolean logLifeCycle, boolean checkLock)
public void addAttributeChangeListener(AttributeChangeListener l)
addAttributeChangeListener in interface Graphpublic void addAttributeChangeListener(java.lang.Object object,
boolean asNode,
AttributeChangeListener l)
addAttributeChangeListener in interface Graphpublic void addChangeBoundaryListener(ChangeBoundaryListener l)
addChangeBoundaryListener in interface Graphpublic void addEdgeChangeListener(EdgeChangeListener l)
addEdgeChangeListener in interface Graphpublic void addEdgeChangeListener(java.lang.Object object,
boolean asNode,
EdgeChangeListener l)
addEdgeChangeListener in interface Graphpublic void addMetaNode(Node node, Transaction t)
public void addSharedObjectListener(java.beans.PropertyChangeListener l)
public final int allocateBitMark(boolean resetOnDispose)
allocateBitMark in class PersistenceManagerpublic final int allocateObjectMark(boolean resetOnDispose)
allocateObjectMark in class PersistenceManagerprotected void completeTransaction(Transaction t, boolean commit)
completeTransaction in class PersistenceManagerpublic boolean contains(Node root, java.lang.String name)
String - nameNode - rootpublic BooleanMap createBooleanMap()
createBooleanMap in interface Graphpublic <V> ObjectMap<V> createObjectMap()
createObjectMap in interface Graphpublic GraphState createStaticState(ThreadContext tc)
protected Transaction createTransaction(java.lang.Thread thread)
createTransaction in class PersistenceManagerprotected TransactionApplier createXAApplier()
createXAApplier in class PersistenceManagerpublic final void disposeBitMark(int handle,
boolean resetAll)
disposeBitMark in class PersistenceManagerpublic final void disposeBitMark(int handle,
boolean resetAll,
boolean onlyNodes)
public final void disposeObjectMark(int handle,
boolean resetAll)
disposeObjectMark in class PersistenceManagerpublic final void disposeObjectMark(int handle,
boolean resetAll,
boolean onlyNodes)
public void dumpNodeStatistics(java.io.OutputStream out)
public void dumpNodeStatistics(java.io.PrintWriter out)
protected void enterWriteLock()
enterWriteLock in class LockableImplprotected void executeInAllowedThread(java.lang.Runnable r)
executeInAllowedThread in class LockableImplpublic AttributeAccessor getAccessor(java.lang.Object object, boolean asNode, Attribute attribute)
GraphgetAccessor in interface Graphobject - the objectasNode - true if object is a node,
false if object is an edgeattribute - the attributepublic Attribute[] getAttributes(java.lang.Object object, boolean asNode)
GraphgetAttributes in interface Graphobject - the objectasNode - true if object is a node,
false if object is an edgepublic int getColor(java.lang.Object object,
boolean asNode)
public Attribute[] getDependent(java.lang.Object object, boolean asNode, Attribute a)
Grapha for the given object.getDependent in interface Graphobject - the objectasNode - true if object is a node,
false if object is an edgea - the attributepublic java.lang.Object getDescription(java.lang.Object object,
boolean asNode,
java.lang.String type)
Graphtype; it is interpreted as in
Described.getDescription(String).getDescription in interface Graphobject - the objectasNode - true if object is a node,
false if object is an edgetype - the type of descriptionnullpublic int getEdgeBits(java.lang.Object edge)
GraphgetEdgeBits in interface Graphedge - the edgeGraphpublic Extent getExtent(java.lang.Class type)
public java.lang.Object getFirstEdge(java.lang.Object node)
Graphnode.getFirstEdge in interface Graphnode - the common node of the edges of the linked listGraph,
Graph.getNextEdge(Object, Object)public int getGraphSize()
public int getGraphSize(java.lang.String key)
graph - identification key (one of: MAIN_GRAPH, COMPONENT_GRAPH, META_GRAPH)public long getId(java.lang.Object node)
Graphnode.getId in interface Graphnode - a nodeGraph.getNodeForId(long)public Instantiator getInstantiator(java.lang.Object node)
getInstantiator in interface Graphpublic int getLifeCycleState(java.lang.Object object,
boolean asNode)
GraphgetLifeCycleState in interface Graphobject - the object to testasNode - true if object is a node,
false if object is an edgeGraph.PERSISTENT, Graph.PERSISTENT_DELETED,
Graph.TRANSIENTpublic GraphState getMainState()
GraphgetMainState in interface GraphGraphpublic int getMetaGraphSize()
public java.lang.String getName(java.lang.Object object,
boolean asNode)
GraphgetName in interface Graphobject - the objectasNode - true if object is a node,
false if object is an edgeGraph.getObjectForName(boolean, String)public java.lang.Object getNextEdge(java.lang.Object edge,
java.lang.Object parentNode)
Graphedge in the linked list
of edges of node.getNextEdge in interface Graphedge - the previous edge in the linked listparentNode - the common node of the edges of the linked listGraph,
Graph.getFirstEdge(Object)public java.lang.Object getNodeForId(long id)
Graphid.getNodeForId in interface Graphid - an identifiernull if id
identifies no nodeGraph.getId(Object)public Node getNodeForName(Node root, java.lang.String name)
String - nameNode - rootpublic Node getNodeForName(java.lang.String name)
public Node getObject(long id)
getObject in class PersistenceManagerpublic java.lang.Object getObjectForName(boolean node,
java.lang.String name)
Graphnull is returned.getObjectForName in interface Graphnode - true if a node of the given name is to be found,
false if an edge is to be foundname - the name of the objectnull if no such object existsGraph.getName(Object, boolean)public ObjectAttribute getParentAttribute()
GraphgetParentAttribute in interface GraphGraph,
Graph.getTreePattern()public java.lang.Object getProperty(java.lang.String key)
public java.lang.String getProviderName()
getProviderName in interface SharedObjectProviderpublic Node getRoot()
Graph.MAIN_GRAPH of this graph.public java.lang.Object getRoot(java.lang.String key)
GraphgetRoot in interface Graphkey - a root key, one of Graph.getRootKeys()key,
or null if no such root node existsGraphpublic java.lang.String[] getRootKeys()
GraphgetRootKeys in interface GraphGraph,
Graph.getRoot(String)public void getScales(java.util.ArrayList<ScaleClass> scales)
public void getScalesInternal(Node node, java.util.ArrayList<ScaleClass> scales)
public int getScaleValue(Node node)
node - public java.lang.Object getSourceNode(java.lang.Object edge)
Graphedge.getSourceNode in interface Graphedge - an edgeGraphpublic SpecialEdgeDescriptor[] getSpecialEdgeDescriptors(java.lang.Object node, boolean asSource)
getSpecialEdgeDescriptors in interface Graphpublic Node getSRoot()
g - GraphManager (i.e. the graph) instancepublic java.util.Map getStateMap()
getStateMap in interface Graphpublic int getSymbol(java.lang.Object object,
boolean asNode)
public java.lang.Object getTargetNode(java.lang.Object edge)
Graphedge.getTargetNode in interface Graphedge - an edgeGraphpublic EdgePattern getTreePattern()
GraphgetTreePattern in interface GraphGraph,
Graph.getParentAttribute()public java.lang.Object getTypeNode(Node node)
node - public Node getTypeRoot()
g - GraphManager (i.e. the graph) instancepublic boolean[] getVisibleScales()
public void initMainState(java.util.concurrent.Executor sync)
protected void invokeRun(LockProtectedRunnable task, boolean sameThread, Lock lock)
invokeRun in class LockableImplprotected boolean isAllowedThread(boolean write)
isAllowedThread in class LockableImplprotected void leaveWriteLock()
leaveWriteLock in class LockableImplpublic void logDataOnPersistenceChange(boolean value)
protected void makePersistentImpl(PersistenceCapable o, long id, Transaction t)
makePersistentImpl in class PersistenceManagerprotected void makeTransientImpl(PersistenceCapable o, Transaction t)
makeTransientImpl in class PersistenceManagerprotected void prepareCompletion(Transaction t, boolean commit)
prepareCompletion in class PersistenceManagerpublic long prepareId(PersistenceCapable node)
prepareId in class PersistenceManagerpublic void readExtent(PersistenceInputStream in) throws java.io.IOException
readExtent in class PersistenceManagerjava.io.IOExceptionpublic ResolvableReference readReference(PersistenceInput in) throws java.io.IOException
readReference in interface SharedObjectProviderjava.io.IOExceptionpublic void rebuildExtents()
public void removeAllFromExtent()
public void removeAttributeChangeListener(AttributeChangeListener l)
removeAttributeChangeListener in interface Graphpublic void removeAttributeChangeListener(java.lang.Object object,
boolean asNode,
AttributeChangeListener l)
removeAttributeChangeListener in interface Graphpublic void removeChangeBoundaryListener(ChangeBoundaryListener l)
removeChangeBoundaryListener in interface Graphpublic void removeEdgeChangeListener(EdgeChangeListener l)
removeEdgeChangeListener in interface Graphpublic void removeEdgeChangeListener(java.lang.Object object,
boolean asNode,
EdgeChangeListener l)
removeEdgeChangeListener in interface Graphpublic void removeMetaNode(Node node, Transaction t)
public void removeSharedObjectListener(java.beans.PropertyChangeListener l)
public void setMakePersistentTransitive(boolean value)
public void setProperty(java.lang.String key,
java.lang.Object value)
public void setRoot(java.lang.String key,
Node root)
public void setVisibleScales(boolean[] visibleScales)
public void suppressLogging(boolean value)
public java.lang.String toXLString(boolean qualified)
qualified - public java.lang.String toXLString(boolean qualified,
boolean ids)
qualified - ids - public java.lang.String toXLString(boolean qualified,
java.lang.String rootKey,
boolean ids)
qualified - rootKey - {GraphManager.MAIN_GRAPH, GraphManager.META_GRAPH, GraphManager.COMPONENT_GRAPH}protected void transactionApplied(Transaction.Data xa, boolean rollback, Transaction t)
transactionApplied in class PersistenceManagerpublic void writeExtent(GraphOutput out, Node root) throws java.io.IOException
java.io.IOExceptionpublic void writeExtent(PersistenceOutputStream out) throws java.io.IOException
writeExtent in class PersistenceManagerjava.io.IOExceptionpublic void writeObject(Shareable object, PersistenceOutput out) throws java.io.IOException
writeObject in interface SharedObjectProviderjava.io.IOException