Package org.fxmisc.richtext.model
Interface StyleSpans<S>
-
- Type Parameters:
S- the style type
- All Superinterfaces:
Iterable<StyleSpan<S>>,TwoDimensional
public interface StyleSpans<S> extends Iterable<StyleSpan<S>>, TwoDimensional
Essentially, a list ofStyleSpanobjects.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.fxmisc.richtext.model.TwoDimensional
TwoDimensional.Bias, TwoDimensional.Position
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default StyleSpans<S>append(StyleSpan<S> span)Appends the given style to the end of the list ofStyleSpan.default StyleSpans<S>append(S style, int length)Appends the given style to the end of the list ofStyleSpan.default StyleSpans<S>concat(StyleSpans<S> that)booleanequals(Object other)TwoStyleSpansobjects are considered equal if they contain equal number ofStyleSpans and theStyleSpans are pairwise equal.intgetSpanCount()IndexRangegetStyleRange(int position)StyleSpan<S>getStyleSpan(int index)default Iterator<StyleSpan<S>>iterator()intlength()default StyleSpans<S>mapStyles(UnaryOperator<S> mapper)Returns a newStyleSpansobject that has the same total length as this StyleSpans and style of every span is mapped by the given function.default StyleSpans<S>overlay(StyleSpans<S> that, BiFunction<? super S,? super S,? extends S> f)Applies the given bifunctionfto this object'sStyleSpanobjects andthatStyleSpanobjects and stores the result in the returnedStyleSpansobject.default StyleSpans<S>prepend(StyleSpan<S> span)Prepends the given style to the start of the list ofStyleSpan.default StyleSpans<S>prepend(S style, int length)Prepends the given style to the start of the list ofStyleSpan.static <S> StyleSpans<S>singleton(StyleSpan<S> span)Creates aStyleSpansobject that only contains oneStyleSpanobject.static <S> StyleSpans<S>singleton(S style, int length)Creates aStyleSpansobject that only contains oneStyleSpanobject.default Stream<StyleSpan<S>>stream()Returns a stream of this list'StyleSpanobjects.default Stream<S>styleStream()Returns a stream of just this list ofStyleSpan's styles.default StyleSpans<S>subView(int from, int to)Same asList.subList(int, int)default StyleSpans<S>subView(TwoDimensional.Position from, TwoDimensional.Position to)Same asList.subList(int, int), except that the arguments are two dimensional.-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Methods inherited from interface org.fxmisc.richtext.model.TwoDimensional
offsetToPosition, position
-
-
-
-
Method Detail
-
singleton
static <S> StyleSpans<S> singleton(S style, int length)
Creates aStyleSpansobject that only contains oneStyleSpanobject.
-
singleton
static <S> StyleSpans<S> singleton(StyleSpan<S> span)
Creates aStyleSpansobject that only contains oneStyleSpanobject.
-
length
int length()
-
getSpanCount
int getSpanCount()
-
getStyleRange
IndexRange getStyleRange(int position)
- Parameters:
position- is relative to start of style spans- Returns:
- IndexRange relative to start of style spans
-
equals
boolean equals(Object other)
TwoStyleSpansobjects are considered equal if they contain equal number ofStyleSpans and theStyleSpans are pairwise equal.
-
append
default StyleSpans<S> append(S style, int length)
Appends the given style to the end of the list ofStyleSpan.
-
append
default StyleSpans<S> append(StyleSpan<S> span)
Appends the given style to the end of the list ofStyleSpan.
-
prepend
default StyleSpans<S> prepend(S style, int length)
Prepends the given style to the start of the list ofStyleSpan.
-
prepend
default StyleSpans<S> prepend(StyleSpan<S> span)
Prepends the given style to the start of the list ofStyleSpan.
-
subView
default StyleSpans<S> subView(int from, int to)
Same asList.subList(int, int)
-
subView
default StyleSpans<S> subView(TwoDimensional.Position from, TwoDimensional.Position to)
Same asList.subList(int, int), except that the arguments are two dimensional.
-
concat
default StyleSpans<S> concat(StyleSpans<S> that)
-
mapStyles
default StyleSpans<S> mapStyles(UnaryOperator<S> mapper)
Returns a newStyleSpansobject that has the same total length as this StyleSpans and style of every span is mapped by the given function. Adjacent style spans whose style mapped to the same value are merged into one. As a consequence, the returned StyleSpans might have fewer style spans than this StyleSpans.- Parameters:
mapper- function to calculate new style- Returns:
- StyleSpans with replaced styles.
-
overlay
default StyleSpans<S> overlay(StyleSpans<S> that, BiFunction<? super S,? super S,? extends S> f)
Applies the given bifunctionfto this object'sStyleSpanobjects andthatStyleSpanobjects and stores the result in the returnedStyleSpansobject.
-
styleStream
default Stream<S> styleStream()
Returns a stream of just this list ofStyleSpan's styles.
-
-