Package it.unimi.di.big.mg4j.query
Class SelectedInterval
- java.lang.Object
-
- it.unimi.di.big.mg4j.query.SelectedInterval
-
- All Implemented Interfaces:
Serializable
,Comparable<SelectedInterval>
public class SelectedInterval extends Object implements Comparable<SelectedInterval>, Serializable
An interval selected for display.MG4J uses intervals returned by a
DocumentIterator
to produce snippet of text that help the user to understand why a document satisfies a query. This class wraps anInterval
, adding some information that is useful for displaying the interval itself (e.g., whether the interval is an actual interval satisfying the query or was generated by anIntervalSelector
). Whereas the query-solving process uses exclusivelyInterval
(which is on purpose a small, final and very lightweight class), the snippeting process uses exclusively instances of this class.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SelectedInterval.IntervalType
The type of a selected interval, as set by anIntervalSelector
.
-
Field Summary
Fields Modifier and Type Field Description static SelectedInterval[]
EMPTY_ARRAY
static SelectedInterval[]
FALSE_ARRAY
A marker array used to represent the (absence of) intervals associated withIntervalIterators.FALSE
.Interval
interval
The underlying interval.static SelectedInterval[]
TRUE_ARRAY
A marker array used to represent the (absence of) intervals associated withIntervalIterators.TRUE
.SelectedInterval.IntervalType
type
The interval type, ornull
for an untyped interval.
-
Constructor Summary
Constructors Constructor Description SelectedInterval(Interval interval, SelectedInterval.IntervalType type)
Creates a new selected interval by wrapping a given interval.
-
-
-
Field Detail
-
EMPTY_ARRAY
public static final SelectedInterval[] EMPTY_ARRAY
-
TRUE_ARRAY
public static final SelectedInterval[] TRUE_ARRAY
A marker array used to represent the (absence of) intervals associated withIntervalIterators.TRUE
.
-
FALSE_ARRAY
public static final SelectedInterval[] FALSE_ARRAY
A marker array used to represent the (absence of) intervals associated withIntervalIterators.FALSE
.
-
interval
public final Interval interval
The underlying interval.
-
type
public final SelectedInterval.IntervalType type
The interval type, ornull
for an untyped interval.
-
-
Constructor Detail
-
SelectedInterval
public SelectedInterval(Interval interval, SelectedInterval.IntervalType type)
Creates a new selected interval by wrapping a given interval.- Parameters:
interval
- the underlying interval.type
- the interval type, ornull
for a pure wrapper.
-
-
Method Detail
-
compareTo
public int compareTo(SelectedInterval i)
Compares two selected intervals by their left extremes.- Specified by:
compareTo
in interfaceComparable<SelectedInterval>
- Parameters:
i
- a selected interval.- Returns:
- the difference between the left extreme this interval and that of
i
.
-
-