Package it.unimi.dsi.bits
Interface TransformationStrategy<T>
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
HuTuckerTransformationStrategy
,PrefixCoderTransformationStrategy
A generic transformation from objects of a given type to bit vector. Most useful
when adding strings, etc. to a trie.
-
Method Summary
Modifier and TypeMethodDescriptioncopy()
Returns a copy of this transformation strategy.long
Returns the length of the bit vector that would be computed bytoBitVector(Object)
.long
numBits()
The (approximate) number of bits occupied by this transformation.toBitVector
(T object) Returns a bit vector representation of the given object.
-
Method Details
-
toBitVector
Returns a bit vector representation of the given object.- Parameters:
object
- the object to be turned into a bit-vector representation.- Returns:
- a bit-vector representation of
object
.
-
numBits
long numBits()The (approximate) number of bits occupied by this transformation.- Returns:
- the (approximate) number of bits occupied by this transformation.
-
copy
TransformationStrategy<T> copy()Returns a copy of this transformation strategy.- Returns:
- a copy of this transformation strategy.
-
length
Returns the length of the bit vector that would be computed bytoBitVector(Object)
.The raison d'être of this method is that it is often easy to know the length of the representation without actually computing the representation.
- Parameters:
object
- the object whose representation length is to be known.- Returns:
- the length of the bit-vector representation of
object
(the one that would be returned bytoBitVector(Object)
).
-