Class NullSourceSection

  • All Implemented Interfaces:
    SourceSection

    public class NullSourceSection
    extends java.lang.Object
    implements SourceSection
    A special subtype of SourceSection that represents unavailable source, e.g. for language builtins.
    • Constructor Summary

      Constructors 
      Constructor Description
      NullSourceSection​(java.lang.String kind, java.lang.String name)
      Placeholder for source that is unavailable, e.g.
      NullSourceSection​(java.lang.String kind, java.lang.String name, java.lang.String asCode)
      Placeholder for source that is unavailable, e.g.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getCharEndIndex()
      Returns the index of the text position immediately following the last character in the section.
      int getCharIndex()
      Returns the 0-based index of the first character in this section.
      int getCharLength()
      Returns the length of this section in characters.
      java.lang.String getCode()
      Returns text described by this section.
      java.lang.String getIdentifier()
      Returns terse text describing this source section, typically used for printing the section.
      LineLocation getLineLocation()
      Gets a representation of the first line of the section, suitable for a hash key.
      java.lang.String getShortDescription()
      Returns a short description of the source section, using just the file name, rather than its full path.
      Source getSource()
      Representation of the source program that contains this section.
      int getStartColumn()
      Returns the 1-based column number of the first character in this section (inclusive).
      int getStartLine()
      Returns 1-based line number of the first character in this section (inclusive).
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • NullSourceSection

        public NullSourceSection​(java.lang.String kind,
                                 java.lang.String name)
        Placeholder for source that is unavailable, e.g. for language builtins.
        Parameters:
        kind - the general category, e.g. "JS builtin"
        name - specific name for this section
      • NullSourceSection

        public NullSourceSection​(java.lang.String kind,
                                 java.lang.String name,
                                 java.lang.String asCode)
        Placeholder for source that is unavailable, e.g. for language builtins.
        Parameters:
        kind - the general category, e.g. "JS builtin"
        name - specific name for this section
        asCode - string to return when getCode() is called
    • Method Detail

      • getSource

        public final Source getSource()
        Description copied from interface: SourceSection
        Representation of the source program that contains this section.
        Specified by:
        getSource in interface SourceSection
        Returns:
        the source object
      • getStartLine

        public final int getStartLine()
        Description copied from interface: SourceSection
        Returns 1-based line number of the first character in this section (inclusive).
        Specified by:
        getStartLine in interface SourceSection
        Returns:
        the starting line number
      • getStartColumn

        public final int getStartColumn()
        Description copied from interface: SourceSection
        Returns the 1-based column number of the first character in this section (inclusive).
        Specified by:
        getStartColumn in interface SourceSection
        Returns:
        the starting column number
      • getCharIndex

        public final int getCharIndex()
        Description copied from interface: SourceSection
        Returns the 0-based index of the first character in this section.
        Specified by:
        getCharIndex in interface SourceSection
        Returns:
        the starting character index
      • getCharLength

        public final int getCharLength()
        Description copied from interface: SourceSection
        Returns the length of this section in characters.
        Specified by:
        getCharLength in interface SourceSection
        Returns:
        the number of characters in the section
      • getCharEndIndex

        public final int getCharEndIndex()
        Description copied from interface: SourceSection
        Returns the index of the text position immediately following the last character in the section.
        Specified by:
        getCharEndIndex in interface SourceSection
        Returns:
        the end position of the section
      • getIdentifier

        public final java.lang.String getIdentifier()
        Description copied from interface: SourceSection
        Returns terse text describing this source section, typically used for printing the section.
        Specified by:
        getIdentifier in interface SourceSection
        Returns:
        the identifier of the section
      • getCode

        public final java.lang.String getCode()
        Description copied from interface: SourceSection
        Returns text described by this section.
        Specified by:
        getCode in interface SourceSection
        Returns:
        the code as a String object
      • getShortDescription

        public final java.lang.String getShortDescription()
        Description copied from interface: SourceSection
        Returns a short description of the source section, using just the file name, rather than its full path.
        Specified by:
        getShortDescription in interface SourceSection
        Returns:
        a short description of the source section
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object