Package gnu.lists

Class PairWithPosition

  • All Implemented Interfaces:
    BoundedHashable, Consumable, Sequence<java.lang.Object>, SourceLocator, java.io.Externalizable, java.io.Serializable, java.lang.Comparable, java.lang.Iterable<java.lang.Object>, java.util.Collection<java.lang.Object>, java.util.List<java.lang.Object>, javax.xml.transform.SourceLocator, org.xml.sax.Locator
    Direct Known Subclasses:
    SyntaxForms.PairWithPositionSyntaxForm

    public class PairWithPosition
    extends ImmutablePair
    implements SourceLocator
    A Pair with the file name and position it was read from. Note the position (start/end range) is actually that of the car part.
    See Also:
    Serialized Form
    • Constructor Detail

      • PairWithPosition

        public PairWithPosition()
        Only for serialization.
      • PairWithPosition

        public PairWithPosition​(SourceLocator where,
                                java.lang.Object car,
                                java.lang.Object cdr)
      • PairWithPosition

        public PairWithPosition​(java.lang.Object car,
                                java.lang.Object cdr)
    • Method Detail

      • setFile

        public final void setFile​(java.lang.String filename)
      • setLine

        public final void setLine​(int lineno,
                                  int colno)
      • setEndLine

        public final void setEndLine​(int endline,
                                     int endcolumn)
      • setLine

        public final void setLine​(int lineno)
      • getFileName

        public final java.lang.String getFileName()
        Description copied from interface: SourceLocator
        Normally same as getSystemId.
        Specified by:
        getFileName in interface SourceLocator
      • getPublicId

        public java.lang.String getPublicId()
        Specified by:
        getPublicId in interface org.xml.sax.Locator
        Specified by:
        getPublicId in interface SourceLocator
        Specified by:
        getPublicId in interface javax.xml.transform.SourceLocator
      • getSystemId

        public java.lang.String getSystemId()
        Specified by:
        getSystemId in interface org.xml.sax.Locator
        Specified by:
        getSystemId in interface SourceLocator
        Specified by:
        getSystemId in interface javax.xml.transform.SourceLocator
      • getLineNumber

        public final int getLineNumber()
        Description copied from interface: SourceLocator
        Return current line number. Normally the same as getStartLine(). The "first" line is line 1; unknown is -1.
        Specified by:
        getLineNumber in interface org.xml.sax.Locator
        Specified by:
        getLineNumber in interface SourceLocator
        Specified by:
        getLineNumber in interface javax.xml.transform.SourceLocator
      • getColumnNumber

        public final int getColumnNumber()
        Description copied from interface: SourceLocator
        Return current column number. Normally the same as getStartColumn(). The "first" column is column 1; unknown is -1.
        Specified by:
        getColumnNumber in interface org.xml.sax.Locator
        Specified by:
        getColumnNumber in interface SourceLocator
        Specified by:
        getColumnNumber in interface javax.xml.transform.SourceLocator
      • getStartLine

        public final int getStartLine()
        Description copied from interface: SourceLocator
        Line number (one-origin) of start of range; unknown/unspecified is -1.
        Specified by:
        getStartLine in interface SourceLocator
      • getStartColumn

        public final int getStartColumn()
        Description copied from interface: SourceLocator
        Column (one-origin) of start of range; unknown/unspecified is -1.
        Specified by:
        getStartColumn in interface SourceLocator
      • getEndLine

        public final int getEndLine()
        Description copied from interface: SourceLocator
        Line number (one-origin) of end of range; unknown/unspecified is -1.
        Specified by:
        getEndLine in interface SourceLocator
      • getEndColumn

        public final int getEndColumn()
        Description copied from interface: SourceLocator
        Column (one-origin) of end of range; unknown/unspecified is -1.
        Specified by:
        getEndColumn in interface SourceLocator
      • isStableSourceLocation

        public boolean isStableSourceLocation()
        Description copied from interface: SourceLocator
        True if position is unlikely to change. True for an expression but not an input file.
        Specified by:
        isStableSourceLocation in interface SourceLocator
      • make

        public static PairWithPosition make​(java.lang.Object car,
                                            java.lang.Object cdr,
                                            java.lang.String filename,
                                            int line,
                                            int column)
      • make

        public static PairWithPosition make​(java.lang.Object car,
                                            java.lang.Object cdr,
                                            java.lang.String filename,
                                            long position)
      • init

        public void init​(java.lang.Object car,
                         java.lang.Object cdr,
                         java.lang.String filename,
                         long position)
        Should only be used when initializing a PairWithPosition instance.
      • writeExternal

        public void writeExternal​(java.io.ObjectOutput out)
                           throws java.io.IOException
        Specified by:
        writeExternal in interface java.io.Externalizable
        Overrides:
        writeExternal in class Pair
        Throws:
        java.io.IOException
      • readExternal

        public void readExternal​(java.io.ObjectInput in)
                          throws java.io.IOException,
                                 java.lang.ClassNotFoundException
        Specified by:
        readExternal in interface java.io.Externalizable
        Overrides:
        readExternal in class Pair
        Throws:
        java.io.IOException
        java.lang.ClassNotFoundException