public class RangeStriper extends Object implements SymbolStriper
Example: striper byrange-D-M-
splits the symbol universe into 3 stripes described by filters:
range--D-
, range-D-M-
, range-M--
.
RangeStriper can be matched by the following regex: byrange-(?:([a-zA-Z0-9]{1,8})-)+
,
where each group represents a stripe boundary. For performance reasons stripe boundaries must not be
greater than 8 characters long.
RangeFilter
Modifier and Type | Field and Description |
---|---|
protected SymbolCodec |
codec |
protected int |
codeLength |
protected RangeFilter[] |
filters |
protected String |
name |
protected static int |
PREFIX_LENGTH |
static String |
RANGE_STRIPER_PREFIX |
protected long[] |
rangeCodes |
protected String[] |
ranges |
protected DataScheme |
scheme |
protected int |
stripeCount |
protected int |
wildcard |
Modifier | Constructor and Description |
---|---|
protected |
RangeStriper(DataScheme scheme,
String[] ranges,
String spec) |
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.
|
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[] symbol,
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.
|
String |
toString()
Returns a string representation of this striper.
|
protected static void |
validateRange(int rangeIndex,
String range) |
protected static int |
validateRanges(String[] ranges) |
static SymbolStriper |
valueOf(DataScheme scheme,
List<String> ranges)
Constructs a symbol striper for a given array of symbol ranges.
|
static RangeStriper |
valueOf(DataScheme scheme,
String spec)
Parses a given specification as range striper for a given scheme.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
definedValueOf
public static final String RANGE_STRIPER_PREFIX
protected static final int PREFIX_LENGTH
protected final String name
protected final DataScheme scheme
protected final SymbolCodec codec
protected final int wildcard
protected final int stripeCount
protected final int codeLength
protected final String[] ranges
protected final long[] rangeCodes
protected final RangeFilter[] filters
protected RangeStriper(DataScheme scheme, String[] ranges, String spec)
public static RangeStriper valueOf(DataScheme scheme, String spec)
valueOf
in interface SymbolStriper
scheme
- the scheme.spec
- the striper specification.NullPointerException
- if spec is null.FilterSyntaxException
- if spec is invalid.public static SymbolStriper valueOf(DataScheme scheme, List<String> ranges)
MonoStriper.INSTANCE
striper will be returned.scheme
- the scheme.ranges
- the list of range boundaries.NullPointerException
- if spec is null.FilterSyntaxException
- if spec is invalid.public String getName()
SymbolStriper
SymbolStriperFactory
.getName
in interface SymbolStriper
public int getStripeCount()
SymbolStriper
getStripeCount
in interface SymbolStriper
public String toString()
SymbolStriper
toString
in interface SymbolStriper
toString
in class Object
SymbolStriper.getName()
public DataScheme getScheme()
SymbolStriper
null
if this striper works for any scheme.getScheme
in interface SymbolStriper
public int getStripeIndex(int cipher, String symbol)
SymbolStriper
Note 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 SymbolStriper
cipher
- symbol ciphersymbol
- symbol stringQDFilter.accept(QDContract, DataRecord, int, String)
public int getStripeIndex(String symbol)
SymbolStriper
getStripeIndex
in interface SymbolStriper
symbol
- symbol string (not-null)SymbolStriper.getStripeIndex(int, String)
public int getStripeIndex(char[] symbol, int offset, int length)
SymbolStriper
getStripeIndex
in interface SymbolStriper
symbol
- array that is the source of the symboloffset
- the initial offsetlength
- the symbol's lengthSymbolStriper.getStripeIndex(int, String)
public BitSet getIntersectingStripes(QDFilter filter)
SymbolStriper
SymbolStriper.getStripeCount()
size that specifies stripes that
intersect with the given filter. If intersection cannot be calculated null
can be returned.getIntersectingStripes
in interface SymbolStriper
filter
- QD filter to check for intersectionSymbolStriper.getStripeCount()
size of intersecting stripes, or null
.public QDFilter getStripeFilter(int stripeIndex)
SymbolStriper
filter
corresponding for the given stripe index.getStripeFilter
in interface SymbolStriper
stripeIndex
- stripe indexprotected static int validateRanges(String[] ranges)
protected static void validateRange(int rangeIndex, String range)
Copyright © 2002–2025 Devexperts LLC. All rights reserved.