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
APair
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
-
-
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 int
getColumnNumber()
Return current column number.int
getEndColumn()
Column (one-origin) of end of range; unknown/unspecified is -1.int
getEndLine()
Line number (one-origin) of end of range; unknown/unspecified is -1.String
getFileName()
Normally same as getSystemId.int
getLineNumber()
Return current line number.String
getPublicId()
int
getStartColumn()
Column (one-origin) of start of range; unknown/unspecified is -1.int
getStartLine()
Line number (one-origin) of start of range; unknown/unspecified is -1.String
getSystemId()
void
init(Object car, Object cdr, String filename, long position)
Should only be used when initializing a PairWithPosition instance.boolean
isStableSourceLocation()
True if position is unlikely to change.static PairWithPosition
make(Object car, Object cdr, String filename, int line, int column)
static PairWithPosition
make(Object car, Object cdr, String filename, long position)
void
readExternal(ObjectInput in)
void
setEndLine(int endline, int endcolumn)
void
setFile(String filename)
void
setLine(int lineno)
void
setLine(int lineno, int colno)
void
writeExternal(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:SourceLocator
Normally same as getSystemId.- Specified by:
getFileName
in interfaceSourceLocator
-
getPublicId
public String getPublicId()
- Specified by:
getPublicId
in interfaceLocator
- Specified by:
getPublicId
in interfaceSourceLocator
- Specified by:
getPublicId
in interfaceSourceLocator
-
getSystemId
public String getSystemId()
- Specified by:
getSystemId
in interfaceLocator
- Specified by:
getSystemId
in interfaceSourceLocator
- Specified by:
getSystemId
in interfaceSourceLocator
-
getLineNumber
public final int getLineNumber()
Description copied from interface:SourceLocator
Return current line number. Normally the same asgetStartLine()
. The "first" line is line 1; unknown is -1.- Specified by:
getLineNumber
in interfaceLocator
- Specified by:
getLineNumber
in interfaceSourceLocator
- Specified by:
getLineNumber
in interfaceSourceLocator
-
getColumnNumber
public final int getColumnNumber()
Description copied from interface:SourceLocator
Return current column number. Normally the same asgetStartColumn()
. The "first" column is column 1; unknown is -1.- Specified by:
getColumnNumber
in interfaceLocator
- Specified by:
getColumnNumber
in interfaceSourceLocator
- Specified by:
getColumnNumber
in interfaceSourceLocator
-
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 interfaceSourceLocator
-
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 interfaceSourceLocator
-
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 interfaceSourceLocator
-
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 interfaceSourceLocator
-
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 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:
writeExternal
in interfaceExternalizable
- Overrides:
writeExternal
in classPair
- Throws:
IOException
-
readExternal
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
- Specified by:
readExternal
in interfaceExternalizable
- Overrides:
readExternal
in classPair
- Throws:
IOException
ClassNotFoundException
-
-