Top Description Methods
org.fxmisc.richtext.model

public Interface StyleSpans<S>

extends Iterable<StyleSpan<S>>, TwoDimensional
Known Direct Implementers
org.fxmisc.richtext.model.StyleSpansBase
Type Parameters
<S>
the style type
Static Imports
org.fxmisc.richtext.model.TwoDimensional.Bias.Backward, .TwoDimensional.Bias.Forward

Essentially, a list of StyleSpan objects.

Method Summary

Modifier and TypeMethod and Description
public default StyleSpans<S>
append(S style, int length)

Appends the given style to the end of the list of StyleSpan.

public default StyleSpans<S>
append(StyleSpan<S> span)

Appends the given style to the end of the list of StyleSpan.

public default StyleSpans<S>
concat(StyleSpans<S> that)

public boolean
equals(Object other)

Two StyleSpans objects are considered equal if they contain equal number of StyleSpans and the StyleSpans are pairwise equal.

public int
public IndexRange

Returns:

IndexRange relative to start of style spans
getStyleRange
(int
is relative to start of style spans
position
)

public StyleSpan<S>
getStyleSpan(int index)

public default Iterator<StyleSpan<S>>
iterator()

Implements java.lang.Iterable.iterator.

Returns an iterator over elements of type T.

public int
public default StyleSpans<S>

Returns:

StyleSpans with replaced styles.
mapStyles
(UnaryOperator<S>
function to calculate new style
mapper
)

Returns a new StyleSpans object that has the same total length as this StyleSpans and style of every span is mapped by the given function.

public default StyleSpans<S>
overlay(StyleSpans<S> that, BiFunction<? super S, ? super S, ? extends S> f)

Applies the given bifunction f to this object's StyleSpan objects and that StyleSpan objects and stores the result in the returned StyleSpans object.

public default StyleSpans<S>
prepend(S style, int length)

Prepends the given style to the start of the list of StyleSpan.

public default StyleSpans<S>
prepend(StyleSpan<S> span)

Prepends the given style to the start of the list of StyleSpan.

public static <S> StyleSpans<S>
singleton(S style, int length)

Creates a StyleSpans object that only contains one StyleSpan object.

public static <S> StyleSpans<S>
singleton(StyleSpan<S> span)

Creates a StyleSpans object that only contains one StyleSpan object.

public default Stream<StyleSpan<S>>
stream()

Returns a stream of this list' StyleSpan objects.

public default Stream<S>
styleStream()

Returns a stream of just this list of StyleSpan's styles.

public default StyleSpans<S>
subView(int from, int to)

Same as java.util.List#subList(int, int)

public default StyleSpans<S>
subView(TwoDimensional.Position from, TwoDimensional.Position to)

Same as java.util.List#subList(int, int), except that the arguments are two dimensional.

Inherited from java.lang.Iterable:
forEachspliterator
Inherited from org.fxmisc.richtext.model.TwoDimensional:
offsetToPositionposition

Method Detail

appendback to summary
public default StyleSpans<S> append(S style, int length)

Appends the given style to the end of the list of StyleSpan.

appendback to summary
public default StyleSpans<S> append(StyleSpan<S> span)

Appends the given style to the end of the list of StyleSpan.

concatback to summary
public default StyleSpans<S> concat(StyleSpans<S> that)
equalsback to summary
public boolean equals(Object other)

Two StyleSpans objects are considered equal if they contain equal number of StyleSpans and the StyleSpans are pairwise equal.

Annotations
@Override
getSpanCountback to summary
public int getSpanCount()
getStyleRangeback to summary
public IndexRange getStyleRange(int position)
Parameters
position:int

is relative to start of style spans

Returns:IndexRange

IndexRange relative to start of style spans

getStyleSpanback to summary
public StyleSpan<S> getStyleSpan(int index)
iteratorback to summary
public default Iterator<StyleSpan<S>> iterator()

Implements java.lang.Iterable.iterator.

Doc from java.lang.Iterable.iterator.

Returns an iterator over elements of type T.

Annotations
@Override
lengthback to summary
public int length()
mapStylesback to summary
public default StyleSpans<S> mapStyles(UnaryOperator<S> mapper)

Returns a new StyleSpans object 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:UnaryOperator<S>

function to calculate new style

Returns:StyleSpans<S>

StyleSpans with replaced styles.

overlayback to summary
public default StyleSpans<S> overlay(StyleSpans<S> that, BiFunction<? super S, ? super S, ? extends S> f)

Applies the given bifunction f to this object's StyleSpan objects and that StyleSpan objects and stores the result in the returned StyleSpans object.

prependback to summary
public default StyleSpans<S> prepend(S style, int length)

Prepends the given style to the start of the list of StyleSpan.

prependback to summary
public default StyleSpans<S> prepend(StyleSpan<S> span)

Prepends the given style to the start of the list of StyleSpan.

singletonback to summary
public static <S> StyleSpans<S> singleton(S style, int length)

Creates a StyleSpans object that only contains one StyleSpan object.

singletonback to summary
public static <S> StyleSpans<S> singleton(StyleSpan<S> span)

Creates a StyleSpans object that only contains one StyleSpan object.

streamback to summary
public default Stream<StyleSpan<S>> stream()

Returns a stream of this list' StyleSpan objects.

styleStreamback to summary
public default Stream<S> styleStream()

Returns a stream of just this list of StyleSpan's styles.

subViewback to summary
public default StyleSpans<S> subView(int from, int to)

Same as java.util.List#subList(int, int)

subViewback to summary
public default StyleSpans<S> subView(TwoDimensional.Position from, TwoDimensional.Position to)

Same as java.util.List#subList(int, int), except that the arguments are two dimensional.