/** * Create a copy of this atomic value, with a different type label * * @param typeLabel the type label of the new copy. The caller is responsible for checking that * the value actually conforms to this type. */ /*@NotNull*/ public AtomicValue copyAsSubType(/*@NotNull*/ AtomicType typeLabel) { if (typeLabel.getPrimitiveType() == StandardNames.XS_INTEGER) { BigIntegerValue v = new BigIntegerValue(value); v.typeLabel = typeLabel; return v; } else { return new BigDecimalValue(new BigDecimal(value)); } }
/** * Create a copy of this atomic value, with a different type label * * @param typeLabel the type label of the new copy. The caller is responsible for checking that * the value actually conforms to this type. */ /*@NotNull*/ public AtomicValue copyAsSubType(/*@NotNull*/ AtomicType typeLabel) { if (typeLabel.getPrimitiveType() == StandardNames.XS_INTEGER) { BigIntegerValue v = new BigIntegerValue(value); v.typeLabel = typeLabel; return v; } else { return new BigDecimalValue(new BigDecimal(value)); } }
/** * Create a copy of this atomic value, with a different type label * * @param typeLabel the type label of the new copy. The caller is responsible for checking that * the value actually conforms to this type. */ /*@NotNull*/ public AtomicValue copyAsSubType(/*@NotNull*/ AtomicType typeLabel) { if (typeLabel.getPrimitiveType() == StandardNames.XS_INTEGER) { Int64Value v = new Int64Value(value); v.typeLabel = typeLabel; return v; } else { return new BigDecimalValue(value); } }
/** * Create a copy of this atomic value, with a different type label * * @param typeLabel the type label of the new copy. The caller is responsible for checking that * the value actually conforms to this type. */ /*@NotNull*/ public AtomicValue copyAsSubType(/*@NotNull*/ AtomicType typeLabel) { if (typeLabel.getPrimitiveType() == StandardNames.XS_INTEGER) { Int64Value v = new Int64Value(value); v.typeLabel = typeLabel; return v; } else { return new BigDecimalValue(value); } }
public AtomicValue compute(AtomicValue a, AtomicValue b, XPathContext c) throws XPathException { Calculator calc = getCalculator( a.getItemType().getPrimitiveType(), b.getItemType().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 AtomicValue compute(AtomicValue a, AtomicValue b, XPathContext c) throws XPathException { Calculator calc = getCalculator( a.getItemType().getPrimitiveType(), b.getItemType().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 AtomicValue compute(AtomicValue a, AtomicValue b, XPathContext c) throws XPathException { Calculator calc = getCalculator( a.getItemType().getPrimitiveType(), b.getItemType().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 AtomicValue compute(AtomicValue a, AtomicValue b, XPathContext c) throws XPathException { Calculator calc = getCalculator( a.getItemType().getPrimitiveType(), b.getItemType().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 AtomicValue compute(AtomicValue a, AtomicValue b, XPathContext c) throws XPathException { Calculator calc = getCalculator( a.getItemType().getPrimitiveType(), b.getItemType().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 AtomicValue compute(AtomicValue a, AtomicValue b, XPathContext c) throws XPathException { Calculator calc = getCalculator( a.getItemType().getPrimitiveType(), b.getItemType().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 AtomicValue compute(AtomicValue a, AtomicValue b, XPathContext c) throws XPathException { Calculator calc = getCalculator( a.getItemType().getPrimitiveType(), b.getItemType().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 AtomicValue compute(AtomicValue a, AtomicValue b, XPathContext c) throws XPathException { Calculator calc = getCalculator( a.getItemType().getPrimitiveType(), b.getItemType().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 AtomicValue compute(AtomicValue a, AtomicValue b, XPathContext c) throws XPathException { Calculator calc = getCalculator( a.getItemType().getPrimitiveType(), b.getItemType().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 AtomicValue compute(AtomicValue a, AtomicValue b, XPathContext c) throws XPathException { Calculator calc = getCalculator( a.getItemType().getPrimitiveType(), b.getItemType().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 AtomicValue compute(AtomicValue a, AtomicValue b, XPathContext c) throws XPathException { Calculator calc = getCalculator( a.getItemType().getPrimitiveType(), b.getItemType().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 AtomicValue compute(AtomicValue a, AtomicValue b, XPathContext c) throws XPathException { Calculator calc = getCalculator( a.getItemType().getPrimitiveType(), b.getItemType().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); } }
/** * Internal factory method to create a BuiltInAtomicType. There is one instance for each of the * built-in atomic types * * @param fingerprint The name of the type * @param baseType The base type from which this type is derived * @return the newly constructed built in atomic type */ private static BuiltInAtomicType makeAtomicType(int fingerprint, SimpleType baseType, boolean ordered) { BuiltInAtomicType t = new BuiltInAtomicType(fingerprint); t.setBaseTypeFingerprint(baseType.getFingerprint()); if (t.isPrimitiveType()) { t.primitiveFingerprint = fingerprint; } else { t.primitiveFingerprint = ((AtomicType)baseType).getPrimitiveType(); } t.ordered = ordered; BuiltInType.register(fingerprint, t); return t; } }
/** * Internal factory method to create a BuiltInAtomicType. There is one instance for each of the * built-in atomic types * * @param fingerprint The name of the type * @param baseType The base type from which this type is derived * @param code Alphabetic code chosen to enable ordering of types according to the type hierarchy * @param ordered true if the type is ordered * @return the newly constructed built in atomic type */ /*@NotNull*/ private static BuiltInAtomicType makeAtomicType(int fingerprint, SimpleType baseType, String code, boolean ordered) { BuiltInAtomicType t = new BuiltInAtomicType(fingerprint); t.setBaseTypeFingerprint(baseType.getFingerprint()); if (t.isPrimitiveType()) { t.primitiveFingerprint = fingerprint; } else { t.primitiveFingerprint = ((AtomicType) baseType).getPrimitiveType(); } t.uType = UType.fromTypeCode(t.primitiveFingerprint); t.ordered = ordered; t.alphaCode = code; BuiltInType.register(fingerprint, t); return t; }
/** * Internal factory method to create a BuiltInAtomicType. There is one instance for each of the * built-in atomic types * * @param fingerprint The name of the type * @param baseType The base type from which this type is derived * @param ordered true if the type is ordered * @return the newly constructed built in atomic type */ /*@NotNull*/ private static BuiltInAtomicType makeAtomicType(int fingerprint, SimpleType baseType, boolean ordered) { BuiltInAtomicType t = new BuiltInAtomicType(fingerprint); t.setBaseTypeFingerprint(baseType.getFingerprint()); if (t.isPrimitiveType()) { t.primitiveFingerprint = fingerprint; } else { t.primitiveFingerprint = ((AtomicType) baseType).getPrimitiveType(); } t.uType = UType.fromTypeCode(t.primitiveFingerprint); t.ordered = ordered; BuiltInType.register(fingerprint, t); return t; }
/** * Internal factory method to create a BuiltInAtomicType. There is one instance for each of the * built-in atomic types * * @param fingerprint The name of the type * @param baseType The base type from which this type is derived * @return the newly constructed built in atomic type */ private static BuiltInAtomicType makeAtomicType(int fingerprint, SimpleType baseType) { BuiltInAtomicType t = new BuiltInAtomicType(fingerprint); t.setBaseTypeFingerprint(baseType.getFingerprint()); if (t.isPrimitiveType()) { t.primitiveFingerprint = fingerprint; } else { t.primitiveFingerprint = ((AtomicType)baseType).getPrimitiveType(); } if (baseType instanceof BuiltInAtomicType) { t.ordered = ((BuiltInAtomicType)baseType).ordered; } BuiltInType.register(t.getFingerprint(), t); return t; } }