Examples of AtomicType


Examples of net.sf.saxon.type.AtomicType

        operand0 = TypeChecker.staticTypeCheck(operand0, atomicType, true, role0, visitor);
        final ItemType itemType0 = operand0.getItemType(th);
        if (itemType0 instanceof EmptySequenceTest) {
            return Literal.makeLiteral(DoubleValue.NaN);
        }
        AtomicType type0 = (AtomicType) itemType0.getPrimitiveItemType();
        if (calculator == null) {
            operand0 = createConversionCode(operand0, th, type0);
        }
        type0 = (AtomicType) operand0.getItemType(th).getPrimitiveItemType();

        // System.err.println("First operand"); operand0.display(10);

        RoleLocator role1 = new RoleLocator(RoleLocator.BINARY_EXPR, Token.tokens[operator], 1, null);
        role1.setSourceLocator(this);
        operand1 = TypeChecker.staticTypeCheck(operand1, atomicType, true, role1, visitor);
        final ItemType itemType1 = operand1.getItemType(th);
        if (itemType1 instanceof EmptySequenceTest) {
            return Literal.makeLiteral(DoubleValue.NaN);
        }
        AtomicType type1 = (AtomicType)itemType1.getPrimitiveItemType();
        if (calculator == null) {
            operand1 = createConversionCode(operand1, th, type1);
        }

        type1 = (AtomicType) operand1.getItemType(th).getPrimitiveItemType();

        if (operand0 != oldOp0) {
            adoptChildExpression(operand0);
        }

        if (operand1 != oldOp1) {
            adoptChildExpression(operand1);
        }

        if (operator == Token.NEGATE) {
            if (operand1 instanceof Literal) {
                Value v = ((Literal)operand1).getValue();
                if (v instanceof NumericValue) {
                    return Literal.makeLiteral(((NumericValue)v).negate());
                }
            }
            NegateExpression ne = new NegateExpression(operand1);
            ne.setBackwardsCompatible(true);
            return visitor.typeCheck(ne, contextItemType);
        }

        // Get a calculator to implement the arithmetic operation. If the types are not yet specifically known,
        // we allow this to return an "ANY" calculator which defers the decision. However, we only allow this if
        // at least one of the operand types is AnyAtomicType.

        boolean mustResolve = !(type0.equals(BuiltInAtomicType.ANY_ATOMIC) || type1.equals(BuiltInAtomicType.ANY_ATOMIC));

        calculator = Calculator.getCalculator(type0.getFingerprint(), type1.getFingerprint(),
                ArithmeticExpression.mapOpCode(operator), mustResolve);

        if (calculator == null) {
            XPathException de = new XPathException("Arithmetic operator is not defined for arguments of types (" +
                    type0.getDescription() + ", " + type1.getDescription() + ")");
            de.setLocator(this);
            de.setErrorCode("XPTY0004");
            throw de;
        }
View Full Code Here

