Package org.fxmisc.richtext.model
Interface SegmentOps<SEG,S>
-
- Type Parameters:
SEG- The segment typeS- The style type for the segment
- All Known Subinterfaces:
TextOps<SEG,S>
- All Known Implementing Classes:
NodeSegmentOpsBase,SegmentOpsBase,TextOpsBase
public interface SegmentOps<SEG,S>Defines the operations which are supported on a specific segment type.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description charcharAt(SEG seg, int index)SEGcreateEmptySeg()Creates an empty segment.static <LSeg,RSeg,Style>
SegmentOps<Either<LSeg,RSeg>,Style>either(SegmentOps<LSeg,Style> lOps, SegmentOps<RSeg,Style> rOps)Returns aSegmentOpsthat specifies its segment type to be anEitherwhoseleftvalue islOps' segment type and whoserightvalue isrOps' segment type.static <LSeg,RSeg,Style>
SegmentOps<Either<LSeg,RSeg>,Style>either(SegmentOps<LSeg,Style> lOps, SegmentOps<RSeg,Style> rOps, BiFunction<Style,Style,Optional<Style>> mergeStyle)Returns aSegmentOpsthat specifies its segment type to be anEitherwhoseleftvalue islOps' segment type and whoserightvalue isrOps' segment type.static <LSeg,LStyle,RSeg,RStyle>
SegmentOps<Either<LSeg,RSeg>,Either<LStyle,RStyle>>eitherStyles(SegmentOps<LSeg,LStyle> lOps, SegmentOps<RSeg,RStyle> rOps)StringgetText(SEG seg)Optional<SEG>joinSeg(SEG currentSeg, SEG nextSeg)Joins two consecutive segments together into one orOptional.empty()if they cannot be joined.default Optional<S>joinStyle(S currentStyle, S nextStyle)Joins two consecutive styles together into one orOptional.empty()if they cannot be joined.intlength(SEG seg)default <R> SegmentOps<Either<SEG,R>,S>or(SegmentOps<R,S> rOps)Returns aSegmentOpsthat specifies its segment type to be anEitherwhoseleftvalue is this segment type and whoserightvalue isrOps' segment type.default <RSeg,RStyle>
SegmentOps<Either<SEG,RSeg>,Either<S,RStyle>>orStyled(SegmentOps<RSeg,RStyle> rOps)static <S> TextOps<String,S>styledTextOps()static <S> TextOps<String,S>styledTextOps(BiFunction<S,S,Optional<S>> mergeStyle)SEGsubSequence(SEG seg, int start)SEGsubSequence(SEG seg, int start, int end)
-
-
-
Method Detail
-
length
int length(SEG seg)
-
charAt
char charAt(SEG seg, int index)
-
joinSeg
Optional<SEG> joinSeg(SEG currentSeg, SEG nextSeg)
Joins two consecutive segments together into one orOptional.empty()if they cannot be joined.
-
joinStyle
default Optional<S> joinStyle(S currentStyle, S nextStyle)
Joins two consecutive styles together into one orOptional.empty()if they cannot be joined. By default, returnsOptional.empty().
-
createEmptySeg
SEG createEmptySeg()
Creates an empty segment. This method should return the same object for better performance and memory usage.
-
styledTextOps
static <S> TextOps<String,S> styledTextOps(BiFunction<S,S,Optional<S>> mergeStyle)
-
or
default <R> SegmentOps<Either<SEG,R>,S> or(SegmentOps<R,S> rOps)
Returns aSegmentOpsthat specifies its segment type to be anEitherwhoseleftvalue is this segment type and whoserightvalue isrOps' segment type.
-
orStyled
default <RSeg,RStyle> SegmentOps<Either<SEG,RSeg>,Either<S,RStyle>> orStyled(SegmentOps<RSeg,RStyle> rOps)
-
eitherStyles
static <LSeg,LStyle,RSeg,RStyle> SegmentOps<Either<LSeg,RSeg>,Either<LStyle,RStyle>> eitherStyles(SegmentOps<LSeg,LStyle> lOps, SegmentOps<RSeg,RStyle> rOps)
Returns aSegmentOpsthat specifies its segment type to be anEitherwhoseleftvalue islOps' segment type and whoserightvalue isrOps' segment type, and that specifies its style type to beEitherwhoseleftvalue islOps' style type and whoserightvalue isrOps' style type. Note: consecutive styles will not be merged.
-
either
static <LSeg,RSeg,Style> SegmentOps<Either<LSeg,RSeg>,Style> either(SegmentOps<LSeg,Style> lOps, SegmentOps<RSeg,Style> rOps)
Returns aSegmentOpsthat specifies its segment type to be anEitherwhoseleftvalue islOps' segment type and whoserightvalue isrOps' segment type. Note: consecutive styles will not be merged.
-
either
static <LSeg,RSeg,Style> SegmentOps<Either<LSeg,RSeg>,Style> either(SegmentOps<LSeg,Style> lOps, SegmentOps<RSeg,Style> rOps, BiFunction<Style,Style,Optional<Style>> mergeStyle)
Returns aSegmentOpsthat specifies its segment type to be anEitherwhoseleftvalue islOps' segment type and whoserightvalue isrOps' segment type.
-
-