Package gnu.lists
Class PairWithPosition
- java.lang.Object
-
- gnu.lists.AbstractSequence<E>
-
- gnu.lists.ExtSequence<Object>
-
- gnu.lists.LList
-
- gnu.lists.Pair
-
- gnu.lists.ImmutablePair
-
- gnu.lists.PairWithPosition
-
- All Implemented Interfaces:
BoundedHashable,Consumable,Sequence<Object>,SourceLocator,Externalizable,Serializable,Comparable,Iterable<Object>,Collection<Object>,List<Object>,SourceLocator,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, Object car, Object cdr)PairWithPosition(Object car, 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.StringgetFileName()Normally same as getSystemId.intgetLineNumber()Return current line number.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.StringgetSystemId()voidinit(Object car, Object cdr, String filename, long position)Should only be used when initializing a PairWithPosition instance.booleanisStableSourceLocation()True if position is unlikely to change.static PairWithPositionmake(Object car, Object cdr, String filename, int line, int column)static PairWithPositionmake(Object car, Object cdr, String filename, long position)voidreadExternal(ObjectInput in)voidsetEndLine(int endline, int endcolumn)voidsetFile(String filename)voidsetLine(int lineno)voidsetLine(int lineno, int colno)voidwriteExternal(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
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface java.util.List
add, add, addAll, addAll, clear, contains, containsAll, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, replaceAll, retainAll, sort, spliterator, subList
-
-
-
-
Constructor Detail
-
PairWithPosition
public PairWithPosition()
Only for serialization.
-
PairWithPosition
public PairWithPosition(SourceLocator where, Object car, Object cdr)
-
-
Method Detail
-
setFile
public final void setFile(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 String getFileName()
Description copied from interface:SourceLocatorNormally same as getSystemId.- Specified by:
getFileNamein interfaceSourceLocator
-
getPublicId
public String getPublicId()
- Specified by:
getPublicIdin interfaceLocator- Specified by:
getPublicIdin interfaceSourceLocator- Specified by:
getPublicIdin interfaceSourceLocator
-
getSystemId
public String getSystemId()
- Specified by:
getSystemIdin interfaceLocator- Specified by:
getSystemIdin interfaceSourceLocator- Specified by:
getSystemIdin interfaceSourceLocator
-
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 interfaceLocator- Specified by:
getLineNumberin interfaceSourceLocator- Specified by:
getLineNumberin interfaceSourceLocator
-
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 interfaceLocator- Specified by:
getColumnNumberin interfaceSourceLocator- Specified by:
getColumnNumberin interfaceSourceLocator
-
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(Object car, Object cdr, String filename, int line, int column)
-
make
public static PairWithPosition make(Object car, Object cdr, String filename, long position)
-
init
public void init(Object car, Object cdr, String filename, long position)
Should only be used when initializing a PairWithPosition instance.
-
writeExternal
public void writeExternal(ObjectOutput out) throws IOException
- Specified by:
writeExternalin interfaceExternalizable- Overrides:
writeExternalin classPair- Throws:
IOException
-
readExternal
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
- Specified by:
readExternalin interfaceExternalizable- Overrides:
readExternalin classPair- Throws:
IOExceptionClassNotFoundException
-
-