Package gnu.lists
Class PairWithPosition
- java.lang.Object
-
- gnu.lists.AbstractSequence<E>
-
- gnu.lists.ExtSequence<java.lang.Object>
-
- gnu.lists.LList
-
- gnu.lists.Pair
-
- gnu.lists.ImmutablePair
-
- gnu.lists.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
APairwith 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
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface gnu.text.SourceLocator
SourceLocator.Simple
-
-
Field Summary
-
Fields inherited from class gnu.lists.Pair
car, cdr, incompleteListMarker
-
Fields inherited from class gnu.lists.AbstractSequence
noInts
-
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
Constructors Constructor Description PairWithPosition()Only for serialization.PairWithPosition(SourceLocator where, java.lang.Object car, java.lang.Object cdr)PairWithPosition(java.lang.Object car, java.lang.Object cdr)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetColumnNumber()Return current column number.intgetEndColumn()Column (one-origin) of end of range; unknown/unspecified is -1.intgetEndLine()Line number (one-origin) of end of range; unknown/unspecified is -1.java.lang.StringgetFileName()Normally same as getSystemId.intgetLineNumber()Return current line number.java.lang.StringgetPublicId()intgetStartColumn()Column (one-origin) of start of range; unknown/unspecified is -1.intgetStartLine()Line number (one-origin) of start of range; unknown/unspecified is -1.java.lang.StringgetSystemId()voidinit(java.lang.Object car, java.lang.Object cdr, java.lang.String filename, long position)Should only be used when initializing a PairWithPosition instance.booleanisStableSourceLocation()True if position is unlikely to change.static PairWithPositionmake(java.lang.Object car, java.lang.Object cdr, java.lang.String filename, int line, int column)static PairWithPositionmake(java.lang.Object car, java.lang.Object cdr, java.lang.String filename, long position)voidreadExternal(java.io.ObjectInput in)voidsetEndLine(int endline, int endcolumn)voidsetFile(java.lang.String filename)voidsetLine(int lineno)voidsetLine(int lineno, int colno)voidwriteExternal(java.io.ObjectOutput out)-
Methods inherited from class gnu.lists.ImmutablePair
setCar, setCdr
-
Methods inherited from class gnu.lists.Pair
compareTo, compareTo, equals, equals, get, getCar, getCdr, getPosNext, getPosPrevious, hasNext, isEmpty, lastPair, length, make, nextPos, readResolve, setCarBackdoor, setCdrBackdoor, size, toArray, toArray
-
Methods inherited from class gnu.lists.LList
boundedHash, chain1, chain4, checkNonList, consume, consX, createPos, createRelativePos, getIterator, hashCode, length, list1, list2, list3, list4, listLength, 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, asImmutable, badRank, checkCanWrite, checkRank, clear, compare, compare, compare, consume, consumeNext, consumePosRange, contains, containsAll, effectiveIndex, effectiveIndex, effectiveIndex, effectiveIndex, effectiveIndex, elements, endPos, equals, fill, fill, fillPosRange, firstAttributePos, firstChildPos, firstChildPos, fromEndIndex, get, get, get, get, getAttribute, getAttributeLength, getBooleanRaw, getByteRaw, getCharRaw, getContainingSequenceSize, getDoubleRaw, getElementKind, getFloatRaw, getIndexDifference, getInt, getInt, getInt, getInt, getInt, getIntRaw, getIterator, getIteratorAtPos, getLongRaw, getLowBound, getNextKind, getNextTypeName, getNextTypeObject, getRaw, getRowMajor, getShortRaw, getSize, getSize, gotoAttributesStart, gotoChildrenStart, gotoParent, hasPrevious, indexOf, iterator, lastIndexOf, listIterator, listIterator, nextIndex, nextMatching, parentPos, previousPos, rank, remove, remove, removeAll, removePos, removePosRange, retainAll, set, set, setAt, setBuffer, setRaw, stableCompare, startPos, subList, subSequence, subSequencePos, toString, unsupported, unsupportedException
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
-
-
-
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:SourceLocatorNormally same as getSystemId.- Specified by:
getFileNamein interfaceSourceLocator
-
getPublicId
public java.lang.String getPublicId()
- Specified by:
getPublicIdin interfaceorg.xml.sax.Locator- Specified by:
getPublicIdin interfaceSourceLocator- Specified by:
getPublicIdin interfacejavax.xml.transform.SourceLocator
-
getSystemId
public java.lang.String getSystemId()
- Specified by:
getSystemIdin interfaceorg.xml.sax.Locator- Specified by:
getSystemIdin interfaceSourceLocator- Specified by:
getSystemIdin interfacejavax.xml.transform.SourceLocator
-
getLineNumber
public final int getLineNumber()
Description copied from interface:SourceLocatorReturn current line number. Normally the same asgetStartLine(). The "first" line is line 1; unknown is -1.- Specified by:
getLineNumberin interfaceorg.xml.sax.Locator- Specified by:
getLineNumberin interfaceSourceLocator- Specified by:
getLineNumberin interfacejavax.xml.transform.SourceLocator
-
getColumnNumber
public final int getColumnNumber()
Description copied from interface:SourceLocatorReturn current column number. Normally the same asgetStartColumn(). The "first" column is column 1; unknown is -1.- Specified by:
getColumnNumberin interfaceorg.xml.sax.Locator- Specified by:
getColumnNumberin interfaceSourceLocator- Specified by:
getColumnNumberin interfacejavax.xml.transform.SourceLocator
-
getStartLine
public final int getStartLine()
Description copied from interface:SourceLocatorLine number (one-origin) of start of range; unknown/unspecified is -1.- Specified by:
getStartLinein interfaceSourceLocator
-
getStartColumn
public final int getStartColumn()
Description copied from interface:SourceLocatorColumn (one-origin) of start of range; unknown/unspecified is -1.- Specified by:
getStartColumnin interfaceSourceLocator
-
getEndLine
public final int getEndLine()
Description copied from interface:SourceLocatorLine number (one-origin) of end of range; unknown/unspecified is -1.- Specified by:
getEndLinein interfaceSourceLocator
-
getEndColumn
public final int getEndColumn()
Description copied from interface:SourceLocatorColumn (one-origin) of end of range; unknown/unspecified is -1.- Specified by:
getEndColumnin interfaceSourceLocator
-
isStableSourceLocation
public boolean isStableSourceLocation()
Description copied from interface:SourceLocatorTrue if position is unlikely to change. True for an expression but not an input file.- Specified by:
isStableSourceLocationin interfaceSourceLocator
-
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:
writeExternalin interfacejava.io.Externalizable- Overrides:
writeExternalin classPair- Throws:
java.io.IOException
-
readExternal
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException- Specified by:
readExternalin interfacejava.io.Externalizable- Overrides:
readExternalin classPair- Throws:
java.io.IOExceptionjava.lang.ClassNotFoundException
-
-