public class HashStriper extends Object implements SymbolStriper
Example: striper byhash16 splits the symbol universe into 16 stripes by hash.
HashStriper can be matched by the following regex: byhash([0-9]+),
where the matched group defines the number of stripes (must be a power of 2).
HashFilter| Modifier and Type | Field and Description |
|---|---|
static String |
HASH_STRIPER_PREFIX |
| Modifier | Constructor and Description |
|---|---|
protected |
HashStriper(DataScheme scheme,
int stripeCount) |
| Modifier and Type | Method and Description |
|---|---|
BitSet |
getIntersectingStripes(QDFilter filter)
Returns bit set of
SymbolStriper.getStripeCount() size that specifies stripes that
intersect with the given filter. |
String |
getName()
Returns a string representation of this striper.
|
DataScheme |
getScheme()
Returns scheme that this striper works for.
|
protected int |
getShift() |
int |
getStripeCount()
Returns the positive number of stripes that this striper splits into.
|
QDFilter |
getStripeFilter(int stripeIndex)
Returns
filter corresponding for the given stripe index. |
int |
getStripeIndex(char[] chars,
int offset,
int length)
Returns the index of the stripe that the given symbol (represented as character array) falls into.
|
int |
getStripeIndex(int cipher,
String symbol)
Returns the index of the stripe that the given cipher-symbol pair falls into.
|
int |
getStripeIndex(String symbol)
Returns the index of the stripe that the given symbol falls into.
|
protected static int |
index(int hash,
int shift) |
String |
toString()
Returns a string representation of this striper.
|
static SymbolStriper |
valueOf(DataScheme scheme,
int stripeCount)
Constructs a symbol striper for a given number of hash stripes.
|
static HashStriper |
valueOf(DataScheme scheme,
String spec)
Parses a given specification as hash striper for a given scheme.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitdefinedValueOfpublic static final String HASH_STRIPER_PREFIX
protected HashStriper(DataScheme scheme, int stripeCount)
public static HashStriper valueOf(DataScheme scheme, String spec)
valueOf in interface SymbolStriperscheme - the scheme.spec - the striper specification.NullPointerException - if spec is null.FilterSyntaxException - if spec is invalid.public static SymbolStriper valueOf(DataScheme scheme, int stripeCount)
MonoStriper.INSTANCE striper will be returned.scheme - the scheme.stripeCount - the number of hash stripes.FilterSyntaxException - if spec is invalid.public String getName()
SymbolStriperSymbolStriperFactory.getName in interface SymbolStriperpublic DataScheme getScheme()
SymbolStripernull if this striper works for any scheme.getScheme in interface SymbolStriperpublic int getStripeCount()
SymbolStripergetStripeCount in interface SymbolStriperpublic int getStripeIndex(int cipher,
String symbol)
SymbolStriperNote that wildcard symbol should not be submitted to this method,
since it should be accepted by all stripes therefore making stripes intersecting each other.
getStripeIndex in interface SymbolStripercipher - symbol ciphersymbol - symbol stringQDFilter.accept(QDContract, DataRecord, int, String)public int getStripeIndex(String symbol)
SymbolStripergetStripeIndex in interface SymbolStripersymbol - symbol string (not-null)SymbolStriper.getStripeIndex(int, String)public int getStripeIndex(char[] chars,
int offset,
int length)
SymbolStripergetStripeIndex in interface SymbolStriperchars - array that is the source of the symboloffset - the initial offsetlength - the symbol's lengthSymbolStriper.getStripeIndex(int, String)public QDFilter getStripeFilter(int stripeIndex)
SymbolStriperfilter corresponding for the given stripe index.getStripeFilter in interface SymbolStriperstripeIndex - stripe indexpublic BitSet getIntersectingStripes(QDFilter filter)
SymbolStriperSymbolStriper.getStripeCount() size that specifies stripes that
intersect with the given filter. If intersection cannot be calculated null can be returned.getIntersectingStripes in interface SymbolStriperfilter - QD filter to check for intersectionSymbolStriper.getStripeCount() size of intersecting stripes, or null.public String toString()
SymbolStripertoString in interface SymbolStripertoString in class ObjectSymbolStriper.getName()protected int getShift()
protected static int index(int hash,
int shift)
Copyright © 2002–2025 Devexperts LLC. All rights reserved.