Class CSSSourceLocation


  • @Immutable
    public class CSSSourceLocation
    extends Object
    Defines the source location of an object when reading CSS from a stream. It consists of the position of the start token and the position of the end token.
    Author:
    Philip Helger
    • Constructor Detail

      • CSSSourceLocation

        public CSSSourceLocation​(@Nullable
                                 CSSSourceArea aFirstTokenArea,
                                 @Nullable
                                 CSSSourceArea aLastTokenArea)
        Constructor.
        Parameters:
        aFirstTokenArea - Area of the first token. May be null if the last token area is not null.
        aLastTokenArea - Area of the last token. May be null if the first token area is not null.
        Throws:
        IllegalArgumentException - if both areas are null.
    • Method Detail

      • getFirstTokenArea

        @Nullable
        public CSSSourceArea getFirstTokenArea()
        Returns:
        The area of the first token. May be null if no such information is available.
      • hasFirstTokenArea

        public boolean hasFirstTokenArea()
        Returns:
        true if the first token area is present
      • getFirstTokenBeginLineNumber

        @CheckForSigned
        public int getFirstTokenBeginLineNumber()
        Returns:
        The line number where the first token begins (incl.). May be -1 if not such token is available.
      • getFirstTokenBeginColumnNumber

        @CheckForSigned
        public int getFirstTokenBeginColumnNumber()
        Returns:
        The column number where the first token begins (incl.). May be -1 if not such token is available.
      • getFirstTokenEndLineNumber

        @CheckForSigned
        public int getFirstTokenEndLineNumber()
        Returns:
        The line number where the fist token ends (incl.). May be -1 if not such token is available.
      • getFirstTokenEndColumnNumber

        @CheckForSigned
        public int getFirstTokenEndColumnNumber()
        Returns:
        The column number where the first token ends (incl.). May be -1 if not such token is available.
      • getLastTokenArea

        @Nullable
        public CSSSourceArea getLastTokenArea()
        Returns:
        The area of the last token. May be null if no such information is available.
      • hasLastTokenArea

        public boolean hasLastTokenArea()
        Returns:
        true if the last token area is present
      • getLastTokenBeginLineNumber

        @CheckForSigned
        public int getLastTokenBeginLineNumber()
        Returns:
        The line number where the last token begins (incl.). May be -1 if not such token is available.
      • getLastTokenBeginColumnNumber

        @CheckForSigned
        public int getLastTokenBeginColumnNumber()
        Returns:
        The column number where the last token begins (incl.). May be -1 if not such token is available.
      • getLastTokenEndLineNumber

        @CheckForSigned
        public int getLastTokenEndLineNumber()
        Returns:
        The line number where the fist token ends (incl.). May be -1 if not such token is available.
      • getLastTokenEndColumnNumber

        @CheckForSigned
        public int getLastTokenEndColumnNumber()
        Returns:
        The column number where the last token ends (incl.). May be -1 if not such token is available.
      • getFirstTokenLocationAsString

        @Nullable
        public String getFirstTokenLocationAsString()
        Returns:
        The location of the first token as a simple string. May be null.
      • getLastTokenLocationAsString

        @Nullable
        public String getLastTokenLocationAsString()
        Returns:
        The location of the last token as a simple string. May be null.
      • getLocationAsString

        @Nonnull
        @Nonempty
        public String getLocationAsString()
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object