public class CompactOrdinalSet extends OrdinalSet
OrdinalSet, returned for connections represented as variable-byte deltas in an NFCompressedGraph.A variable-byte delta representation contains between one and five bytes per connection. The ordinals in the set are sorted ascending, then encoded as the difference between each ordinal and the last ordinal.
For example, the values [ 7, 11, 13, 21 ] will be encoded as [ 7, 4, 2, 8 ].
This is done because smaller values can be represented in fewer bytes.
Because each value can only be derived using the previous value, contains() is an O(n) operation.
This representation for a connection set can be configured for an NFPropertySpec using NFPropertySpec.COMPACT.
EMPTY_SET| Constructor and Description |
|---|
CompactOrdinalSet(com.netflix.nfgraph.util.ByteArrayReader reader) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(int value)
Returns
true when the specified value is contained in this set. |
boolean |
containsAll(int... values)
Returns
true when all specified values are contained in this set. |
OrdinalIterator |
iterator() |
int |
size() |
asArraypublic CompactOrdinalSet(com.netflix.nfgraph.util.ByteArrayReader reader)
public boolean contains(int value)
OrdinalSettrue when the specified value is contained in this set. Depending on the implementation,
this operation will have one of two performance characteristics:
O(1) for HashSetOrdinalSet and BitSetOrdinalSet
O(n) for CompactOrdinalSet and NFBuildGraphOrdinalSet
contains in class OrdinalSetpublic boolean containsAll(int... values)
OrdinalSettrue when all specified values are contained in this set. Depending on the implementation,
this operation will have one of two performance characteristics:
O(m) for HashSetOrdinalSet and BitSetOrdinalSet, where m is the number of specified elements.
O(n) for CompactOrdinalSet, where n is the number of elements in the set.
O(n * m) for NFBuildGraphOrdinalSet.
containsAll in class OrdinalSetpublic OrdinalIterator iterator()
iterator in class OrdinalSetOrdinalIterator over this set.public int size()
size in class OrdinalSet