Interface SegmentOps<SEG,​S>

  • Type Parameters:
    SEG - The segment type
    S - 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 Detail

      • length

        int length​(SEG seg)
      • charAt

        char charAt​(SEG seg,
                    int index)
      • subSequence

        SEG subSequence​(SEG seg,
                        int start,
                        int end)
      • subSequence

        SEG subSequence​(SEG seg,
                        int start)
      • 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()
        Creates a TextOps specified for a String segment that never merges consecutive styles
      • orStyled

        default <RSeg,​RStyle> SegmentOps<Either<SEG,​RSeg>,​Either<S,​RStyle>> orStyled​(SegmentOps<RSeg,​RStyle> rOps)
        Returns a SegmentOps that specifies its segment type to be an Either whose left value is this segment type and whose right value is rOps' segment type, and that specifies its style type to be Either whose left value is this style type and whose right value is rOps' style type.
      • eitherStyles

        static <LSeg,​LStyle,​RSeg,​RStyle> SegmentOps<Either<LSeg,​RSeg>,​Either<LStyle,​RStyle>> eitherStyles​(SegmentOps<LSeg,​LStyle> lOps,
                                                                                                                                              SegmentOps<RSeg,​RStyle> rOps)
        Returns a SegmentOps that specifies its segment type to be an Either whose left value is lOps' segment type and whose right value is rOps' segment type, and that specifies its style type to be Either whose left value is lOps' style type and whose right value is rOps' 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 a SegmentOps that specifies its segment type to be an Either whose left value is lOps' segment type and whose right value is rOps' segment type. Note: consecutive styles will not be merged.