Package gnu.kawa.xml
Class Nodes
- java.lang.Object
-
- gnu.lists.AbstractSequence<E>
-
- gnu.mapping.Values<E>
-
- gnu.mapping.Values.FromList<SeqPosition>
-
- gnu.kawa.xml.Nodes
-
- All Implemented Interfaces:
Consumable
,Consumer
,PositionConsumer
,Externalizable
,Serializable
,Appendable
,Consumer<Object>
,DoubleConsumer
,IntConsumer
,LongConsumer
,NodeList
- Direct Known Subclasses:
SortedNodes
public class Nodes extends Values.FromList<SeqPosition> implements PositionConsumer, NodeList, Consumer
Manages a sequence of node references.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Nodes.NodeVector
-
Nested classes/interfaces inherited from class gnu.mapping.Values
Values.FromArray<E>, Values.FromList<E>, Values.FromTreeList, Values.Values2<E,V1 extends E,V2 extends E>
-
-
Field Summary
Fields Modifier and Type Field Description protected Nodes.NodeVector
vector
-
Fields inherited from class gnu.lists.AbstractSequence
noInts
-
-
Constructor Summary
Constructors Constructor Description Nodes()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Consumer
append(char c)
Consumer
append(CharSequence csq)
Consumer
append(CharSequence csq, int start, int end)
void
beginEntity(Object base)
void
consumePosRange(int iposStart, int iposEnd, Consumer out)
void
endAttribute()
End of an attribute or end of an actual parameter.void
endDocument()
void
endElement()
void
endEntity()
int
getLength()
int
getPos(int index)
Optimization of ((SeqPosition) get(index)).AbstractSequence
getSeq(int index)
Optimization of((SeqPosition) get(index)).sequence
.boolean
ignoring()
True if consumer is ignoring rest of element.Node
item(int index)
static KNode
root(NodeTree seq, int ipos)
void
startAttribute(Object attrType)
Write a attribute for the current element.void
startDocument()
void
startElement(Object type)
void
write(char[] buf, int off, int len)
void
write(int v)
void
write(CharSequence str, int start, int length)
void
write(String str)
void
writeBoolean(boolean v)
void
writeCDATA(char[] chars, int offset, int length)
void
writeComment(char[] chars, int offset, int length)
void
writeDouble(double v)
void
writeFloat(float v)
void
writeInt(int v)
void
writeLong(long v)
void
writeObject(Object v)
void
writePosition(AbstractSequence seq, int ipos)
Consume a single position pair.void
writePosition(SeqPosition position)
Consume node at current position.void
writeProcessingInstruction(String target, char[] content, int offset, int length)
-
Methods inherited from class gnu.mapping.Values.FromList
get, getValues, readExternal, size
-
Methods inherited from class gnu.mapping.Values
call_with, canonicalize, checkFinalPos, countValues, getFromPos, getFromPosFinal, incrPos, make, make, make, make, makeFromArray, nextIndex, nextIndex, nextValue, print, readResolve, values, values2, writeExternal, writeValues
-
Methods inherited from class gnu.lists.AbstractSequence
add, add, addAll, addAll, addPos, asImmutable, badRank, boundedHash, checkCanWrite, checkRank, clear, compare, compare, compare, consume, consume, consumeNext, contains, containsAll, copyPos, createPos, createRelativePos, effectiveIndex, effectiveIndex, effectiveIndex, effectiveIndex, effectiveIndex, elements, endPos, equals, 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, getIterator, getIteratorAtPos, getLongRaw, getLowBound, getNextKind, getNextTypeName, getNextTypeObject, getPosNext, getPosPrevious, getRaw, getRowMajor, getShortRaw, getSize, getSize, gotoAttributesStart, gotoChildrenStart, gotoParent, hashCode, hasNext, hasPrevious, indexOf, isAfterPos, isEmpty, iterator, lastIndexOf, listIterator, listIterator, nextIndex, nextMatching, nextPos, parentPos, previousPos, rank, releasePos, remove, remove, removeAll, removePos, removePosRange, retainAll, set, set, setAt, setBuffer, setPosNext, setPosPrevious, setRaw, stableCompare, startPos, subList, subSequence, subSequencePos, toArray, toArray, toString, toString, unsupported, unsupportedException
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface gnu.lists.Consumable
consume
-
Methods inherited from interface java.util.function.DoubleConsumer
andThen
-
Methods inherited from interface java.util.function.IntConsumer
andThen
-
Methods inherited from interface java.util.function.LongConsumer
andThen
-
-
-
-
Field Detail
-
vector
protected Nodes.NodeVector vector
-
-
Method Detail
-
append
public Consumer append(char c)
- Specified by:
append
in interfaceAppendable
- Specified by:
append
in interfaceConsumer
-
append
public Consumer append(CharSequence csq)
- Specified by:
append
in interfaceAppendable
- Specified by:
append
in interfaceConsumer
-
ignoring
public boolean ignoring()
Description copied from interface:Consumer
True if consumer is ignoring rest of element. The producer can use this information to skip ahead.
-
writePosition
public void writePosition(AbstractSequence seq, int ipos)
Description copied from interface:PositionConsumer
Consume a single position pair. This PositionConsumer may assume the sequence does no reference management; i.e. that copyPos is trivial and releasePos is a no-op. If that is not the case, use consume(TreePosition) instead.- Specified by:
writePosition
in interfacePositionConsumer
-
writePosition
public void writePosition(SeqPosition position)
Description copied from interface:PositionConsumer
Consume node at current position. The caller may invalidate or change the position after consume returns, so if the consumer wants to save it, it needs to copy it.- Specified by:
writePosition
in interfacePositionConsumer
-
writeObject
public void writeObject(Object v)
- Specified by:
writeObject
in interfaceConsumer
-
writeFloat
public void writeFloat(float v)
- Specified by:
writeFloat
in interfaceConsumer
-
writeDouble
public void writeDouble(double v)
- Specified by:
writeDouble
in interfaceConsumer
-
writeBoolean
public void writeBoolean(boolean v)
- Specified by:
writeBoolean
in interfaceConsumer
-
append
public Consumer append(CharSequence csq, int start, int end)
- Specified by:
append
in interfaceAppendable
- Specified by:
append
in interfaceConsumer
-
write
public void write(CharSequence str, int start, int length)
-
startElement
public void startElement(Object type)
- Specified by:
startElement
in interfaceConsumer
-
endElement
public void endElement()
- Specified by:
endElement
in interfaceConsumer
-
startAttribute
public void startAttribute(Object attrType)
Description copied from interface:Consumer
Write a attribute for the current element. This is only allowed immediately after a startElement.- Specified by:
startAttribute
in interfaceConsumer
-
endAttribute
public void endAttribute()
Description copied from interface:Consumer
End of an attribute or end of an actual parameter. The former use matches a startAttribute; the latter may not, and can be used to separate parameters in a parameter list. This double duty suggsts the method should at least be re-named.- Specified by:
endAttribute
in interfaceConsumer
-
writeComment
public void writeComment(char[] chars, int offset, int length)
-
writeCDATA
public void writeCDATA(char[] chars, int offset, int length)
-
writeProcessingInstruction
public void writeProcessingInstruction(String target, char[] content, int offset, int length)
-
startDocument
public void startDocument()
- Specified by:
startDocument
in interfaceConsumer
-
endDocument
public void endDocument()
- Specified by:
endDocument
in interfaceConsumer
-
beginEntity
public void beginEntity(Object base)
-
endEntity
public void endEntity()
-
getSeq
public AbstractSequence getSeq(int index)
Optimization of((SeqPosition) get(index)).sequence
. However returns null instead of throwing IndexOutOfBoundsException ifindex >= count
.
-
getPos
public int getPos(int index)
Optimization of ((SeqPosition) get(index)). ipos.
-
consumePosRange
public void consumePosRange(int iposStart, int iposEnd, Consumer out)
- Overrides:
consumePosRange
in classAbstractSequence<SeqPosition>
-
-