gnu.lists
Class PairWithPosition

java.lang.Object
  extended by gnu.lists.AbstractSequence
      extended by gnu.lists.ExtSequence
          extended by gnu.lists.LList
              extended by gnu.lists.Pair
                  extended by gnu.lists.PairWithPosition
All Implemented Interfaces:
Consumable, Sequence, SourceLocator, java.io.Externalizable, java.io.Serializable, java.lang.Comparable, java.lang.Iterable, java.util.Collection, java.util.List, org.xml.sax.Locator

public class PairWithPosition
extends Pair
implements SourceLocator

A Pair with the file name and position it was read from.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class gnu.lists.Pair
car, cdr
 
Fields inherited from class gnu.lists.LList
Empty
 
Fields inherited from interface gnu.lists.Sequence
ATTRIBUTE_VALUE, BOOLEAN_VALUE, CDATA_VALUE, CHAR_VALUE, COMMENT_VALUE, DOCUMENT_VALUE, DOUBLE_VALUE, ELEMENT_VALUE, EOF_VALUE, eofValue, FLOAT_VALUE, INT_S16_VALUE, INT_S32_VALUE, INT_S64_VALUE, INT_S8_VALUE, INT_U16_VALUE, INT_U32_VALUE, INT_U64_VALUE, INT_U8_VALUE, OBJECT_VALUE, PRIM_VALUE, PROCESSING_INSTRUCTION_VALUE, TEXT_BYTE_VALUE
 
Constructor Summary
PairWithPosition()
          Only for serialization.
PairWithPosition(java.lang.Object car, java.lang.Object cdr)
           
PairWithPosition(SourceLocator where, java.lang.Object car, java.lang.Object cdr)
           
 
Method Summary
 int getColumnNumber()
          Return current column number.
 java.lang.String getFileName()
          Normally same as getSystemId.
 int getLineNumber()
          Get the line number of (the start of) this Expression.
 java.lang.String getPublicId()
           
 java.lang.String getSystemId()
           
 boolean isStableSourceLocation()
          True if position is unlikely to change.
static PairWithPosition make(java.lang.Object car, java.lang.Object cdr, java.lang.String filename, int position)
           
static PairWithPosition make(java.lang.Object car, java.lang.Object cdr, java.lang.String filename, int line, int column)
           
 void readExternal(java.io.ObjectInput in)
           
 void setFile(java.lang.String filename)
           
 void setLine(int lineno)
           
 void setLine(int lineno, int colno)
           
 void writeExternal(java.io.ObjectOutput out)
           
 
Methods inherited from class gnu.lists.Pair
compareTo, compareTo, equals, equals, get, getPosNext, getPosPrevious, hashCode, hasNext, isEmpty, lastPair, length, make, nextPos, readResolve, size, toArray, toArray
 
Methods inherited from class gnu.lists.LList
chain1, chain4, checkNonList, consume, consX, createPos, createRelativePos, getIterator, length, list1, list2, list3, list4, listLength, listTail, makeList, makeList, makeList, reverseInPlace, setPosNext, setPosPrevious, toString
 
Methods inherited from class gnu.lists.ExtSequence
copyPos, isAfterPos, nextIndex, releasePos
 
Methods inherited from class gnu.lists.AbstractSequence
add, add, addAll, addAll, addPos, clear, compare, compare, compare, consumeNext, consumePosRange, contains, containsAll, elements, endPos, equals, fill, fill, fillPosRange, firstAttributePos, firstChildPos, firstChildPos, fromEndIndex, get, getAttribute, getAttributeLength, getContainingSequenceSize, getEffectiveIndex, getIndexDifference, getIterator, getIteratorAtPos, getLowBound, getNextKind, getNextTypeName, getNextTypeObject, getSize, gotoAttributesStart, gotoChildrenStart, gotoParent, hasPrevious, indexOf, iterator, lastIndexOf, listIterator, listIterator, nextIndex, nextMatching, parentPos, previousPos, rank, remove, remove, removeAll, removePos, removePosRange, retainAll, set, set, stableCompare, startPos, subList, subSequence, subSequencePos, toString, unsupported, unsupportedException
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface gnu.lists.Sequence
elements, fill, set
 
Methods inherited from interface java.util.List
add, add, addAll, addAll, clear, contains, containsAll, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, retainAll, subList
 

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)

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 SourceLocator
Specified by:
getPublicId in interface org.xml.sax.Locator

getSystemId

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

getLineNumber

public final int getLineNumber()
Get the line number of (the start of) this Expression. The "first" line is line 1; unknown is -1.

Specified by:
getLineNumber in interface SourceLocator
Specified by:
getLineNumber in interface org.xml.sax.Locator

getColumnNumber

public final int getColumnNumber()
Description copied from interface: SourceLocator
Return current column number. The "first" column is column 1; unknown is -1.

Specified by:
getColumnNumber in interface SourceLocator
Specified by:
getColumnNumber in interface org.xml.sax.Locator

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,
                                    int position)

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