Package sc.util

Class LineCountStringBuilder

  • All Implemented Interfaces:

    public class LineCountStringBuilder
    extends java.lang.Object
    implements java.lang.CharSequence
    If only there were a base class to StringBuilder that implemented the same contract but which we could extend but no, this is an attempt to replicate the key methods using an underlying StringBuilder, keeping track of the line number. TODO: keep track of column too?
    • Field Summary

      Modifier and Type Field Description
      int lineCount  
      java.lang.StringBuilder sb  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.StringBuilder append​(boolean b)  
      java.lang.StringBuilder append​(char c)  
      java.lang.StringBuilder append​(double d)  
      java.lang.StringBuilder append​(float f)  
      java.lang.StringBuilder append​(int i)  
      java.lang.StringBuilder append​(long lng)  
      java.lang.StringBuilder append​(java.lang.CharSequence csq)  
      java.lang.StringBuilder append​(java.lang.CharSequence csq, int start, int end)  
      java.lang.StringBuilder append​(java.lang.Object obj)  
      char charAt​(int index)  
      int length()  
      java.lang.CharSequence subSequence​(int start, int end)  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.lang.CharSequence

        chars, codePoints
    • Field Detail

      • sb

        public java.lang.StringBuilder sb
      • lineCount

        public int lineCount
    • Constructor Detail

      • LineCountStringBuilder

        public LineCountStringBuilder()
    • Method Detail

      • append

        public java.lang.StringBuilder append​(java.lang.CharSequence csq)
      • append

        public java.lang.StringBuilder append​(java.lang.CharSequence csq,
                                              int start,
                                              int end)
      • append

        public java.lang.StringBuilder append​(char c)
      • append

        public java.lang.StringBuilder append​(java.lang.Object obj)
      • append

        public java.lang.StringBuilder append​(boolean b)
      • append

        public java.lang.StringBuilder append​(int i)
      • append

        public java.lang.StringBuilder append​(long lng)
      • append

        public java.lang.StringBuilder append​(float f)
      • append

        public java.lang.StringBuilder append​(double d)
      • length

        public int length()
        Specified by:
        length in interface java.lang.CharSequence
      • charAt

        public char charAt​(int index)
        Specified by:
        charAt in interface java.lang.CharSequence
      • subSequence

        public java.lang.CharSequence subSequence​(int start,
                                                  int end)
        Specified by:
        subSequence in interface java.lang.CharSequence
      • toString

        public java.lang.String toString()
        Specified by:
        toString in interface java.lang.CharSequence
        toString in class java.lang.Object