public String toExportString() { FastStringBuffer fsb = new FastStringBuffer(FastStringBuffer.C64); LinkedList<PrimitiveUType> types = new LinkedList<>(uType.decompose()); format(types, fsb, ItemType::toExportString); return fsb.toString(); }
public String toExportString() { FastStringBuffer fsb = new FastStringBuffer(FastStringBuffer.C64); LinkedList<PrimitiveUType> types = new LinkedList<>(uType.decompose()); format(types, fsb, ItemType::toExportString); return fsb.toString(); }
public String toString() { FastStringBuffer fsb = new FastStringBuffer(FastStringBuffer.C64); LinkedList<PrimitiveUType> types = new LinkedList<>(uType.decompose()); format(types, fsb, ItemType::toString); return fsb.toString(); }
public String toString() { FastStringBuffer fsb = new FastStringBuffer(FastStringBuffer.C64); LinkedList<PrimitiveUType> types = new LinkedList<>(uType.decompose()); format(types, fsb, ItemType::toString); return fsb.toString(); }
/** * Produce a string representation of a UType * @return the string representation */ public String toString() { Set<PrimitiveUType> components = decompose(); if (components.isEmpty()) { return "U{}"; } FastStringBuffer sb = new FastStringBuffer(FastStringBuffer.C256); Iterator<PrimitiveUType> iter = components.iterator(); boolean started = false; while (iter.hasNext()) { if (started) { sb.append("|"); } started = true; sb.append(iter.next().toString()); } return sb.toString(); }
/** * Produce a string representation of a UType * @return the string representation */ public String toString() { Set<PrimitiveUType> components = decompose(); if (components.isEmpty()) { return "U{}"; } FastStringBuffer sb = new FastStringBuffer(FastStringBuffer.C256); Iterator<PrimitiveUType> iter = components.iterator(); boolean started = false; while (iter.hasNext()) { if (started) { sb.append("|"); } started = true; sb.append(iter.next().toString()); } return sb.toString(); }
/** * Get the content type allowed by this NodeTest (that is, the type annotation of the matched nodes). * Return AnyType if there are no restrictions. The default implementation returns AnyType. * * @return the type annotation that all nodes matching this NodeTest must satisfy */ public SchemaType getContentType() { Set<PrimitiveUType> m = getUType().decompose(); Iterator<PrimitiveUType> it = m.iterator(); if (m.size() == 1 && it.hasNext()) { PrimitiveUType p = it.next(); switch (p) { case DOCUMENT: return AnyType.getInstance(); case ELEMENT: return AnyType.getInstance(); case ATTRIBUTE: return AnySimpleType.getInstance(); case COMMENT: return BuiltInAtomicType.STRING; case TEXT: return BuiltInAtomicType.UNTYPED_ATOMIC; case PI: return BuiltInAtomicType.STRING; case NAMESPACE: return BuiltInAtomicType.STRING; } } return AnyType.getInstance(); }
/** * Get the content type allowed by this NodeTest (that is, the type annotation of the matched nodes). * Return AnyType if there are no restrictions. The default implementation returns AnyType. * * @return the type annotation that all nodes matching this NodeTest must satisfy */ public SchemaType getContentType() { Set<PrimitiveUType> m = getUType().decompose(); Iterator<PrimitiveUType> it = m.iterator(); if (m.size() == 1 && it.hasNext()) { PrimitiveUType p = it.next(); switch (p) { case DOCUMENT: return AnyType.getInstance(); case ELEMENT: return AnyType.getInstance(); case ATTRIBUTE: return AnySimpleType.getInstance(); case COMMENT: return BuiltInAtomicType.STRING; case TEXT: return BuiltInAtomicType.UNTYPED_ATOMIC; case PI: return BuiltInAtomicType.STRING; case NAMESPACE: return BuiltInAtomicType.STRING; } } return AnyType.getInstance(); }
/** * Given a context item type and an axis, determine the kinds of nodes that can be returned * @param origin the context item type, as a UType representing one or more node kinds * @param axis identifies the axis * @return the set of possible node kinds in the result of the axis expression, as a UType */ public static UType getTargetUType(UType origin, byte axis) { UType resultType = UType.VOID; Set<PrimitiveUType> origins = origin.intersection(UType.ANY_NODE).decompose(); for (PrimitiveUType u : origins) { UType r = axisTransitions.get(makeKey(u, axis)); resultType = resultType.union(r); } return resultType; }
/** * Given a context item type and an axis, determine the kinds of nodes that can be returned * @param origin the context item type, as a UType representing one or more node kinds * @param axis identifies the axis * @return the set of possible node kinds in the result of the axis expression, as a UType */ public static UType getTargetUType(UType origin, byte axis) { UType resultType = UType.VOID; Set<PrimitiveUType> origins = origin.intersection(UType.ANY_NODE).decompose(); for (PrimitiveUType u : origins) { UType r = axisTransitions.get(makeKey(u, axis)); resultType = resultType.union(r); } return resultType; }
/** * Obtain (that is, create or get) an itemType that matches all items whose primitive type is one * of the types present in this UType. * @return a corresponding ItemType */ public ItemType toItemType() { Set<PrimitiveUType> p = decompose(); if (p.isEmpty()) { return ErrorType.getInstance(); } else if (p.size() == 1) { return p.toArray(new PrimitiveUType[1])[0].toItemType(); } else if (ANY_NODE.subsumes(this)) { return AnyNodeTest.getInstance(); } else if (equals(NUMERIC)) { return NumericType.getInstance(); } else if (ANY_ATOMIC.subsumes(this)) { return BuiltInAtomicType.ANY_ATOMIC; } else { return AnyItemType.getInstance(); } }
/** * Obtain (that is, create or get) an itemType that matches all items whose primitive type is one * of the types present in this UType. * @return a corresponding ItemType */ public ItemType toItemType() { Set<PrimitiveUType> p = decompose(); if (p.isEmpty()) { return ErrorType.getInstance(); } else if (p.size() == 1) { return p.toArray(new PrimitiveUType[1])[0].toItemType(); } else if (ANY_NODE.subsumes(this)) { return AnyNodeTest.getInstance(); } else if (equals(NUMERIC)) { return NumericType.getInstance(); } else if (ANY_ATOMIC.subsumes(this)) { return BuiltInAtomicType.ANY_ATOMIC; } else { return AnyItemType.getInstance(); } }
AtomicValue key = (AtomicValue) arguments[1].head(); if (key instanceof UntypedAtomicValue) { for (PrimitiveUType prim : map.getKeyUType().decompose()) { BuiltInAtomicType t = (BuiltInAtomicType)prim.toItemType(); StringConverter converter = t.getStringConverter(rules);
AtomicValue key = (AtomicValue) arguments[1].head(); if (key instanceof UntypedAtomicValue) { for (PrimitiveUType prim : map.getKeyUType().decompose()) { BuiltInAtomicType t = (BuiltInAtomicType)prim.toItemType(); StringConverter converter = t.getStringConverter(rules);