|
||||||||||
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 de.hpi.fgis.dude.util.sorting.sortingkey.NumberBasedSubkey
public class NumberBasedSubkey
NumberBasedSubkey
can be used for number-based sub-keys. All JsonNumber
values are supported. In
order to provide additional support for all other atomic values they are transformed in some way into numbers.
JsonNull
: A null value will be transformed into 0
JsonBoolean
:
true
are transformed into 1
false
are transformed into 0
JsonString
: All non-number characters are removed. The String that is left will be interpreted
as the number.JsonArray
and JsonRecord
) are recursively traversed.
Field Summary |
---|
Fields inherited from class de.hpi.fgis.dude.util.sorting.sortingkey.TextBasedSubkey |
---|
NO_VOWELS_REGEX, positions, tillEnd |
Constructor Summary | |
---|---|
protected |
NumberBasedSubkey()
Internal constructor for Jsonable deserialization. |
|
NumberBasedSubkey(String attrName)
Initializes a NumberBasedSubkey instance that takes all digits within the value. |
|
NumberBasedSubkey(String attrName,
int firstDigit)
Initializes a NumberBasedSubkey instance that takes all digits within the value. |
|
NumberBasedSubkey(String attrName,
Integer[] pos)
Initializes a NumberBasedSubkey instance that takes all digits within the value. |
|
NumberBasedSubkey(String attrName,
int firstDigit,
int length)
Initializes a NumberBasedSubkey instance that takes all digits within the value. |
Method Summary | |
---|---|
protected void |
collectRelevantValues(JsonArray collectedValues,
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. |
Methods inherited from class de.hpi.fgis.dude.util.sorting.sortingkey.TextBasedSubkey |
---|
caseSensitivityEnabled, disableCaseSensitivity, disableCaseSensitivity, enableCaseSensitivity, equals, getFirstPosition, getIgnoreRegex, getPositions, hashCode, setIgnoredCharactersRegEx, setPositions, setRange, setRange |
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 |
Constructor Detail |
---|
protected NumberBasedSubkey()
Jsonable
deserialization.
public NumberBasedSubkey(String attrName)
NumberBasedSubkey
instance that takes all digits within the value.
attrName
- The name of the attribute that shall be used for comparing the DuDeObject
s.public NumberBasedSubkey(String attrName, int firstDigit)
NumberBasedSubkey
instance that takes all digits within the value.
firstCharacter
specifies the index (starting at 0) of the first digit that will be considered.
attrName
- The name of the attribute that shall be used for comparing the DuDeObject
s.firstDigit
- The index of the first digit that shall be considered. If this value is a negative one, the counting
starts from the end of the value (-1 means the last digit).public NumberBasedSubkey(String attrName, int firstDigit, int length)
NumberBasedSubkey
instance that takes all digits within the value.
firstCharacter
specifies the index (starting at 0) of the first digit that will be considered.
length
specifies the considered offset.
attrName
- The name of the attribute that shall be used for comparing the DuDeObject
s.firstDigit
- The index of the first digit that shall be considered. If this value is a negative one, the counting
starts from the end of the value (-1 means the last digit).length
- The considered offset.public NumberBasedSubkey(String attrName, Integer[] pos)
NumberBasedSubkey
instance that takes all digits within the value. pos
can be used to specify which concrete digit shall be considered.
attrName
- The name of the attribute that shall be used for comparing the DuDeObject
s.pos
- An Integer array that is used for specifying the digits that shall be considered.Method Detail |
---|
protected int compareJsonValues(JsonValue val1, JsonValue val2)
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 TextBasedSubkey
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.protected void collectRelevantValues(JsonArray collectedValues, JsonValue value)
AbstractSubkey
JsonArray
.
collectRelevantValues
in class TextBasedSubkey
collectedValues
- The JsonArray
that shall be filled.value
- The JsonValue
that shall be traversed. All relevant values will be extracted out of this instance.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |