|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object it.unimi.dsi.lang.MutableString it.unimi.di.mg4j.query.MarkingMutableString
public class MarkingMutableString
A mutable string with a special method to append text that should be marked.
A marking mutable string can mark several fields (which will often correspond to indexed fields).
Each time you start a field, you pass some intervals to be marked. Then,
you call appendAndMark(WordReader)
, which will add words and nonwords coming from the provided
WordReader
, marking as suggested by the interval set. The number of words
around each interval can be set in the constructor. When a field is finished, you must call endField()
.
Nested Class Summary | |
---|---|
static interface |
MarkingMutableString.EscapeStrategy
An escaping strategy. |
Field Summary | |
---|---|
static int |
DEFAULT_INTERVAL_SURROUND
The default number of words before and after each interval. |
static MarkingMutableString.EscapeStrategy |
HTML_ESCAPE
A singleton for the HTML escape strategy. |
boolean |
marking
|
static MarkingMutableString.EscapeStrategy |
NULL_ESCAPE
A singleton for the null escape strategy (which does nothing). |
boolean |
resume
|
Fields inherited from class it.unimi.dsi.lang.MutableString |
---|
array, hashLength |
Constructor Summary | |
---|---|
MarkingMutableString(Marker marker)
Creates a new loose empty marking mutable string with default interval surround, no escaping strategy and no term processor. |
|
MarkingMutableString(Marker marker,
MarkingMutableString.EscapeStrategy escapeStrategy)
Creates a new loose empty marking mutable string default interval surround. |
|
MarkingMutableString(Marker marker,
MarkingMutableString.EscapeStrategy escapeStrategy,
int intervalSurround)
Creates a new loose empty marking mutable string. |
Method Summary | |
---|---|
MarkingMutableString |
appendAndMark(MutableString s)
|
MarkingMutableString |
appendAndMark(String s)
|
MarkingMutableString |
appendAndMark(WordReader wordReader)
|
MarkingMutableString |
endField()
Closes the current field. |
MarkingMutableString |
startField(SelectedInterval[] interval)
Prepares this marking mutable string for a new field. |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_INTERVAL_SURROUND
public boolean resume
public boolean marking
public static final MarkingMutableString.EscapeStrategy NULL_ESCAPE
public static final MarkingMutableString.EscapeStrategy HTML_ESCAPE
Constructor Detail |
---|
public MarkingMutableString(Marker marker, MarkingMutableString.EscapeStrategy escapeStrategy, int intervalSurround)
marker
- a marker that will decide how to highlight intervals.escapeStrategy
- the escape strategy for strings passed to appendAndMark(WordReader)
, or null
.intervalSurround
- the number of words printed before and after each interval.public MarkingMutableString(Marker marker, MarkingMutableString.EscapeStrategy escapeStrategy)
marker
- a marker that will decide how to highlight intervals.escapeStrategy
- the escape strategy for strings passed to appendAndMark(WordReader)
, or null
.public MarkingMutableString(Marker marker)
marker
- a marker that will decide how to highlight intervals.Method Detail |
---|
public MarkingMutableString startField(SelectedInterval[] interval)
TextMarker.startOfField()
,
the interval marking state is reset and the intervals for marking are set to interval
.
interval
- the new selected-interval array for marking.public MarkingMutableString endField()
TextMarker.startOfField()
is appended to the string.
public MarkingMutableString appendAndMark(String s)
public MarkingMutableString appendAndMark(MutableString s)
public MarkingMutableString appendAndMark(WordReader wordReader)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |