/** * Get the static type of the expression as a UType, following precisely the type * inference rules defined in the XSLT 3.0 specification. * * @return the static item type of the expression according to the XSLT 3.0 defined rules * @param contextItemType the type of the context item */ @Override public UType getStaticUType(UType contextItemType) { return UType.fromTypeCode(requiredItemType.getPrimitiveType()); }
/** * Get the static type of the expression as a UType, following precisely the type * inference rules defined in the XSLT 3.0 specification. * * @return the static item type of the expression according to the XSLT 3.0 defined rules * @param contextItemType the type of the context item */ @Override public UType getStaticUType(UType contextItemType) { return UType.fromTypeCode(requiredItemType.getPrimitiveType()); }
/** * Test whether a path expression is an absolute path - that is, a path whose first step selects a * document node * * @return true if the first step in this path expression selects a document node */ public boolean isAbsolute() { return getFirstStep().getItemType().getPrimitiveType() == Type.DOCUMENT; }
/** * Test whether a path expression is an absolute path - that is, a path whose first step selects a * document node * * @return true if the first step in this path expression selects a document node */ public boolean isAbsolute() { Expression first = getFirstStep(); return first.getItemType().getPrimitiveType() == Type.DOCUMENT; }
/** * Test whether a path expression is an absolute path - that is, a path whose first step selects a * document node * * @return true if the first step in this path expression selects a document node */ public boolean isAbsolute() { return getFirstStep().getItemType().getPrimitiveType() == Type.DOCUMENT; }
/** * Construct an expression that obtains the effective boolean value of a given expression, * by wrapping it in a call of the boolean() function * * @param in the given expression * @return an expression that wraps the given expression in a call to the fn:boolean() function */ private static Expression forceToBoolean(Expression in) { if (in.getItemType().getPrimitiveType() == StandardNames.XS_BOOLEAN) { return in; } return SystemFunction.makeCall("boolean", in.getRetainedStaticContext(), in); }
public AtomicValue compute(AtomicValue a, AtomicValue b, XPathContext c) throws XPathException { TypeHierarchy th = c.getConfiguration().getTypeHierarchy(); Calculator calc = getCalculator( a.getItemType(th).getPrimitiveType(), b.getItemType(th).getPrimitiveType(), DIV, true); if (calc == null) { throw new XPathException("Unsuitable types for div operation (" + Type.displayTypeName(a) + ", " + Type.displayTypeName(b) + ")", "XPTY0004", c); } else { return calc.compute(a, b, c); } } public AtomicType getResultType(AtomicType typeA, AtomicType typeB) {
public AtomicValue compute(AtomicValue a, AtomicValue b, XPathContext c) throws XPathException { TypeHierarchy th = c.getConfiguration().getTypeHierarchy(); Calculator calc = getCalculator( a.getItemType(th).getPrimitiveType(), b.getItemType(th).getPrimitiveType(), IDIV, true); if (calc == null) { throw new XPathException("Unsuitable types for idiv operation (" + Type.displayTypeName(a) + ", " + Type.displayTypeName(b) + ")", "XPTY0004", c); } else { return calc.compute(a, b, c); } } public AtomicType getResultType(AtomicType typeA, AtomicType typeB) {
public AtomicValue compute(AtomicValue a, AtomicValue b, XPathContext c) throws XPathException { TypeHierarchy th = c.getConfiguration().getTypeHierarchy(); Calculator calc = getCalculator( a.getItemType(th).getPrimitiveType(), b.getItemType(th).getPrimitiveType(), PLUS, true); if (calc == null) { throw new XPathException("Unsuitable types for + operation (" + Type.displayTypeName(a) + ", " + Type.displayTypeName(b) + ")", "XPTY0004", c); } else { return calc.compute(a, b, c); } } public AtomicType getResultType(AtomicType typeA, AtomicType typeB) {
public AtomicValue compute(AtomicValue a, AtomicValue b, XPathContext c) throws XPathException { TypeHierarchy th = c.getConfiguration().getTypeHierarchy(); Calculator calc = getCalculator( a.getItemType(th).getPrimitiveType(), b.getItemType(th).getPrimitiveType(), MINUS, true); if (calc == null) { throw new XPathException("Unsuitable types for - operation (" + Type.displayTypeName(a) + ", " + Type.displayTypeName(b) + ")", "XPTY0004", c); } else { return calc.compute(a, b, c); } } public AtomicType getResultType(AtomicType typeA, AtomicType typeB) {
public AtomicValue compute(AtomicValue a, AtomicValue b, XPathContext c) throws XPathException { TypeHierarchy th = c.getConfiguration().getTypeHierarchy(); Calculator calc = getCalculator( a.getItemType(th).getPrimitiveType(), b.getItemType(th).getPrimitiveType(), TIMES, true); if (calc == null) { throw new XPathException("Unsuitable types for * operation (" + Type.displayTypeName(a) + ", " + Type.displayTypeName(b) + ")", "XPTY0004", c); } else { return calc.compute(a, b, c); } } public AtomicType getResultType(AtomicType typeA, AtomicType typeB) {
public AtomicValue compute(AtomicValue a, AtomicValue b, XPathContext c) throws XPathException { TypeHierarchy th = c.getConfiguration().getTypeHierarchy(); Calculator calc = getCalculator( a.getItemType(th).getPrimitiveType(), b.getItemType(th).getPrimitiveType(), DIV, true); if (calc == null) { throw new XPathException("Unsuitable types for div operation (" + Type.displayTypeName(a) + ", " + Type.displayTypeName(b) + ")", "XPTY0004", c); } else { return calc.compute(a, b, c); } } public AtomicType getResultType(AtomicType typeA, AtomicType typeB) {
public AtomicValue compute(AtomicValue a, AtomicValue b, XPathContext c) throws XPathException { TypeHierarchy th = c.getConfiguration().getTypeHierarchy(); Calculator calc = getCalculator( a.getItemType(th).getPrimitiveType(), b.getItemType(th).getPrimitiveType(), TIMES, true); if (calc == null) { throw new XPathException("Unsuitable types for * operation (" + Type.displayTypeName(a) + ", " + Type.displayTypeName(b) + ")", "XPTY0004", c); } else { return calc.compute(a, b, c); } } public AtomicType getResultType(AtomicType typeA, AtomicType typeB) {
public AtomicValue compute(AtomicValue a, AtomicValue b, XPathContext c) throws XPathException { TypeHierarchy th = c.getConfiguration().getTypeHierarchy(); Calculator calc = getCalculator( a.getItemType(th).getPrimitiveType(), b.getItemType(th).getPrimitiveType(), MOD, true); if (calc == null) { throw new XPathException("Unsuitable types for mod operation (" + Type.displayTypeName(a) + ", " + Type.displayTypeName(b) + ")", "XPTY0004", c); } else { return calc.compute(a, b, c); } } public AtomicType getResultType(AtomicType typeA, AtomicType typeB) {
public AtomicValue compute(AtomicValue a, AtomicValue b, XPathContext c) throws XPathException { TypeHierarchy th = c.getConfiguration().getTypeHierarchy(); Calculator calc = getCalculator( a.getItemType(th).getPrimitiveType(), b.getItemType(th).getPrimitiveType(), PLUS, true); if (calc == null) { throw new XPathException("Unsuitable types for + operation (" + Type.displayTypeName(a) + ", " + Type.displayTypeName(b) + ")", "XPTY0004", c); } else { return calc.compute(a, b, c); } } public AtomicType getResultType(AtomicType typeA, AtomicType typeB) {
public AtomicValue compute(AtomicValue a, AtomicValue b, XPathContext c) throws XPathException { TypeHierarchy th = c.getConfiguration().getTypeHierarchy(); Calculator calc = getCalculator( a.getItemType(th).getPrimitiveType(), b.getItemType(th).getPrimitiveType(), MINUS, true); if (calc == null) { throw new XPathException("Unsuitable types for - operation (" + Type.displayTypeName(a) + ", " + Type.displayTypeName(b) + ")", "XPTY0004", c); } else { return calc.compute(a, b, c); } } public AtomicType getResultType(AtomicType typeA, AtomicType typeB) {
public AtomicValue compute(AtomicValue a, AtomicValue b, XPathContext c) throws XPathException { TypeHierarchy th = c.getConfiguration().getTypeHierarchy(); Calculator calc = getCalculator( a.getItemType(th).getPrimitiveType(), b.getItemType(th).getPrimitiveType(), IDIV, true); if (calc == null) { throw new XPathException("Unsuitable types for idiv operation (" + Type.displayTypeName(a) + ", " + Type.displayTypeName(b) + ")", "XPTY0004", c); } else { return calc.compute(a, b, c); } } public AtomicType getResultType(AtomicType typeA, AtomicType typeB) {
public AtomicValue compute(AtomicValue a, AtomicValue b, XPathContext c) throws XPathException { TypeHierarchy th = c.getConfiguration().getTypeHierarchy(); Calculator calc = getCalculator( a.getItemType(th).getPrimitiveType(), b.getItemType(th).getPrimitiveType(), MOD, true); if (calc == null) { throw new XPathException("Unsuitable types for mod operation (" + Type.displayTypeName(a) + ", " + Type.displayTypeName(b) + ")", "XPTY0004", c); } else { return calc.compute(a, b, c); } } public AtomicType getResultType(AtomicType typeA, AtomicType typeB) {
public void checkArguments(ExpressionVisitor visitor) throws XPathException { super.checkArguments(visitor); if (stringCollator != null) { int type = argument[0].getItemType(visitor.getConfiguration().getTypeHierarchy()).getPrimitiveType(); atomicComparer = AtomicSortComparer.makeSortComparer( stringCollator, type, visitor.getStaticContext().makeEarlyEvaluationContext()); } }
public void checkArguments(ExpressionVisitor visitor) throws XPathException { super.checkArguments(visitor); if (stringCollator != null) { int type = argument[0].getItemType(visitor.getConfiguration().getTypeHierarchy()).getPrimitiveType(); atomicComparer = AtomicSortComparer.makeSortComparer( stringCollator, type, visitor.getStaticContext().makeEarlyEvaluationContext()); } }