Top Description Fields Constructors Methods
org.fxmisc.richtext.model

public abstract Class SegmentOpsBase<SEG, S>

extends Object
implements SegmentOps<SEG, S>
Class Inheritance
All Implemented Interfaces
org.fxmisc.richtext.model.SegmentOps
Known Direct Subclasses
org.fxmisc.richtext.model.TextOpsBase, org.fxmisc.richtext.model.NodeSegmentOpsBase
Type Parameters
<SEG>
the type of segment
<S>
the type of style
Imports
java.util.Optional

Provides a base for properly implementing the SegmentOps interface and reduces boilerplate, so that a developer only needs to implement methods for real segments, not empty ones. Optionally, joinSeg(Object, Object) and joinStyle(Object, Object) can be overridden as well.

Field Summary

Modifier and TypeField and Description
private final SEG

Constructor Summary

AccessConstructor and Description
public
SegmentOpsBase(SEG emptySeg)

Creates a SegmentOpsBase that returns emptySeg every time an empty segment should be returned

Method Summary

Modifier and TypeMethod and Description
public final char
charAt(SEG seg, int index)

Implements org.fxmisc.richtext.model.SegmentOps.charAt.

public final SEG
public final String
public Optional<S>
joinStyle(S currentStyle, S nextStyle)

Overrides default org.fxmisc.richtext.model.SegmentOps.joinStyle.

Joins two consecutive styles together into one or Optional#empty() if they cannot be joined.

public abstract char
realCharAt(SEG seg, int index)

public abstract String
realGetText(SEG seg)

public abstract SEG
realSubSequence(SEG seg, int start, int end)

public SEG
realSubSequence(SEG seg, int start)

public final SEG
subSequence(SEG seg, int start, int end)

Implements org.fxmisc.richtext.model.SegmentOps.subSequence.

public final SEG
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

emptyback to summary
private final SEG empty

Constructor Detail

SegmentOpsBaseback to summary
public SegmentOpsBase(SEG emptySeg)

Creates a SegmentOpsBase that returns emptySeg every time an empty segment should be returned

Method Detail

charAtback to summary
public final char charAt(SEG seg, int index)

Implements org.fxmisc.richtext.model.SegmentOps.charAt.

Annotations
@Override
createEmptySegback to summary
public final SEG createEmptySeg()

Implements org.fxmisc.richtext.model.SegmentOps.createEmptySeg.

Doc from org.fxmisc.richtext.model.SegmentOps.createEmptySeg.

Creates an empty segment. This method should return the same object for better performance and memory usage.

Annotations
@Override
getTextback to summary
public final String getText(SEG seg)

Implements org.fxmisc.richtext.model.SegmentOps.getText.

Annotations
@Override
joinStyleback to summary
public Optional<S> joinStyle(S currentStyle, S nextStyle)

Overrides default org.fxmisc.richtext.model.SegmentOps.joinStyle.

Doc from org.fxmisc.richtext.model.SegmentOps.joinStyle.

Joins two consecutive styles together into one or Optional#empty() if they cannot be joined. By default, returns Optional#empty().

Annotations
@Override
realCharAtback to summary
public abstract char realCharAt(SEG seg, int index)
realGetTextback to summary
public abstract String realGetText(SEG seg)
realSubSequenceback to summary
public abstract SEG realSubSequence(SEG seg, int start, int end)
realSubSequenceback to summary
public SEG realSubSequence(SEG seg, int start)
subSequenceback to summary
public final SEG subSequence(SEG seg, int start, int end)

Implements org.fxmisc.richtext.model.SegmentOps.subSequence.

Annotations
@Override
subSequenceback to summary
public final SEG subSequence(SEG seg, int start)

Implements org.fxmisc.richtext.model.SegmentOps.subSequence.

Annotations
@Override