Examples of net.sf.saxon.type.AtomicType

    public void append(Item item, int locationId, int copyNamespaces) throws XPathException {
        if (item instanceof AtomicValue) {
            final NamePool pool = getNamePool();
            out.startElement(resultAtomicValue, StandardNames.XS_UNTYPED, 0, 0);
            AtomicType type = (AtomicType)((AtomicValue)item).getItemType(getConfiguration().getTypeHierarchy());
            int nameCode = type.getNameCode();
            String prefix = pool.getPrefix(nameCode);
            String localName = pool.getLocalName(nameCode);
            String uri = pool.getURI(nameCode);
            if (prefix.length() == 0) {
                prefix = pool.suggestPrefixForURI(uri);
View Full Code Here

Examples of org.apache.vxquery.types.AtomicType

    private boolean itemSequenceTypeMatch(TaggedValuePointable tvp, ItemType it) {
        byte tag = tvp.getTag();
        if (it instanceof AnyItemType) {
            return true;
        } else if (it.isAtomicType()) {
            AtomicType ait = (AtomicType) it;
            if (BuiltinTypeRegistry.INSTANCE.isBuiltinTypeId(tag)) {
                SchemaType vType = BuiltinTypeRegistry.INSTANCE.getSchemaTypeById(tag);
                while (vType != null && vType.getTypeId() != ait.getTypeId()) {
                    vType = vType.getBaseType();
                }
                return vType != null;
            }
        } else if (it instanceof NodeType && tag == ValueTag.NODE_TREE_TAG) {
View Full Code Here

Examples of org.apache.vxquery.types.AtomicType

        ItemType it = sequenceType.getItemType();
        if (stq.isSubQuantifier(testST.getQuantifier())) {
            if (it instanceof AnyItemType) {
                return true;
            } else if (it.isAtomicType() && testST.getItemType().isAtomicType()) {
                AtomicType ait = (AtomicType) it;
                AtomicType testIT = (AtomicType) testST.getItemType();
                if (BuiltinTypeRegistry.INSTANCE.isBuiltinTypeId(testIT.getTypeId())) {
                    SchemaType vType = BuiltinTypeRegistry.INSTANCE.getSchemaTypeById(testIT.getTypeId());
                    while (vType != null && vType.getTypeId() != ait.getTypeId()) {
                        vType = vType.getBaseType();
                    }
                    return vType != null;
                }
View Full Code Here

Examples of org.apache.vxquery.types.AtomicType

    private ILogicalExpression ce(SequenceType type, Object value) throws SystemException {
        try {
            ItemType it = type.getItemType();
            if (it.isAtomicType()) {
                AtomicType at = (AtomicType) it;
                byte[] bytes = null;
                switch (at.getTypeId()) {
                    case BuiltinTypeConstants.XS_BOOLEAN_TYPE_ID: {
                        baaos.reset();
                        dOut.write((byte) ValueTag.XS_BOOLEAN_TAG);
                        dOut.writeByte(((Boolean) value).booleanValue() ? 1 : 0);
                        break;
View Full Code Here

Examples of org.apache.vxquery.types.AtomicType

    private ILogicalExpression normalize(ILogicalExpression expr, SequenceType type) throws SystemException {
        if (type.getItemType().isAtomicType()) {
            ILogicalExpression atomizedExpr = new ScalarFunctionCallExpression(BuiltinFunctions.FN_DATA_1,
                    Collections.singletonList(mutable(expr)));
            AtomicType aType = (AtomicType) type.getItemType();
            if (TypeUtils.isSubtypeTypeOf(aType, BuiltinTypeRegistry.XS_BOOLEAN)) {
                return new ScalarFunctionCallExpression(BuiltinFunctions.FN_BOOLEAN_1,
                        Collections.singletonList(mutable(atomizedExpr)));
            }
            return promote(atomizedExpr, type);
View Full Code Here

Examples of org.apache.vxquery.types.AtomicType

    private ILogicalExpression ce(SequenceType type, Object value) throws SystemException {
        try {
            ItemType it = type.getItemType();
            if (it.isAtomicType()) {
                AtomicType at = (AtomicType) it;
                byte[] bytes = null;
                switch (at.getTypeId()) {
                    case BuiltinTypeConstants.XS_BOOLEAN_TYPE_ID: {
                        baaos.reset();
                        dOut.write((byte) ValueTag.XS_BOOLEAN_TAG);
                        dOut.writeByte(((Boolean) value).booleanValue() ? 1 : 0);
                        break;
View Full Code Here

Examples of org.apache.vxquery.types.AtomicType

    private ILogicalExpression normalize(ILogicalExpression expr, SequenceType type) throws SystemException {
        if (type.getItemType().isAtomicType()) {
            ILogicalExpression atomizedExpr = new ScalarFunctionCallExpression(BuiltinFunctions.FN_DATA_1,
                    Collections.singletonList(mutable(expr)));
            AtomicType aType = (AtomicType) type.getItemType();
            if (TypeUtils.isSubtypeTypeOf(aType, BuiltinTypeRegistry.XS_BOOLEAN)) {
                return new ScalarFunctionCallExpression(BuiltinFunctions.FN_BOOLEAN_1,
                        Collections.singletonList(mutable(atomizedExpr)));
            }
            return promote(atomizedExpr, type);
View Full Code Here

Examples of org.apache.vxquery.types.AtomicType

    private boolean itemSequenceTypeMatch(TaggedValuePointable tvp, ItemType it) {
        byte tag = tvp.getTag();
        if (it instanceof AnyItemType) {
            return true;
        } else if (it.isAtomicType()) {
            AtomicType ait = (AtomicType) it;
            if (BuiltinTypeRegistry.INSTANCE.isBuiltinTypeId(tag)) {
                SchemaType vType = BuiltinTypeRegistry.INSTANCE.getSchemaTypeById(tag);
                while (vType != null && vType.getTypeId() != ait.getTypeId()) {
                    vType = vType.getBaseType();
                }
                return vType != null;
            }
        } else if (it instanceof NodeType && tag == ValueTag.NODE_TREE_TAG) {
View Full Code Here

Examples of org.apache.vxquery.types.AtomicType

    private ILogicalExpression ce(SequenceType type, Object value) throws SystemException {
        try {
            ItemType it = type.getItemType();
            if (it.isAtomicType()) {
                AtomicType at = (AtomicType) it;
                byte[] bytes = null;
                switch (at.getTypeId()) {
                    case BuiltinTypeConstants.XS_BOOLEAN_TYPE_ID: {
                        baaos.reset();
                        dOut.write((byte) ValueTag.XS_BOOLEAN_TAG);
                        dOut.writeByte(((Boolean) value).booleanValue() ? 1 : 0);
                        break;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.