public class HashSetOrdinalSet extends OrdinalSet
OrdinalSet, returned for connections represented as variable-byte hashed integer arrays in an NFCompressedGraph.
A variable-byte hashed integer array representation contains between one and five bytes per connection. The ordinal for each
connection is hashed into a byte array, then represented as a variant on the variable-byte integers used in the CompactOrdinalSet.
The byte array can be thought of as a open-addressed hash table, with each byte representing a single bucket. Because values may be represented in more than one byte, single values may spill over into multiple buckets. The beginning of the value is indicated by an unset sign bit, and will be located at or after the bucket to which it is hashed. If the value's first bit is not located at the hashed position, it will be located in a position after the bucket with no empty buckets in between.
This implementation provides O(1) time for contains(), but is not as memory-efficient as a CompactOrdinalSet.
This representation for a connection set can be configured for an NFPropertySpec using NFPropertySpec.HASH.
EMPTY_SET| Constructor and Description |
|---|
HashSetOrdinalSet(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. |
OrdinalIterator |
iterator() |
int |
size() |
asArray, containsAllpublic HashSetOrdinalSet(com.netflix.nfgraph.util.ByteArrayReader reader)
public OrdinalIterator iterator()
iterator in class OrdinalSetOrdinalIterator over this set.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 int size()
size in class OrdinalSet