Class SourceCodeIndicator


  • public class SourceCodeIndicator
    extends java.lang.Object
    Represents a line of source code, together with an associated "indicator" line. If the indicator line is displayed immediately after (or before) the source code line it should have the effect of visually indicating a portion of the source code line. Some examples:
     int i = 0.1;
     ^^^     ^^^
     
         vvvvvvv
     int i = 0.1;
     

    Note that the indicator line is not required to indicate continuous portions of the code line. However, in our application it is only going to be used for continuous portions.

    Support for special characters (such as tab, backspace and end-of-line) in the code line is the responsibility of the class that displays the two lines. The indicator in this class assumes a one-to-one mapping of code characters to display characters and to indicator line characters. The meaning of "line" is left to the users of this class; it does not enforce that its "lines" contain no newline characters. In our application we should make sure we don't pass newline characters to this class.

    The indicator line is not required to have the same length as the code line. This means that trailing whitespace can be absent. However, uses such as:

     int i = 0;
     ____#####_
     

    are considered valid. Note that the indicator line contains no whitespace and that both lines are the same size. As long as the visual indication is achieved, the indicator line is unconstrained.

    The indicator line might be absent. If that is the case, getIndicatorLine() returns null.

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getCodeLine()  
      java.lang.String getIndicatorLine()  
      • Methods inherited from class java.lang.Object

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

      • getCodeLine

        public java.lang.String getCodeLine()
        Returns:
        the code line
      • getIndicatorLine

        public java.lang.String getIndicatorLine()
        Returns:
        the indicator line