|
||||||||||
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
public abstract class AbstractSubkey
AbstractSubkey
is an abstract
class that should be extended by each subkey class. It implements Subkey
particularly.
Constructor Summary | |
---|---|
AbstractSubkey(String... defaultAttr)
Initializes a AbstractSubkey instance with the given default attribute. |
Method Summary | |
---|---|
protected abstract void |
collectRelevantValues(JsonArray array,
JsonValue value)
Collects all relevant values and put them into the passed JsonArray . |
int |
compare(DuDeObject o1,
DuDeObject o2)
|
protected abstract int |
compareJsonValues(JsonValue val1,
JsonValue val2)
Executes the text-based comparison for each Json type. |
boolean |
equals(Object obj)
|
protected String[] |
getAttribute(DuDeObject obj)
Returns the attribute that corresponds to source of the passed DuDeObject . |
JsonArray |
getSubkeyValue(DuDeObject obj)
Returns a JsonArray that collects all relevant values for the subkey of the passed DuDeObject . |
int |
hashCode()
|
void |
setAttribute(DataSource source,
String... attribute)
Sets the attribute for the passed DataSource . |
void |
setDefaultAttribute(String... defaultAttr)
Sets the default attribute. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public AbstractSubkey(String... defaultAttr)
AbstractSubkey
instance with the given default attribute.
defaultAttr
- The default attribute that is used for generating a sub-key.Method Detail |
---|
public void setDefaultAttribute(String... defaultAttr)
DataSource
. Passing an empty attribute
or null
will unset the current default attribute.
defaultAttr
- The default attribute.public void setAttribute(DataSource source, String... attribute)
DataSource
. Passing null
instead of an attribute will remove the attribute of the passed
DataSource
from this Subkey
.
source
- The DataSource
.attribute
- The corresponding attribute.
NullPointerException
- If the null
was passed instead of a DataSource
.protected String[] getAttribute(DuDeObject obj)
DuDeObject
.
obj
- The DuDeObject
.
protected abstract void collectRelevantValues(JsonArray array, JsonValue value)
JsonArray
.
array
- The JsonArray
that shall be filled.value
- The JsonValue
that shall be traversed. All relevant values will be extracted out of this instance.public int compare(DuDeObject o1, DuDeObject o2)
compare
in interface Comparator<DuDeObject>
protected abstract int compareJsonValues(JsonValue val1, JsonValue val2) throws ClassCastException
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.
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.public JsonArray getSubkeyValue(DuDeObject obj)
Subkey
JsonArray
that collects all relevant values for the subkey of the passed DuDeObject
.
getSubkeyValue
in interface Subkey
obj
- The object from which the sub-key shall be returned.
JsonArray
collecting all relevant values of the sub-key.public int hashCode()
hashCode
in class Object
public boolean equals(Object obj)
equals
in interface Comparator<DuDeObject>
equals
in class Object
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |