Class FitsSubString


  • public class FitsSubString
    extends java.lang.Object
    This class is a pointer into a part of an other string, it can be manipulated by changing the position pointers into the "original" string. This class is aware of the escape quote, two quotes in sequence the respresent a single quote.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private int length
      the length of the substring (starting at the offset).
      private int offset
      the offset into the original string where this string starts.
      private java.lang.String originalString
      the original String.
    • Constructor Summary

      Constructors 
      Constructor Description
      FitsSubString​(java.lang.String originalString)
      constructor for the substring, start by representing the whole string.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void appendTo​(java.lang.StringBuilder buffer)
      append the current string representation to the StringBuffer.
      char charAt​(int pos)
      get the character at the specified position.
      int fullLength()  
      void getAdjustedLength​(int max)
      check the string and set it to the maximum length specified.
      int length()  
      void rest()
      shift the sting to the rest of the string, the part of the original string that is after the part of the string this instance currently represents.
      void skip​(int count)
      skip over the specified number of characters.
      boolean startsWith​(java.lang.String string)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • length

        private int length
        the length of the substring (starting at the offset).
      • offset

        private int offset
        the offset into the original string where this string starts.
      • originalString

        private final java.lang.String originalString
        the original String.
    • Constructor Detail

      • FitsSubString

        public FitsSubString​(java.lang.String originalString)
        constructor for the substring, start by representing the whole string.
        Parameters:
        originalString - the string to represent.
    • Method Detail

      • appendTo

        public void appendTo​(java.lang.StringBuilder buffer)
        append the current string representation to the StringBuffer.
        Parameters:
        buffer - the buffer to append to.
      • charAt

        public char charAt​(int pos)
        get the character at the specified position.
        Parameters:
        pos - the position the get the character from
        Returns:
        the character at the specified position
      • fullLength

        public int fullLength()
        Returns:
        get the length of the orginal string from the current offset.
      • getAdjustedLength

        public void getAdjustedLength​(int max)
        check the string and set it to the maximum length specified. if a escaped quote is on the boundary the length is reduced in a way that the string does not separate an escape quote.
        Parameters:
        max - the maximum string legth to set.
      • length

        public int length()
        Returns:
        the string length of this String.
      • rest

        public void rest()
        shift the sting to the rest of the string, the part of the original string that is after the part of the string this instance currently represents.
      • skip

        public void skip​(int count)
        skip over the specified number of characters.
        Parameters:
        count - the number of chars to skip
      • startsWith

        public boolean startsWith​(java.lang.String string)
        Parameters:
        string - the string to check
        Returns:
        true if the current string starts with the specified string.