public class PrefixCoderTransformationStrategy extends Object implements TransformationStrategy<CharSequence>
The actual encoding must be provided via a map from characters to symbols, and a set of codewords. The default return value of the map will be used for unknown characters.
This strategy creates a new LongArrayBitVector
each time toBitVector(CharSequence)
is invoked.
Modifier and Type | Field and Description |
---|---|
protected it.unimi.dsi.fastutil.chars.Char2IntOpenHashMap |
char2symbol |
protected BitVector[] |
codeWord |
protected boolean |
prefixFree |
Modifier | Constructor and Description |
---|---|
protected |
PrefixCoderTransformationStrategy(BitVector[] codeWord,
it.unimi.dsi.fastutil.chars.Char2IntOpenHashMap char2symbol,
boolean prefixFree) |
|
PrefixCoderTransformationStrategy(PrefixCoder coder,
it.unimi.dsi.fastutil.chars.Char2IntOpenHashMap char2symbol,
boolean prefixFree)
Create a new transformation strategy based on a prefix-free coder.
|
protected |
PrefixCoderTransformationStrategy(PrefixCoderTransformationStrategy transformationStrategy) |
Modifier and Type | Method and Description |
---|---|
PrefixCoderTransformationStrategy |
copy()
Returns a copy of this transformation strategy.
|
long |
numBits()
The (approximate) number of bits occupied by this transformation.
|
LongArrayBitVector |
toBitVector(CharSequence s)
Returns a bit vector representation of the given object.
|
protected final BitVector[] codeWord
protected final it.unimi.dsi.fastutil.chars.Char2IntOpenHashMap char2symbol
protected final boolean prefixFree
public PrefixCoderTransformationStrategy(PrefixCoder coder, it.unimi.dsi.fastutil.chars.Char2IntOpenHashMap char2symbol, boolean prefixFree)
coder
- a prefix-free coder.char2symbol
- a map from character to symbols (the default returned value will be used for unknown symbols).prefixFree
- whether it is required that the resulting bit vectors are prefix-free: in this case, symbol 0 will
be appended to each string, and will not be allowed to appear in any string.protected PrefixCoderTransformationStrategy(PrefixCoderTransformationStrategy transformationStrategy)
protected PrefixCoderTransformationStrategy(BitVector[] codeWord, it.unimi.dsi.fastutil.chars.Char2IntOpenHashMap char2symbol, boolean prefixFree)
public LongArrayBitVector toBitVector(CharSequence s)
TransformationStrategy
toBitVector
in interface TransformationStrategy<CharSequence>
s
- the object to be turned into bit representation.object
.public long numBits()
TransformationStrategy
numBits
in interface TransformationStrategy<CharSequence>
public PrefixCoderTransformationStrategy copy()
TransformationStrategy
copy
in interface TransformationStrategy<CharSequence>
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.