|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.hpi.fgis.dude.util.sorting.sortingkey.AbstractSubkey de.hpi.fgis.dude.util.sorting.sortingkey.TextBasedSubkey
public class TextBasedSubkey
The class TextBasedSubkey
provides the functionality for generating sub-keys based on String values. By specifying the
ignoredCharactersRegEx
the considered character types can be set.
Field Summary | |
---|---|
static String |
NO_VOWELS_REGEX
This regular expression can be used if vocals should be ignored. |
protected List<Integer> |
positions
Stores the position information. |
protected boolean |
tillEnd
The property stores the information whether the suffix shall is requested. |
Constructor Summary | |
---|---|
protected |
TextBasedSubkey()
An empty constructor for supporting Jsonable.fromJson(DuDeJsonParser) . |
|
TextBasedSubkey(String attrName)
Initializes this subkey with the passed attribute name. |
|
TextBasedSubkey(String attrName,
String ignoreRegex)
Initializes this subkey with the passed attribute name and the specified ignoredCharacters regular expression. |
Method Summary | |
---|---|
boolean |
caseSensitivityEnabled()
Checks if case-sensitivity is enabled. |
protected void |
collectRelevantValues(JsonArray array,
JsonValue value)
Collects all relevant values and put them into the passed JsonArray . |
protected int |
compareJsonValues(JsonValue val1,
JsonValue val2)
Executes the text-based comparison for each Json type. |
void |
disableCaseSensitivity()
Disables case-sensitivity for the comparisons. |
void |
disableCaseSensitivity(Locale locale)
Disables case-sensitivity for the comparisons. |
void |
enableCaseSensitivity()
Enables case-sensitivity for the comparisons. |
boolean |
equals(Object obj)
|
protected int |
getFirstPosition()
Returns the first set position or 0 if no position is set. |
String |
getIgnoreRegex()
Returns the regular expression that specifies which character classes are ignored within the current instance. |
Iterable<Integer> |
getPositions()
Returns an iterable instance that stores all specified character positions. |
int |
hashCode()
|
void |
setIgnoredCharactersRegEx(String regEx)
Sets the regular expression which specifies the characters that will be ignored. |
void |
setPositions(Integer... positions)
Sets the positions that shall be taken into account explicitly. |
void |
setRange(int beginIndex)
Sets the range that shall be taken into account. |
void |
setRange(int beginIndex,
int length)
Sets the range that shall be taken into account. |
Methods inherited from class de.hpi.fgis.dude.util.sorting.sortingkey.AbstractSubkey |
---|
compare, getAttribute, getSubkeyValue, setAttribute, setDefaultAttribute, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String NO_VOWELS_REGEX
protected List<Integer> positions
protected boolean tillEnd
Constructor Detail |
---|
protected TextBasedSubkey()
Jsonable.fromJson(DuDeJsonParser)
.
public TextBasedSubkey(String attrName)
attrName
- The name of the attribute that shall be used for generating the subkey.public TextBasedSubkey(String attrName, String ignoreRegex)
attrName
- The name of the attribute that shall be used for generating the subkey.ignoreRegex
- A regular expression that describes all the characters that shall be ignored in this subkey instance.Method Detail |
---|
public void setPositions(Integer... positions)
positions
- The positions that shall be taken into account.
NullPointerException
- If null
was passed.public void setRange(int beginIndex)
beginIndex
.
beginIndex
- The first position.public void setRange(int beginIndex, int length)
beginIndex
- The first position.length
- The range's length.
IllegalArgumentException
- If a negative length was passed.public Iterable<Integer> getPositions()
public void setIgnoredCharactersRegEx(String regEx)
regEx
- The regular expression for specifying which characters shall be ignored.public String getIgnoreRegex()
public void enableCaseSensitivity()
public void disableCaseSensitivity(Locale locale)
Locale
can be specified. If null
is passed, English will be used as
the default language.
locale
- Specifies the underlying language.public void disableCaseSensitivity()
DEFAULT_LOCALE
are used.
public boolean caseSensitivityEnabled()
true
, if case-sensitivity is enabled; otherwise false
.protected int compareJsonValues(JsonValue val1, JsonValue val2) throws ClassCastException
AbstractSubkey
JsonValue
s are transformed into their String
representation. The Json types storing multiple JsonValues
( JsonRecord
and JsonArray
) are traversed. If the
passed JsonValue
s are of different types, the order of the JsonValue.JsonType
s is used.
compareJsonValues
in class AbstractSubkey
val1
- The first JsonValue
.val2
- The second JsonValue
.
-1
if val1
is less than val2
; 1
if val1
is larger than
val2
and 0
, if they are equal.
ClassCastException
- If at least one of the past values can't be converted.protected void collectRelevantValues(JsonArray array, JsonValue value)
AbstractSubkey
JsonArray
.
collectRelevantValues
in class AbstractSubkey
array
- The JsonArray
that shall be filled.value
- The JsonValue
that shall be traversed. All relevant values will be extracted out of this instance.protected int getFirstPosition()
0
if no position is set.
public int hashCode()
hashCode
in class AbstractSubkey
public boolean equals(Object obj)
equals
in interface Comparator<DuDeObject>
equals
in class AbstractSubkey
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |