public abstract class HitProperty extends Object implements ResultProperty<Hit>
Modifier and Type | Field and Description |
---|---|
protected Contexts |
contexts
Hit contexts, if any
|
protected Results<Hit> |
hits
The Hits object we're looking at
|
protected static org.apache.logging.log4j.Logger |
logger |
protected boolean |
reverse
Reverse comparison result or not?
|
Constructor and Description |
---|
HitProperty() |
Modifier and Type | Method and Description |
---|---|
int |
compare(Hit a,
Hit b)
Compares two hits on this property.
|
HitProperty |
copyWith(Results<Hit> newHits,
Contexts contexts)
Produce a copy of this HitProperty object with a different Hits and Contexts
object.
|
abstract HitProperty |
copyWith(Results<Hit> newHits,
Contexts contexts,
boolean invert)
Produce a copy of this HitProperty object with a different Hits and Contexts
object.
|
static HitProperty |
deserialize(BlackLabIndex index,
AnnotatedField field,
String serialized)
Convert the String representation of a HitProperty back into the HitProperty
|
static HitProperty |
deserialize(Results<Hit> hits,
String serialized) |
DocProperty |
docPropsOnly()
Return only the DocProperty portion (if any) of this HitProperty, if any.
|
PropertyValue |
docPropValues(PropertyValue value)
Return only the values corresponding to DocProperty's of the given PropertyValue, if any.
|
boolean |
equals(Object obj) |
abstract PropertyValue |
get(Hit hit)
Get the property value for a specific result.
|
int |
hashCode() |
boolean |
isReverse()
Is the comparison reversed?
|
abstract String |
name()
Get the name of the property
|
List<Annotation> |
needsContext()
Retrieve context from which field(s) prior to sorting/grouping on this
property?
|
ContextSize |
needsContextSize(BlackLabIndex index)
If this property need context(s), how large should they be?
|
HitProperty |
reverse()
Reverse the sort order of this hit property.
|
abstract String |
serialize()
Serialize this HitProperty so we can deserialize it later (to pass it via
URL, for example)
|
String |
serializeReverse()
Used by subclasses to add a dash for reverse when serializing
|
protected void |
setContextIndices(List<Integer> contextIndices)
For HitProperties that need context, sets the context indices that correspond
to the context(s) they need in the result set.
|
protected HitProperty |
setContexts(Contexts contexts)
Set contexts to use.
|
protected boolean |
sortDescendingByDefault()
Is the default for this property to sort descending?
This is usually a good default for "group size" or "number of hits".
|
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
ignoreSensitivity, isCompound, propNames, props
comparing, comparing, comparingDouble, comparingInt, comparingLong, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
protected static final org.apache.logging.log4j.Logger logger
protected boolean reverse
protected Contexts contexts
public static HitProperty deserialize(Results<Hit> hits, String serialized)
public static HitProperty deserialize(BlackLabIndex index, AnnotatedField field, String serialized)
index
- our indexfield
- field we're searchingserialized
- the serialized objectprotected boolean sortDescendingByDefault()
protected HitProperty setContexts(Contexts contexts)
contexts
- contexts to use, or null for noneprotected void setContextIndices(List<Integer> contextIndices)
HitPropertyMultiple#copyWith(Hits, Contexts, boolean)
, so doesn't break immutability.contextIndices
- the indices, in the same order as reported by
needsContext().public abstract PropertyValue get(Hit hit)
ResultProperty
get
in interface ResultProperty<Hit>
hit
- result to get property value forpublic int compare(Hit a, Hit b)
ResultProperty
compare
in interface Comparator<Hit>
compare
in interface ResultProperty<Hit>
a
- first hitb
- second hitpublic List<Annotation> needsContext()
public ContextSize needsContextSize(BlackLabIndex index)
index
- index, so we can find the default context size if we need topublic abstract String name()
ResultProperty
name
in interface ResultProperty<Hit>
public abstract String serialize()
ResultProperty
serialize
in interface ResultProperty<Hit>
public String serializeReverse()
serializeReverse
in interface ResultProperty<Hit>
public HitProperty reverse()
ResultProperty
reverse
in interface ResultProperty<Hit>
public HitProperty copyWith(Results<Hit> newHits, Contexts contexts)
newHits
- new Hits to usecontexts
- new Contexts to use, or null for nonepublic abstract HitProperty copyWith(Results<Hit> newHits, Contexts contexts, boolean invert)
newHits
- new Hits to use, or null to inheritcontexts
- new Contexts to use, or null to inheritinvert
- true if we should invert the previous sort order; false to keep it the samepublic boolean isReverse()
ResultProperty
isReverse
in interface ResultProperty<Hit>
public String toString()
toString
in interface ResultProperty<Hit>
toString
in class Object
public int hashCode()
hashCode
in interface ResultProperty<Hit>
hashCode
in class Object
public boolean equals(Object obj)
equals
in interface Comparator<Hit>
equals
in interface ResultProperty<Hit>
equals
in class Object
public DocProperty docPropsOnly()
public PropertyValue docPropValues(PropertyValue value)
value
- value to extract the values corresponding to DocProperty's fromCopyright © 2020 Instituut voor Nederlandse Taal (INT). All rights reserved.