use of org.eclipse.wst.xml.xpath2.processor.internal.types.CtrType in project webtools.sourceediting by eclipse.
the class ConstructorFL method add_type.
/**
* Adds a type into the functions library.
*
* @param at
* input of any atomic type.
*/
public void add_type(CtrType at) {
QName name = new QName(at.type_name());
name.set_namespace(namespace());
_types.put(name, at);
add_function(new Constructor(at));
}
use of org.eclipse.wst.xml.xpath2.processor.internal.types.CtrType in project webtools.sourceediting by eclipse.
the class FsConvertOperand method convert_operand.
/**
* Convert-Operand operation.
*
* @param args
* Result from the expressions evaluation.
* @throws DynamicError
* Dynamic error.
* @return Result of fs: operation.
*/
public static ResultSequence convert_operand(Collection args) throws DynamicError {
assert args.size() == 2;
Iterator iter = args.iterator();
ResultSequence actual = (ResultSequence) iter.next();
ResultSequence expected = (ResultSequence) iter.next();
if (expected.size() != 1)
DynamicError.throw_type_error();
Item at = expected.first();
if (!(at instanceof AnyAtomicType))
DynamicError.throw_type_error();
AnyAtomicType exp_aat = (AnyAtomicType) at;
ResultBuffer result = new ResultBuffer();
// 1
if (actual.empty())
return result.getSequence();
// convert sequence
for (Iterator i = actual.iterator(); i.hasNext(); ) {
AnyType item = (AnyType) i.next();
// 2
if (item instanceof XSUntypedAtomic) {
// a
if (exp_aat instanceof XSUntypedAtomic)
result.add(new XSString(item.getStringValue()));
else // b
if (exp_aat instanceof NumericType)
result.add(new XSDouble(item.getStringValue()));
else // c
{
assert exp_aat instanceof CtrType;
CtrType cons = (CtrType) exp_aat;
result.concat(cons.constructor(new XSString(item.getStringValue())));
}
} else
// 4
result.add(item);
}
return result.getSequence();
}
Aggregations