SEG - the type of segmentS - the type of styleSegmentOps<SEG,S>NodeSegmentOpsBase, TextOpsBasepublic abstract class SegmentOpsBase<SEG,S> extends java.lang.Object implements SegmentOps<SEG,S>
SegmentOps interface and reduces boilerplate,
so that a developer only needs to implement methods for real segments, not empty ones. Optionally,
SegmentOps.joinSeg(Object, Object) and joinStyle(Object, Object) can be overridden as well.| Constructor | Description |
|---|---|
SegmentOpsBase(SEG emptySeg) |
Creates a
SegmentOpsBase that returns emptySeg every time an empty segment should be returned |
| Modifier and Type | Method | Description |
|---|---|---|
char |
charAt(SEG seg,
int index) |
|
SEG |
createEmptySeg() |
Creates an empty segment.
|
java.lang.String |
getText(SEG seg) |
|
java.util.Optional<S> |
joinStyle(S currentStyle,
S nextStyle) |
Joins two consecutive styles together into one or
Optional.empty() if they cannot be joined. |
abstract char |
realCharAt(SEG seg,
int index) |
|
abstract java.lang.String |
realGetText(SEG seg) |
|
SEG |
realSubSequence(SEG seg,
int start) |
|
abstract SEG |
realSubSequence(SEG seg,
int start,
int end) |
|
SEG |
subSequence(SEG seg,
int start) |
|
SEG |
subSequence(SEG seg,
int start,
int end) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waiteither, either, eitherStyles, joinSeg, length, or, orStyled, styledTextOps, styledTextOpspublic SegmentOpsBase(SEG emptySeg)
SegmentOpsBase that returns emptySeg every time an empty segment should be returnedpublic final char charAt(SEG seg, int index)
charAt in interface SegmentOps<SEG,S>public abstract char realCharAt(SEG seg, int index)
public final java.lang.String getText(SEG seg)
getText in interface SegmentOps<SEG,S>public abstract java.lang.String realGetText(SEG seg)
public final SEG subSequence(SEG seg, int start, int end)
subSequence in interface SegmentOps<SEG,S>public final SEG subSequence(SEG seg, int start)
subSequence in interface SegmentOps<SEG,S>public final SEG createEmptySeg()
SegmentOpscreateEmptySeg in interface SegmentOps<SEG,S>public java.util.Optional<S> joinStyle(S currentStyle, S nextStyle)
SegmentOpsOptional.empty() if they cannot be joined. By default,
returns Optional.empty().joinStyle in interface SegmentOps<SEG,S>