Search in sources :

Example 51 with XSString

use of org.eclipse.wst.xml.xpath2.processor.internal.types.XSString in project webtools.sourceediting by eclipse.

the class FnLowerCase method expected_args.

/**
 * Calculate the expected arguments.
 *
 * @return The expected arguments.
 */
public static synchronized Collection expected_args() {
    if (_expected_args == null) {
        _expected_args = new ArrayList();
        _expected_args.add(new SeqType(new XSString(), SeqType.OCC_QMARK));
    }
    return _expected_args;
}
Also used : SeqType(org.eclipse.wst.xml.xpath2.processor.internal.SeqType) ArrayList(java.util.ArrayList) XSString(org.eclipse.wst.xml.xpath2.processor.internal.types.XSString)

Example 52 with XSString

use of org.eclipse.wst.xml.xpath2.processor.internal.types.XSString in project webtools.sourceediting by eclipse.

the class FnLowerCase method lower_case.

/**
 * Convert arguments to lower case.
 *
 * @param args
 *            are converted to lower case.
 * @throws DynamicError
 *             Dynamic error.
 * @return The result of converting the arguments to lower case.
 */
public static ResultSequence lower_case(Collection args) throws DynamicError {
    Collection cargs = Function.convert_arguments(args, expected_args());
    ResultSequence arg1 = (ResultSequence) cargs.iterator().next();
    if (arg1.empty()) {
        return new XSString("");
    }
    String str = ((XSString) arg1.first()).value();
    return new XSString(str.toLowerCase());
}
Also used : ResultSequence(org.eclipse.wst.xml.xpath2.api.ResultSequence) Collection(java.util.Collection) XSString(org.eclipse.wst.xml.xpath2.processor.internal.types.XSString) XSString(org.eclipse.wst.xml.xpath2.processor.internal.types.XSString)

Example 53 with XSString

use of org.eclipse.wst.xml.xpath2.processor.internal.types.XSString in project webtools.sourceediting by eclipse.

the class FnMatches method expected_args.

/**
 * Obtain a list of expected arguments.
 *
 * @return Result of operation.
 */
public static synchronized Collection expected_args() {
    if (_expected_args == null) {
        _expected_args = new ArrayList();
        SeqType arg = new SeqType(new XSString(), SeqType.OCC_QMARK);
        _expected_args.add(arg);
        _expected_args.add(new SeqType(new XSString(), SeqType.OCC_NONE));
        _expected_args.add(new SeqType(new XSString(), SeqType.OCC_NONE));
    }
    return _expected_args;
}
Also used : SeqType(org.eclipse.wst.xml.xpath2.processor.internal.SeqType) ArrayList(java.util.ArrayList) XSString(org.eclipse.wst.xml.xpath2.processor.internal.types.XSString)

Example 54 with XSString

use of org.eclipse.wst.xml.xpath2.processor.internal.types.XSString in project webtools.sourceediting by eclipse.

the class FnNormalizeSpace method normalize_space.

/**
 * Normalize space in the arguments.
 *
 * @param args
 *            are used to obtain space from, in order to be normalized.
 * @throws DynamicError
 *             Dynamic error.
 * @return The result of normalizing the space in the arguments.
 */
public static ResultSequence normalize_space(Collection args, EvaluationContext ec) throws DynamicError {
    Collection cargs = Function.convert_arguments(args, expected_args());
    ResultSequence arg1 = null;
    if (cargs.isEmpty()) {
        // support for arity = 0
        arg1 = getResultSetForArityZero(ec);
    } else {
        arg1 = (ResultSequence) cargs.iterator().next();
    }
    String str = "";
    if (!arg1.empty()) {
        str = ((XSString) arg1.first()).value();
    }
    return new XSString(normalize(str));
}
Also used : ResultSequence(org.eclipse.wst.xml.xpath2.api.ResultSequence) Collection(java.util.Collection) XSString(org.eclipse.wst.xml.xpath2.processor.internal.types.XSString) XSString(org.eclipse.wst.xml.xpath2.processor.internal.types.XSString)

Example 55 with XSString

use of org.eclipse.wst.xml.xpath2.processor.internal.types.XSString in project webtools.sourceediting by eclipse.

the class FnStringJoin method expected_args.

/**
 * Calculate the expected arguments.
 *
 * @return The expected arguments.
 */
public static synchronized Collection expected_args() {
    if (_expected_args == null) {
        _expected_args = new ArrayList();
        _expected_args.add(new SeqType(new XSString(), SeqType.OCC_STAR));
        _expected_args.add(new SeqType(new XSString(), SeqType.OCC_NONE));
    }
    return _expected_args;
}
Also used : SeqType(org.eclipse.wst.xml.xpath2.processor.internal.SeqType) ArrayList(java.util.ArrayList) XSString(org.eclipse.wst.xml.xpath2.processor.internal.types.XSString)

Aggregations

XSString (org.eclipse.wst.xml.xpath2.processor.internal.types.XSString)73 ResultSequence (org.eclipse.wst.xml.xpath2.api.ResultSequence)37 ArrayList (java.util.ArrayList)32 Collection (java.util.Collection)32 Iterator (java.util.Iterator)29 SeqType (org.eclipse.wst.xml.xpath2.processor.internal.SeqType)29 ResultBuffer (org.eclipse.wst.xml.xpath2.api.ResultBuffer)9 Item (org.eclipse.wst.xml.xpath2.api.Item)7 QName (org.eclipse.wst.xml.xpath2.processor.internal.types.QName)7 AnyType (org.eclipse.wst.xml.xpath2.processor.internal.types.AnyType)6 XSInteger (org.eclipse.wst.xml.xpath2.processor.internal.types.XSInteger)6 ResultSequence (org.eclipse.wst.xml.xpath2.processor.ResultSequence)5 AnyAtomicType (org.eclipse.wst.xml.xpath2.processor.internal.types.AnyAtomicType)5 NumericType (org.eclipse.wst.xml.xpath2.processor.internal.types.NumericType)5 XSBoolean (org.eclipse.wst.xml.xpath2.processor.internal.types.XSBoolean)5 XSDouble (org.eclipse.wst.xml.xpath2.processor.internal.types.XSDouble)5 DynamicError (org.eclipse.wst.xml.xpath2.processor.DynamicError)4 XSUntypedAtomic (org.eclipse.wst.xml.xpath2.processor.internal.types.XSUntypedAtomic)4 URL (java.net.URL)3 PatternSyntaxException (java.util.regex.PatternSyntaxException)3