/** * Convert the value to a string, using the serialization rules. * For atomic values this is the same as a cast; for sequence values * it gives a space-separated list. For QNames and NOTATIONS, or lists * containing them, it fails. */ /*@NotNull*/ public String getStringValue() { return item == null ? "" : item.getStringValue(); }
/** * Get the string value of this sequence. The string value of an item is the result of applying the string() * function. The string value of an empty sequence is the zero-length string. * * @return the string value of the sequence. */ public CharSequence getStringValueCS() { return item == null ? "" : item.getStringValueCS(); }
/** * Get the n'th item in the value, counting from 0 * * @param n the index of the required item, with 0 representing the first item in the sequence * @return the n'th item if it exists, or null otherwise */ default T itemAt(int n) { return n == 0 ? head() : null; }
@Override public AtomicSequence atomize() throws XPathException { List<AtomicValue> list = new ArrayList<>(source.size()); for (Object o: source) { Item item = objectToItem(o, config); SequenceIterator iter = item.iterate(); while ((item = iter.next()) != null) { AtomicSequence atoms = item.atomize(); for (AtomicValue atom: atoms) { list.add(atom); } } } return new AtomicArray(list); }
CharSequence s = item.getStringValueCS(); if (s.length() > 0) { if (!first && !prevText) { if (sep == null) { sep = separator.evaluateItem(context).getStringValueCS(); SequenceIterator iter2 = item.getTypedValue(); while (true) { Item item2 = iter2.next(); sep = separator.evaluateItem(context).getStringValueCS(); sb.append(item2.getStringValueCS()); if (!first) { if (sep == null) { sep = separator.evaluateItem(context).getStringValueCS(); sb.append(item.getStringValueCS());
public AtomicValue next() throws XPathException { Item nextSource = base.next(); if (nextSource == null) { return null; } else { return (AtomicValue) nextSource.atomize(); } }
public SequenceIterator map(Item item) throws XPathException { if (item instanceof NodeInfo) { return item.getTypedValue(); } else { return SingletonIterator.makeIterator(item); } } }
if (baseVal instanceof MemoClosure) { Item<?> m = ((MemoClosure) baseVal).itemAt(pos - 1); return m == null ? EmptyIterator.emptyIterator() : m.iterate(); } else { Item<?> m = baseVal.materialize().itemAt(pos - 1); return m == null ? EmptyIterator.emptyIterator() : m.iterate(); return i == null ? EmptyIterator.emptyIterator() : i.iterate(); } else { SequenceIterator<?> baseIter = getBase().iterate(context);
CharSequence s = item.getStringValueCS(); if (s.length() > 0) { if (!first && !prevText) { if (sep == null) { sep = separator.evaluateItem(context).getStringValueCS(); SequenceIterator iter2 = item.getTypedValue(); while (true) { Item item2 = iter2.next(); sep = separator.evaluateItem(context).getStringValueCS(); sb.append(item2.getStringValueCS()); if (!first) { if (sep == null) { sep = separator.evaluateItem(context).getStringValueCS(); sb.append(item.getStringValueCS());
protected List<ItemToBeSorted> getItemsToBeSorted(Sequence<?> input) throws XPathException { final List<ItemToBeSorted> inputList = new ArrayList<>(); int i = 0; SequenceIterator<?> iterator = input.iterate(); Item item; while ((item = iterator.next()) != null) { ItemToBeSorted member = new ItemToBeSorted(); member.value = item; member.originalPosition = i++; member.sortKey = item.atomize(); inputList.add(member); } return inputList; }
public SequenceIterator map(Item item) throws XPathException { if (item instanceof NodeInfo) { return item.getTypedValue(); } else { return SingletonIterator.makeIterator(item); } } }
if (baseVal instanceof MemoClosure) { Item<?> m = ((MemoClosure) baseVal).itemAt(pos - 1); return m == null ? EmptyIterator.emptyIterator() : m.iterate(); } else { Item<?> m = baseVal.materialize().itemAt(pos - 1); return m == null ? EmptyIterator.emptyIterator() : m.iterate(); return i == null ? EmptyIterator.emptyIterator() : i.iterate(); } else { SequenceIterator<?> baseIter = getBase().iterate(context);
/** * Convert the value to a string, using the serialization rules. * For atomic values this is the same as a cast; for sequence values * it gives a space-separated list. For QNames and NOTATIONS, or lists * containing them, it fails. */ /*@NotNull*/ public String getStringValue() { return item == null ? "" : item.getStringValue(); }
/** * Get the string value of this sequence. The string value of an item is the result of applying the string() * function. The string value of an empty sequence is the zero-length string. * * @return the string value of the sequence. */ public CharSequence getStringValueCS() { return item == null ? "" : item.getStringValueCS(); }
/** * Get the n'th item in the value, counting from 0 * * @param n the index of the required item, with 0 representing the first item in the sequence * @return the n'th item if it exists, or null otherwise */ default T itemAt(int n) { return n == 0 ? head() : null; }
protected List<ItemToBeSorted> getItemsToBeSorted(Sequence<?> input) throws XPathException { final List<ItemToBeSorted> inputList = new ArrayList<>(); int i = 0; SequenceIterator<?> iterator = input.iterate(); Item item; while ((item = iterator.next()) != null) { ItemToBeSorted member = new ItemToBeSorted(); member.value = item; member.originalPosition = i++; member.sortKey = item.atomize(); inputList.add(member); } return inputList; }
public SequenceIterator map(Item item) throws XPathException { if (item instanceof NodeInfo) { return item.getTypedValue(); } else { return SingletonIterator.makeIterator(item); } } }
public String getText() { if (currentStaxEvent != CHARACTERS && currentStaxEvent != COMMENT) { throw new IllegalStateException(""+currentStaxEvent); } if (previousAtomic) { return currentTextNode.toString(); } else { return currentItem.getStringValue(); } }
/** * Evaluate the function in a string context */ public CharSequence evaluateAsString(XPathContext c) throws XPathException { return evaluateItem(c).getStringValueCS(); }
/** * Get the contents of this value in the form of a Java {@link java.util.Iterator}, * so that the sequence value can be used in a for-each expression * * @return an Iterator delivering a sequence of items containing this single item only */ default Iterator<T> iterator() { return new MonoIterator<>(head()); }