/** * Create a cast expression * * @param source expression giving the value to be converted * @param target the type to which the value is to be converted * @param allowEmpty true if the expression allows an empty sequence as input, producing * an empty sequence as output. If false, an empty sequence is a type error. */ public CastingExpression(Expression source, AtomicType target, boolean allowEmpty) { super(source); this.allowEmpty = allowEmpty; targetType = target; targetPrimitiveType = (AtomicType) target.getPrimitiveItemType(); //derived = (targetType.getFingerprint() != targetPrimitiveType.getFingerprint()); }
/** * Create a cast expression * * @param source expression giving the value to be converted * @param target the type to which the value is to be converted * @param allowEmpty true if the expression allows an empty sequence as input, producing * an empty sequence as output. If false, an empty sequence is a type error. */ public CastingExpression(Expression source, AtomicType target, boolean allowEmpty) { super(source); this.allowEmpty = allowEmpty; targetType = target; targetPrimitiveType = (AtomicType) target.getPrimitiveItemType(); //derived = (targetType.getFingerprint() != targetPrimitiveType.getFingerprint()); }
/** * Constructor * @param sequence this must be a sequence of atomic values. This is not checked; a ClassCastException * will occur if the precondition is not satisfied. * @param requiredItemType the item type to which all items in the sequence should be converted, * using the rules for "cast as". */ public AtomicSequenceConverter(Expression sequence, AtomicType requiredItemType) { super(sequence); this.requiredItemType = requiredItemType; requiredPrimitiveType = (BuiltInAtomicType)requiredItemType.getPrimitiveItemType(); ExpressionTool.copyLocationInfo(sequence, this); }
/** * Constructor * @param sequence this must be a sequence of atomic values. This is not checked; a ClassCastException * will occur if the precondition is not satisfied. * @param requiredItemType the item type to which all items in the sequence should be converted, * using the rules for "cast as". */ public AtomicSequenceConverter(Expression sequence, AtomicType requiredItemType) { super(sequence); this.requiredItemType = requiredItemType; requiredPrimitiveType = (BuiltInAtomicType)requiredItemType.getPrimitiveItemType(); ExpressionTool.copyLocationInfo(sequence, this); }
/** * Constructor * @param sequence this must be a sequence of atomic values. This is not checked; a ClassCastException * will occur if the precondition is not satisfied. * @param requiredItemType the item type to which all items in the sequence should be converted, * using the rules for "cast as". */ public AtomicSequenceConverter(Expression sequence, AtomicType requiredItemType) { super(sequence); this.requiredItemType = requiredItemType; requiredPrimitiveType = (BuiltInAtomicType)requiredItemType.getPrimitiveItemType(); ExpressionTool.copyLocationInfo(sequence, this); }
/** * Create a cast expression * @param source expression giving the value to be converted * @param target the type to which the value is to be converted * @param allowEmpty true if the expression allows an empty sequence as input, producing * an empty sequence as output. If false, an empty sequence is a type error. */ public CastExpression(Expression source, AtomicType target, boolean allowEmpty) { super(source); this.allowEmpty = allowEmpty; targetType = target; targetPrimitiveType = (AtomicType)target.getPrimitiveItemType(); derived = (targetType.getFingerprint() != targetPrimitiveType.getFingerprint()); adoptChildExpression(source); }
/** * Create a cast expression * @param source expression giving the value to be converted * @param target the type to which the value is to be converted * @param allowEmpty true if the expression allows an empty sequence as input, producing * an empty sequence as output. If false, an empty sequence is a type error. */ public CastExpression(Expression source, AtomicType target, boolean allowEmpty) { super(source); this.allowEmpty = allowEmpty; targetType = target; targetPrimitiveType = (AtomicType)target.getPrimitiveItemType(); derived = (targetType.getFingerprint() != targetPrimitiveType.getFingerprint()); adoptChildExpression(source); }
return convertStringToBuiltInType(value, (BuiltInAtomicType)targetType, checker); } else { BuiltInAtomicType primitiveType = (BuiltInAtomicType)targetType.getPrimitiveItemType(); if (primitiveType.getFingerprint() == StandardNames.XS_STRING) { int whitespaceAction = targetType.getWhitespaceAction(null);
return convertStringToBuiltInType(value, (BuiltInAtomicType)targetType, checker); } else { BuiltInAtomicType primitiveType = (BuiltInAtomicType)targetType.getPrimitiveItemType(); if (primitiveType.getFingerprint() == StandardNames.XS_STRING) { int whitespaceAction = targetType.getWhitespaceAction(null);
argumentType = (BuiltInAtomicType)argument[0].getItemType(th).getAtomizedItemType().getPrimitiveItemType(); Expression e = super.optimize(visitor, contextItemType); if (e != this) {
argumentType = (BuiltInAtomicType)argument[0].getItemType(th).getAtomizedItemType().getPrimitiveItemType(); Expression e = super.optimize(visitor, contextItemType); if (e != this) {
argumentType = (BuiltInAtomicType)argument[0].getItemType(th).getAtomizedItemType().getPrimitiveItemType(); Expression e = super.optimize(visitor, contextItemType); if (e != this) {
StringConverter first = targetType.getPrimitiveItemType().getStringConverter(this); Converter.DownCastingConverter second = new Converter.DownCastingConverter(targetType, this); return new StringConverter.StringToNonStringDerivedType(first, second);
StringConverter first = targetType.getPrimitiveItemType().getStringConverter(this); Converter.DownCastingConverter second = new Converter.DownCastingConverter(targetType, this); return new StringConverter.StringToNonStringDerivedType(first, second);
StringConverter sc = a1.getItemType().getPrimitiveItemType().getStringConverter(rules); if (a1 instanceof QualifiedNameValue) { sc = (StringConverter) sc.setNamespaceResolver(nsResolver); StringConverter sc = a0.getItemType().getPrimitiveItemType().getStringConverter(rules); if (a0 instanceof QualifiedNameValue) { sc = (StringConverter) sc.setNamespaceResolver(nsResolver);
StringConverter sc = a1.getItemType().getPrimitiveItemType().getStringConverter(rules); if (a1 instanceof QualifiedNameValue) { sc = (StringConverter) sc.setNamespaceResolver(nsResolver); StringConverter sc = a0.getItemType().getPrimitiveItemType().getStringConverter(rules); if (a0 instanceof QualifiedNameValue) { sc = (StringConverter) sc.setNamespaceResolver(nsResolver);
return new ValidationFailure("Cannot convert to an external type"); } else { BuiltInAtomicType primitiveType = (BuiltInAtomicType)targetType.getPrimitiveItemType(); ConversionResult cr = convertPrimitive(primitiveType, validate, context); if (cr instanceof ValidationFailure) {
return new ValidationFailure("Cannot convert to an external type"); } else { BuiltInAtomicType primitiveType = (BuiltInAtomicType)targetType.getPrimitiveItemType(); ConversionResult cr = convertPrimitive(primitiveType, validate, context); if (cr instanceof ValidationFailure) {
BuiltInAtomicType p0 = (BuiltInAtomicType)t0.getPrimitiveItemType(); if (p0.equals(BuiltInAtomicType.UNTYPED_ATOMIC)) { p0 = BuiltInAtomicType.STRING; BuiltInAtomicType p1 = (BuiltInAtomicType)t1.getPrimitiveItemType(); if (p1.equals(BuiltInAtomicType.UNTYPED_ATOMIC)) { p1 = BuiltInAtomicType.STRING;
BuiltInAtomicType p0 = (BuiltInAtomicType)t0.getPrimitiveItemType(); if (p0.equals(BuiltInAtomicType.UNTYPED_ATOMIC)) { p0 = BuiltInAtomicType.STRING; BuiltInAtomicType p1 = (BuiltInAtomicType)t1.getPrimitiveItemType(); if (p1.equals(BuiltInAtomicType.UNTYPED_ATOMIC)) { p1 = BuiltInAtomicType.STRING;