public class GraphImpl<N extends Node,R extends Relation<N,N>,L extends Layer<N,R>> extends IdentifiableElementImpl implements Graph<N,R,L>
| Modifier and Type | Field and Description |
|---|---|
protected int |
approximatedNodeDegree
Approximated node degree, which is
expectedRelations /
expectedNodes |
protected int |
expectedNodes
Number of expected nodes to initialize indexes
|
protected int |
expectedRelations
Number of expected relations to initialize indexes
|
protected IndexMgr |
indexMgr
Index manager
|
delegate, EXPECTED_NUMBER_OF_LABELS| Constructor and Description |
|---|
GraphImpl() |
GraphImpl(Graph<N,R,L> delegate)
Initializes an object of type
Graph. |
GraphImpl(int expectedNodes,
int expectedRelations)
Instantiates a new graph object and sets the initial capacity for all
indexes to the passed ones
|
| Modifier and Type | Method and Description |
|---|---|
void |
addLayer(L layer)
Adds the passed layer to this graph.
|
void |
addNode(N node)
Adds the passed node to this graph and updates indexes.
|
void |
addRelation(Relation<? extends N,? extends N> relation)
Adds the passed relation to this graph and updates indexes.
|
protected void |
basicAddLayer(L layer)
This is an internally used method.
|
protected void |
basicAddNode(N node)
This is an internally used method.
|
protected void |
basicAddRelation(Relation<? extends Node,? extends Node> relation)
This is an internally used method.
|
protected void |
basicRemoveLayer(L layer)
This is an internally used method.
|
protected void |
basicRemoveNode(N node)
This is an internally used method.
|
protected void |
basicRemoveRelation(Relation<? extends N,? extends N> rel)
This is an internally used method.
|
boolean |
containsLayer(String layerId)
Returns whether this graph contains a
Layer corresponding to the
passed id. |
boolean |
containsNode(String nodeId)
Returns whether this graph contains a
Node corresponding to the
passed id. |
boolean |
containsRelation(String relationId)
Returns whether this graph contains an
Relation corresponding to
the passed id. |
protected Graph<N,R,L> |
getDelegate()
Returns the delegate object.
|
IndexMgr |
getIndexMgr()
Returns the index manager.
|
List<R> |
getInRelations(String nodeId)
Returns all relations, which have the node corresponding to the passed id
as their target node.
|
L |
getLayer(String layerId)
Returns a layer corresponding to the passed id, if such a layer is
contained in the graph.
|
Set<L> |
getLayers()
Returns a set of layers contained by this graph.
|
N |
getNode(String nodeId)
Returns a node corresponding to the passed id, if such a node is
contained in the graph.
|
List<N> |
getNodes()
Returns a list of all relations contained in this graph.
|
List<R> |
getOutRelations(String nodeId)
Returns all relations, which have the node corresponding to the passed id
as their source node.
|
R |
getRelation(String relationId)
Returns an relation corresponding to the passed id, if such an relation
is contained in the graph.
|
List<R> |
getRelations()
Returns a list of all relations contained in this graph.
|
List<R> |
getRelations(String sourceNodeId,
String targetNodeId)
Returns all relations,which connects the two passed nodes.
|
protected void |
init()
Initializes an object of type
GraphImpl. |
void |
removeLayer(L layer)
Removes the passed layer from this graph and cleans all indexes.
|
void |
removeNode(N node)
Removes the passed node from this graph and cleans all indexes.
|
void |
removeRelation(Relation<? extends N,? extends N> rel)
Removes the passed relation from this graph.
|
void |
removeRelations()
Removes all relations from this graph and cleans all indexes.
|
protected void |
update(Object oldValue,
Object container,
org.corpus_tools.salt.graph.impl.GraphImpl.UPDATE_TYPE updateType)
Updates all graph internal indexes, concerning the kind of the update
which has been made.
|
getId, getIdentifier, removeLabel, setId, setIdentifier, toStringaddLabel, basicAddLabel, basicRemoveLabel, containsLabel, getLabel, getLabel, getLabels, getLabelsByNamespace, removeAll, removeLabel, sizeLabelsclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetId, getIdentifier, setId, setIdentifieraddLabel, containsLabel, getLabel, getLabel, getLabels, getLabelsByNamespace, removeAll, removeLabel, removeLabel, sizeLabelsprotected IndexMgr indexMgr
protected int expectedNodes
protected int expectedRelations
protected int approximatedNodeDegree
expectedRelations /
expectedNodespublic GraphImpl(Graph<N,R,L> delegate)
Graph. If LabelableElementImpl.delegate is not
null, all functions of this method are delegated to the delegate object.
Setting LabelableElementImpl.delegate makes this object to a container.a - delegate object of the same type.public GraphImpl()
public GraphImpl(int expectedNodes,
int expectedRelations)
expectedNodes - expected upper bound of nodes in the graph, used for
optimizationexpectedRelations - expected upper bound of relations in the graph, used for
optimizationprotected Graph<N,R,L> getDelegate()
IdentifiableElementImplLabelableElementImpl.delegate is not null, all
functions of this method are delegated to the delegate object. Setting
LabelableElementImpl.delegate makes this object to a container.getDelegate in class IdentifiableElementImplpublic IndexMgr getIndexMgr()
Graph class. These indexes are:
Even further indexes can be added to the index manager.protected void init()
GraphImpl.
public N getNode(String nodeId)
public void addNode(N node)
Node.getGraph() will return this graph.protected void basicAddNode(N node)
Graph and Node object when an node is inserted into this
graph and to avoid an endless invocation the insertion of an relation is
split into the two methods #addNode(node) and
basicAddNode(Node). The invocation of methods is implement as
follows:
That means method#addNode(node)Node.setGraph(Graph)|| \ / || || X || \/ / \ \/basicAddNode(Node)Node#basicSetGraph(Graph)
addNode(Node) calls
basicAddNode(Node) and Node#basicSetGraph(Graph). And
method Node.setGraph(Graph) calls basicAddNode(Node) and
Node#basicSetGraph(Graph).node - node to be insertedpublic void removeNode(N node)
Node.getGraph() will return null. The double chaining between
this graph and the passed node will be cut off. If the passed node is
null nothing is done.protected void basicRemoveNode(N node)
removeNode(Node)
and basicRemoveNode(Node). which are connected as follows:
#removeNode(node)Node#setGraph(null)|| \ / || || X || \/ / \ \/basicRemoveNode(Node)Node#basicSetGraph(null)
node - the node to be removedpublic boolean containsNode(String nodeId)
Node corresponding to the
passed id.public R getRelation(String relationId)
public List<R> getRelations(String sourceNodeId, String targetNodeId)
public List<R> getInRelations(String nodeId)
public List<R> getOutRelations(String nodeId)
public void addRelation(Relation<? extends N,? extends N> relation)
Relation.getGraph() will return this graph.protected void basicAddRelation(Relation<? extends Node,? extends Node> relation)
Graph and Relation object when an relation is inserted
into this graph and to avoid an endless invocation the insertion of an
relation is split into the two methods addRelation(Relation) and
basicAddRelation(Relation). The invocation of methods is
implement as follows:
That means methodaddRelation(Relation)Relation.setGraph(Graph)|| \ / || || X || \/ / \ \/basicAddRelation(Relation)Relation#basicSetGraph(Graph)
addRelation(Relation) calls
basicAddRelation(Relation) and
Relation#basicSetGraph(Graph). And method
Relation.setGraph(Graph) calls
basicAddRelation(Relation) and
Relation#basicSetGraph(Graph).relation - relation to be insertedprotected void update(Object oldValue, Object container, org.corpus_tools.salt.graph.impl.GraphImpl.UPDATE_TYPE updateType) throws SaltException
oldValue - old valuecontainer - the object which has been updatedupdateType - type of update to be performedSaltException - in case the update could not be performedpublic void removeRelation(Relation<? extends N,? extends N> rel)
public void removeRelations()
protected void basicRemoveRelation(Relation<? extends N,? extends N> rel)
removeRelation(Relation) and
basicRemoveRelation(Relation). which are connected as follows:
#removeRelation(relation)Relation#setGraph(null)|| \ / || || X || \/ / \ \/basicRemoveRelation(Relation)Relation#basicSetGraph(null)
relation - the relation to be removedpublic boolean containsRelation(String relationId)
Relation corresponding to
the passed id.public L getLayer(String layerId)
public boolean containsLayer(String layerId)
Layer corresponding to the
passed id.public void addLayer(L layer)
Layer.getGraph() will
return this graph. If the passed layer contains nodes or relations, which
are not already contained by the graph, they will be added.protected void basicAddLayer(L layer)
Graph and Node object when an node is inserted into this
graph and to avoid an endless invocation the insertion of an relation is
split into the two methods #addNode(node) and
basicAddNode(Node). The invocation of methods is implement as
follows:
That means method#addLayer(layer)Layer.setGraph(Graph)|| \ / || || X || \/ / \ \/basicAddLayer(Layer)Layer#basicSetGraph(Graph)
addLayer(Layer) calls
basicAddLayer(Layer) and Node#basicSetGraph(Graph). And
method Layer.setGraph(Graph) calls basicAddLayer(Layer)
and Layer#basicSetGraph(Graph).node - node to be insertedpublic void removeLayer(L layer)
Layer.getGraph() will return null. The double chaining between
this graph and the passed layer will be cut off. If the passed layer is
null nothing happens.protected void basicRemoveLayer(L layer)
removeLayer(Layer)
and basicRemoveLayer(Layer). which are connected as follows:
#removeLayer(layer)Layer#setGraph(null)|| \ / || || X || \/ / \ \/basicRemoveLayer(Layer)Layer#basicSetGraph(null)
node - the node to be removedCopyright © 2009–2020 Humboldt-Universität zu Berlin, INRIA. All rights reserved.