|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectgalois.objects.graph.VoidGraphToObjectGraphAdapter<N,E>
public final class VoidGraphToObjectGraphAdapter<N extends GObject,E>
| Constructor Summary | |
|---|---|
VoidGraphToObjectGraphAdapter(Graph<N> g)
|
|
| Method Summary | ||
|---|---|---|
void |
access(byte flags)
Accesses this object. |
|
boolean |
add(GNode<N> n)
Adds a node to the graph. |
|
boolean |
add(GNode<N> n,
byte flags)
Adds a node to the graph. |
|
boolean |
addEdge(GNode<N> src,
GNode<N> dst,
E data)
Adds an edge to the graph containing the specified data. |
|
boolean |
addEdge(GNode<N> src,
GNode<N> dst,
E data,
byte flags)
Adds an edge to the graph containing the specified data. |
|
boolean |
addNeighbor(GNode<N> src,
GNode<N> dst)
Adds an edge between the two nodes. |
|
boolean |
addNeighbor(GNode<N> src,
GNode<N> dst,
byte flags)
Adds an edge between the two nodes. |
|
boolean |
contains(GNode<N> n)
Checks if a node is in the graph All the Galois runtime actions (e.g., conflict detection) will be performed when the method is executed. |
|
boolean |
contains(GNode<N> n,
byte flags)
Checks if a node is in the graph |
|
GNode<N> |
createNode(N n)
Creates a new node holding the indicated data. |
|
GNode<N> |
createNode(N n,
byte flags)
Creates a new node holding the indicated data. |
|
E |
getEdgeData(GNode<N> src,
GNode<N> dst)
Retrieves the data associated with an edge. |
|
E |
getEdgeData(GNode<N> src,
GNode<N> dst,
byte flags)
Retrieves the data associated with an edge. |
|
E |
getEdgeData(GNode<N> src,
GNode<N> dst,
byte nodeFlags,
byte dataFlags)
Retrieves the data associated with an edge. |
|
boolean |
hasNeighbor(GNode<N> src,
GNode<N> dst)
Checks if there is an edge between the two nodes in this graph. |
|
boolean |
hasNeighbor(GNode<N> src,
GNode<N> dst,
byte flags)
Checks if there is an edge between the two nodes in this graph. |
|
int |
inNeighborsSize(GNode<N> src)
Computes the number of in neighbors of the node, i.e., the number of different vertices that have an outgoing edge that ends at the indicated node. |
|
int |
inNeighborsSize(GNode<N> src,
byte flags)
Computes the number of in neighbors of the node, i.e., the number of different vertices that have an outgoing edge that ends at the indicated node. |
|
boolean |
isDirected()
Tests if the current graph is directed. |
|
|
map(Lambda2Void<GNode<N>,A1> body,
A1 arg1)
Applies a function to each element of this mappable instance serially. |
|
|
map(Lambda2Void<GNode<N>,A1> body,
A1 arg1,
byte flags)
Applies a function to each element of this mappable instance serially. |
|
|
map(Lambda3Void<GNode<N>,A1,A2> body,
A1 arg1,
A2 arg2)
Applies a function to each element of this mappable instance serially. |
|
|
map(Lambda3Void<GNode<N>,A1,A2> body,
A1 arg1,
A2 arg2,
byte flags)
Applies a function to each element of this mappable instance serially. |
|
void |
map(LambdaVoid<GNode<N>> body)
Applies a function to each element of this mappable instance serially. |
|
void |
map(LambdaVoid<GNode<N>> body,
byte flags)
Applies a function to each element of this mappable instance serially. |
|
void |
mapInNeighbors(GNode<N> src,
LambdaVoid<GNode<N>> body)
Applies the function passed as parameter to every in neighbor of the given node exactly once. |
|
void |
mapInNeighbors(GNode<N> src,
LambdaVoid<GNode<N>> body,
byte flags)
Applies the function passed as parameter to every in neighbor of the given node exactly once. |
|
|
mapInternal(Lambda2Void<GNode<N>,A1> body,
MapInternalContext ctx,
A1 arg1)
Applies a function to each element of this mappable instance concurrently. |
|
|
mapInternal(Lambda3Void<GNode<N>,A1,A2> body,
MapInternalContext ctx,
A1 arg1,
A2 arg2)
Applies a function to each element of this mappable instance concurrently. |
|
void |
mapInternal(LambdaVoid<GNode<N>> body,
MapInternalContext ctx)
Applies a function to each element of this mappable instance concurrently. |
|
void |
mapInternalDone()
Signals to instance that concurrent iteration is complete. |
|
int |
outNeighborsSize(GNode<N> src)
Computes the number of out neighbors of the node, i.e., the number of different vertices that have an incoming edge that starts at the indicated node. |
|
int |
outNeighborsSize(GNode<N> src,
byte flags)
Computes the number of out neighbors of the node, i.e., the number of different vertices that have an incoming edge that starts at the indicated node. |
|
boolean |
remove(GNode<N> n)
Removes a node from the graph along with all its outgoing/incoming edges. |
|
boolean |
remove(GNode<N> n,
byte flags)
Removes a node from the graph along with all its outgoing/incoming edges. |
|
boolean |
removeNeighbor(GNode<N> src,
GNode<N> dst)
Removes the edge between the two nodes from this graph. |
|
boolean |
removeNeighbor(GNode<N> src,
GNode<N> dst,
byte flags)
Removes the edge between the two nodes from this graph. |
|
E |
setEdgeData(GNode<N> src,
GNode<N> dst,
E d)
Sets the data associated with an edge. |
|
E |
setEdgeData(GNode<N> src,
GNode<N> dst,
E d,
byte flags)
Sets the data associated with an edge. |
|
int |
size()
Returns the number of nodes in this graph. |
|
int |
size(byte flags)
Returns the number of nodes in this graph. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public VoidGraphToObjectGraphAdapter(Graph<N> g)
| Method Detail |
|---|
public final GNode<N> createNode(N n)
GraphGraph.add(GNode, byte)),
createNode in interface Graph<N extends GObject>n - data contained in the new node.
public final GNode<N> createNode(N n,
byte flags)
GraphGraph.add(GNode, byte)),
createNode in interface Graph<N extends GObject>n - data contained in the new node.flags - Galois runtime actions (e.g., conflict detection) that need to be executed
upon invocation of this method. See MethodFlag
public final boolean add(GNode<N> n)
Graph
add in interface Graph<N extends GObject>n - node created by the current graph
public final boolean add(GNode<N> n,
byte flags)
Graph
add in interface Graph<N extends GObject>n - node created by the current graphflags - Galois runtime actions (e.g., conflict detection) that need to be executed
upon invocation of this method. See MethodFlag
public final boolean remove(GNode<N> n)
Graph
remove in interface Graph<N extends GObject>n - node to be removed
public final boolean remove(GNode<N> n,
byte flags)
Graph
remove in interface Graph<N extends GObject>n - node to be removedflags - Galois runtime actions (e.g., conflict detection) that need to be executed
upon invocation of this method. See MethodFlag
public final boolean contains(GNode<N> n)
Graph
contains in interface Graph<N extends GObject>n - the node to check for
public final boolean contains(GNode<N> n,
byte flags)
Graph
contains in interface Graph<N extends GObject>n - the node to check forflags - Galois runtime actions (e.g., conflict detection) that need to be executed
upon invocation of this method. See MethodFlag
public final int size()
Graph
size in interface Graph<N extends GObject>public final int size(byte flags)
Graph
size in interface Graph<N extends GObject>flags - Galois runtime actions (e.g., conflict detection) that need to be executed
upon invocation of this method. See MethodFlag
public final boolean addNeighbor(GNode<N> src,
GNode<N> dst)
Graph
addNeighbor in interface Graph<N extends GObject>src - the source of the edgedst - the destination of the edge
public final boolean addNeighbor(GNode<N> src,
GNode<N> dst,
byte flags)
Graph
addNeighbor in interface Graph<N extends GObject>src - the source of the edgedst - the destination of the edgeflags - Galois runtime actions (e.g., conflict detection) that need to be executed
upon invocation of this method. See MethodFlag
public final boolean removeNeighbor(GNode<N> src,
GNode<N> dst)
Graph
removeNeighbor in interface Graph<N extends GObject>src - the source of the edgedst - the target of the edge
public final boolean removeNeighbor(GNode<N> src,
GNode<N> dst,
byte flags)
Graph
removeNeighbor in interface Graph<N extends GObject>src - the source of the edgedst - the target of the edgeflags - Galois runtime actions (e.g., conflict detection) that need to be executed
upon invocation of this method. See MethodFlag
public final boolean hasNeighbor(GNode<N> src,
GNode<N> dst)
Graph
hasNeighbor in interface Graph<N extends GObject>src - the source of the edgedst - the target of the edge
public final boolean hasNeighbor(GNode<N> src,
GNode<N> dst,
byte flags)
Graph
hasNeighbor in interface Graph<N extends GObject>src - the source of the edgedst - the target of the edgeflags - Galois runtime actions (e.g., conflict detection) that need to be executed
upon invocation of this method. See MethodFlag
public final void mapInNeighbors(GNode<N> src,
LambdaVoid<GNode<N>> body)
Graphnode in graph
graph.mapInNeighbors(node, new LambdaVoid<GNode<Integer>>() {
public void call(GNode<Integer> inNeighbor) {
System.out.println(inNeighbor.getData());
}
}
If you wish to apply a function to the out neighbors, please use GNode#map
All the Galois runtime actions (e.g., conflict detection) will be performed when
the method is executed.
mapInNeighbors in interface Graph<N extends GObject>src - a node in the graphbody - the function to be applied once to each incoming neighborMappable.map(util.fn.LambdaVoid)
public final void mapInNeighbors(GNode<N> src,
LambdaVoid<GNode<N>> body,
byte flags)
Graphnode in graph
graph.mapInNeighbors(node, new LambdaVoid<GNode<Integer>>() {
public void call(GNode<Integer> inNeighbor) {
System.out.println(inNeighbor.getData());
}
}
If you wish to apply a function to the out neighbors, please use GNode#map
mapInNeighbors in interface Graph<N extends GObject>src - a node in the graphbody - the function to be applied once to each incoming neighborflags - Galois runtime actions (e.g., conflict detection) that need to be executed
upon invocation of this method. See MethodFlagMappable.map(util.fn.LambdaVoid) public final int inNeighborsSize(GNode<N> src)
Graph
inNeighborsSize in interface Graph<N extends GObject>src - a node in the graph
public final int inNeighborsSize(GNode<N> src,
byte flags)
Graph
inNeighborsSize in interface Graph<N extends GObject>src - a node in the graphflags - Galois runtime actions (e.g., conflict detection) that need to be executed
upon invocation of this method. See MethodFlag
public final int outNeighborsSize(GNode<N> src)
Graph
outNeighborsSize in interface Graph<N extends GObject>src - a node in the graph
public final int outNeighborsSize(GNode<N> src,
byte flags)
Graph
outNeighborsSize in interface Graph<N extends GObject>src - a node in the graphflags - Galois runtime actions (e.g., conflict detection) that need to be executed
upon invocation of this method. See MethodFlag
public final boolean isDirected()
Graph
isDirected in interface Graph<N extends GObject>
public final void mapInternal(LambdaVoid<GNode<N>> body,
MapInternalContext ctx)
Mappable
mapInternal in interface Mappable<GNode<N extends GObject>>body - function to apply to each elementGaloisRuntime.foreach(Mappable, LambdaVoid)
public final <A1> void mapInternal(Lambda2Void<GNode<N>,A1> body,
MapInternalContext ctx,
A1 arg1)
Mappable
mapInternal in interface Mappable<GNode<N extends GObject>>body - function to apply to each elementarg1 - additional argument to functionGaloisRuntime.foreach(Mappable, Lambda2Void, Object)
public final <A1,A2> void mapInternal(Lambda3Void<GNode<N>,A1,A2> body,
MapInternalContext ctx,
A1 arg1,
A2 arg2)
Mappable
mapInternal in interface Mappable<GNode<N extends GObject>>body - function to apply to each elementarg1 - additional argument to functionarg2 - additional argument to functionGaloisRuntime.foreach(Mappable, Lambda3Void, Object, Object)public final void mapInternalDone()
Mappable
mapInternalDone in interface Mappable<GNode<N extends GObject>>public final void map(LambdaVoid<GNode<N>> body)
Mappable
map in interface Mappable<GNode<N extends GObject>>body - function to apply to each element
public final void map(LambdaVoid<GNode<N>> body,
byte flags)
Mappable
map in interface Mappable<GNode<N extends GObject>>body - function to apply to each elementflags - Galois runtime actions (e.g., conflict detection) that need to be executed
upon invocation of this method. See MethodFlag
public final <A1> void map(Lambda2Void<GNode<N>,A1> body,
A1 arg1)
Mappable
map in interface Mappable<GNode<N extends GObject>>body - function to apply to each elementarg1 - additional argument to function
public final <A1> void map(Lambda2Void<GNode<N>,A1> body,
A1 arg1,
byte flags)
Mappable
map in interface Mappable<GNode<N extends GObject>>body - function to apply to each elementarg1 - argument to functionflags - Galois runtime actions (e.g., conflict detection) that need to be executed
upon invocation of this method. See MethodFlag
public final <A1,A2> void map(Lambda3Void<GNode<N>,A1,A2> body,
A1 arg1,
A2 arg2)
Mappable
map in interface Mappable<GNode<N extends GObject>>body - function to apply to each elementarg1 - additional argument to functionarg2 - additional argument to function
public final <A1,A2> void map(Lambda3Void<GNode<N>,A1,A2> body,
A1 arg1,
A2 arg2,
byte flags)
Mappable
map in interface Mappable<GNode<N extends GObject>>body - function to apply to each elementarg1 - additional argument to functionarg2 - additional argument to functionflags - Galois runtime actions (e.g., conflict detection) that need to be executed
upon invocation of this method. See MethodFlag
public final boolean addEdge(GNode<N> src,
GNode<N> dst,
E data)
ObjectGraph
addEdge in interface ObjectGraph<N extends GObject,E>src - the source node of the edge.dst - the destination node of the edge.data - information to be stored in the new edge.
public final boolean addEdge(GNode<N> src,
GNode<N> dst,
E data,
byte flags)
ObjectGraph
addEdge in interface ObjectGraph<N extends GObject,E>src - the source node of the edgedst - the destination node of the edgedata - information to be stored in the new edgeflags - Galois runtime actions (e.g., conflict detection) that need to be executed
upon invocation of this method. See MethodFlag
public final E getEdgeData(GNode<N> src,
GNode<N> dst)
ObjectGraphBe aware that this method will return null in two cases:
In order to distinguish between the two cases, use Graph.hasNeighbor(GNode, GNode)
All the Galois runtime actions (e.g., conflict detection) will be performed when the method is executed.
getEdgeData in interface ObjectGraph<N extends GObject,E>src - the source node of the edgedst - the destination node of the edge
public final E getEdgeData(GNode<N> src,
GNode<N> dst,
byte flags)
ObjectGraphObjectGraph.getEdgeData(GNode, GNode, byte, byte)
passing flags to both flag parameters.
Be aware that this method will return null in two cases:
In order to distinguish between the two cases, use Graph.hasNeighbor(GNode, GNode)
getEdgeData in interface ObjectGraph<N extends GObject,E>src - the source node of the edgedst - the destination node of the edgeflags - Galois runtime actions (e.g., conflict detection) that need to be executed
upon invocation of this method. See MethodFlag
public final E getEdgeData(GNode<N> src,
GNode<N> dst,
byte nodeFlags,
byte dataFlags)
ObjectGraphGObject.access(byte) on the returned data.
Be aware that this method will return null in two cases:
In order to distinguish between the two cases, use Graph.hasNeighbor(GNode, GNode)
Recall that an edge maintains information about two vertices.
This is separate from the data itself. For example,
getEdgeData(src, dst, MethodFlag.NONE, MethodFlag.SAVE_UNDO)
does not acquire an abstract lock on the vertices (perhaps because
they were returned by a call to Mappable.map(util.fn.LambdaVoid)), but it
saves undo information on the returned data in case the iteration needs to
be rolled back.
getEdgeData in interface ObjectGraph<N extends GObject,E>src - the source node of the edgedst - the destination node of the edgenodeFlags - Galois runtime actions (e.g., conflict detection) that need to be executed
upon invocation of this method on the edge itself.
See MethodFlagdataFlags - Galois runtime actions (e.g., conflict detection) that need to be executed
upon invocation of this method on the data contained in this edge.
See MethodFlag
public final E setEdgeData(GNode<N> src,
GNode<N> dst,
E d)
ObjectGraphAll the Galois runtime actions (e.g., conflict detection) will be performed when the method is executed.
setEdgeData in interface ObjectGraph<N extends GObject,E>src - the source node of the edgedst - the destination node of the edged - the data to associate with the edge
public final E setEdgeData(GNode<N> src,
GNode<N> dst,
E d,
byte flags)
ObjectGraph
setEdgeData in interface ObjectGraph<N extends GObject,E>src - the source node of the edge.dst - the destination node of the edge.d - the data to associate with the edgeflags - Galois runtime actions (e.g., conflict detection) that need to be executed
upon invocation of this method. See MethodFlag
public void access(byte flags)
GObject
This method should be called before each access to a Galois object.
Many implementing classes leave this implementation empty and
instead implement conflict detection and rollback for each method
of the object (e.g., GSet, Graph, etc),
which is also known as "boosting".
access in interface GObjectflags - Galois runtime actions (e.g., conflict detection) that need to be executed
upon invocation of this method. See MethodFlag
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||