Package org.neo4j.graphalgo.api
Interface AdjacencyCursor
-
- All Superinterfaces:
java.lang.AutoCloseable
- All Known Implementing Classes:
CompositeAdjacencyCursor
,TransientAdjacencyList.DecompressingCursor
public interface AdjacencyCursor extends java.lang.AutoCloseable
-
-
Field Summary
Fields Modifier and Type Field Description static long
NOT_FOUND
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description long
advance(long nodeId)
Read and decode target ids until it is larger than or equal (>=) the providedtarget
.void
close()
void
copyFrom(AdjacencyCursor sourceCursor)
Copies internal states fromsourceCursor
intothis
cursor.boolean
hasNextVLong()
Return true iff there is at least one more target to decode.void
init(long index)
Initialize this cursor to point to the givenindex
.default AdjacencyCursor
initializedTo(long index)
Initialize this cursor to point to the givenindex
.long
nextVLong()
Read and decode the next target id.long
peekVLong()
Decode and peek the next target id.int
remaining()
Return how many targets are still left to be decoded.int
size()
Return how many targets can be decoded in total.long
skipUntil(long nodeId)
Read and decode target ids until it is strictly larger than (>) the providedtarget
.
-
-
-
Field Detail
-
NOT_FOUND
static final long NOT_FOUND
- See Also:
- Constant Field Values
-
-
Method Detail
-
init
void init(long index)
Initialize this cursor to point to the givenindex
.
-
initializedTo
default AdjacencyCursor initializedTo(long index)
Initialize this cursor to point to the givenindex
. Returns this to allow chaining.
-
size
int size()
Return how many targets can be decoded in total. This is equivalent to the degree.
-
hasNextVLong
boolean hasNextVLong()
Return true iff there is at least one more target to decode.
-
nextVLong
long nextVLong()
Read and decode the next target id. It is undefined behavior if this is called afterhasNextVLong()
returnsfalse
.
-
peekVLong
long peekVLong()
Decode and peek the next target id. Does not progress the internal cursor unlikenextVLong()
.
-
remaining
int remaining()
Return how many targets are still left to be decoded.
-
skipUntil
long skipUntil(long nodeId)
Read and decode target ids until it is strictly larger than (>) the providedtarget
. Might return an id that is less than or equal totarget
iff the cursor did exhaust before finding an id that is large enough.skipUntil(target) <= target
can be used to distinguish the no-more-ids case and afterwardshasNextVLong()
will returnfalse
-
advance
long advance(long nodeId)
Read and decode target ids until it is larger than or equal (>=) the providedtarget
. Might return an id that is less thantarget
iff the cursor did exhaust before finding an id that is large enough.advance(target) < target
can be used to distinguish the no-more-ids case and afterwardshasNextVLong()
will returnfalse
-
copyFrom
void copyFrom(AdjacencyCursor sourceCursor)
Copies internal states fromsourceCursor
intothis
cursor. If the types don't match, the behavior is undefined.
-
close
void close()
- Specified by:
close
in interfacejava.lang.AutoCloseable
-
-