public abstract class Edges extends Fields
Node
fields representing the set of inputs for the node or the set of the
node's successors.Modifier and Type | Class and Description |
---|---|
private static class |
Edges.AllEdgesIterator |
private static class |
Edges.EdgesIterator
An iterator that will iterate over edges.
|
private static class |
Edges.EdgesWithModCountIterator |
static class |
Edges.Type
Constants denoting whether a set of edges are inputs or successors.
|
Fields.ObjectTransformer
Modifier and Type | Field and Description |
---|---|
(package private) static int |
cnt1 |
(package private) static int |
cnt2 |
private int |
directCount |
private Edges.Type |
type |
Constructor and Description |
---|
Edges(Edges.Type type,
int directCount,
ArrayList<? extends FieldsScanner.FieldInfo> edges) |
Modifier and Type | Method and Description |
---|---|
void |
accept(Node node,
BiConsumer<Node,Node> consumer) |
private static void |
acceptHelper(Node node,
BiConsumer<Node,Node> consumer,
NodeList<Node> list) |
boolean |
areEqualIn(Node node,
Node other)
Determines if the edges of two given nodes are the same.
|
void |
clear(Node node)
Clear edges in a given node.
|
boolean |
contains(Node node,
Node value) |
void |
copy(Node fromNode,
Node toNode)
Copies edges from
fromNode to toNode . |
int |
getDirectCount()
Get the number of direct edges represented by this object.
|
NodeClassIterable |
getIterable(Node node) |
static Node |
getNode(Node node,
long[] offsets,
int index)
|
static NodeList<Node> |
getNodeList(Node node,
long[] offsets,
int index)
|
private static NodeList<Node> |
getNodeListUnsafe(Node node,
long offset) |
private static Node |
getNodeUnsafe(Node node,
long offset) |
static void |
initializeList(Node node,
long[] offsets,
int index,
NodeList<Node> value) |
void |
initializeLists(Node node,
Node prototype)
Initializes the list edges in a given node based on the size of the list edges in a prototype
node.
|
static void |
initializeNode(Node node,
long[] offsets,
int index,
Node value)
Sets the value of a given edge without notifying the new and old nodes on the other end of
the edge of the change.
|
void |
pushAll(Node node,
NodeStack stack) |
private static void |
pushAllHelper(NodeStack stack,
NodeList<Node> list) |
private static void |
putNodeListUnsafe(Node node,
long offset,
NodeList<?> value) |
private static void |
putNodeUnsafe(Node node,
long offset,
Node value) |
boolean |
replaceFirst(Node node,
Node key,
Node replacement)
Searches for the first edge in a given node matching
key and if found, replaces it
with replacement . |
void |
set(Object node,
int index,
Object value) |
void |
setNode(Node node,
int index,
Node value)
Sets the value of a given edge and notifies the new and old nodes on the other end of the
edge of the change.
|
static void |
translateInto(Edges edges,
ArrayList<NodeClass.EdgeInfo> infos) |
Edges.Type |
type() |
abstract void |
update(Node node,
Node oldValue,
Node newValue) |
appendFields, copy, copy, forClass, get, getBoolean, getByte, getChar, getCount, getDeclaringClass, getDouble, getFloat, getInt, getLong, getName, getObject, getOffsets, getRawPrimitive, getShort, getType, isSame, putObject, setRawPrimitive, toString, translateInto
private final int directCount
private final Edges.Type type
static int cnt1
static int cnt2
public Edges(Edges.Type type, int directCount, ArrayList<? extends FieldsScanner.FieldInfo> edges)
public static void translateInto(Edges edges, ArrayList<NodeClass.EdgeInfo> infos)
private static Node getNodeUnsafe(Node node, long offset)
private static NodeList<Node> getNodeListUnsafe(Node node, long offset)
private static void putNodeUnsafe(Node node, long offset, Node value)
private static void putNodeListUnsafe(Node node, long offset, NodeList<?> value)
public int getDirectCount()
public static Node getNode(Node node, long[] offsets, int index)
node
- one end point of the edgeindex
- the index of a non-list the edge (must be less than getDirectCount()
)public static NodeList<Node> getNodeList(Node node, long[] offsets, int index)
node
- one end point of the edgeindex
- the index of a non-list the edge (must be equal to or greater than
getDirectCount()
)NodeList
at the other edge of the requested edgepublic void clear(Node node)
node
- the node whose edges are to be clearedpublic void initializeLists(Node node, Node prototype)
node
- the node whose list edges are to be initializedprototype
- the node whose list edge sizes are used when creating new edge listspublic void copy(Node fromNode, Node toNode)
fromNode
to toNode
. The nodes are expected to be of the
exact same type.fromNode
- the node from which the edges should be copied.toNode
- the node to which the edges should be copied.public boolean replaceFirst(Node node, Node key, Node replacement)
key
and if found, replaces it
with replacement
.node
- the node whose edges are to be searchedkey
- the edge to search forreplacement
- the replacement for key
public static void initializeNode(Node node, long[] offsets, int index, Node value)
node
- the node whose edge is to be updatedindex
- the index of the edge (between 0 and Fields.getCount()
)value
- the node to be written to the edgepublic static void initializeList(Node node, long[] offsets, int index, NodeList<Node> value)
public void setNode(Node node, int index, Node value)
node
- the node whose edge is to be updatedindex
- the index of the edge (between 0 and Fields.getCount()
)value
- the node to be written to the edgepublic boolean areEqualIn(Node node, Node other)
public NodeClassIterable getIterable(Node node)
public Edges.Type type()
public void accept(Node node, BiConsumer<Node,Node> consumer)
private static void acceptHelper(Node node, BiConsumer<Node,Node> consumer, NodeList<Node> list)
private static void pushAllHelper(NodeStack stack, NodeList<Node> list)