// XXX IN GENRAL, I THIUNK WE NEED TO PULL SANITY CHECKING OUTSIDE! // PLUS I AM NOT ATOMIZING/ETC ETC HERE!!! BAD CODE // BUG XXX HACK DEATH /// <summary> /// Evaluate arguments. /// </summary> /// <param name="args"> /// argument expressions. </param> /// <exception cref="DynamicError"> /// Dynamic error. </exception> /// <returns> Result of evaluation. </returns> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public org.eclipse.wst.xml.xpath2.api.ResultSequence evaluate(java.util.Collection args, org.eclipse.wst.xml.xpath2.api.EvaluationContext ec) throws org.eclipse.wst.xml.xpath2.processor.DynamicError public override ResultSequence evaluate(ICollection args, EvaluationContext ec) { Debug.Assert(args.Count >= min_arity() && args.Count <= max_arity()); var i = args.GetEnumerator(); i.MoveNext(); // sanity checks ResultSequence arg = (ResultSequence)i.Current; if (arg == null || arg.size() > 1) { DynamicError.throw_type_error(); } // do it return(_atomic_type.constructor(arg)); }
/// <summary> /// Convert-Operand operation. /// </summary> /// <param name="args"> /// Result from the expressions evaluation. </param> /// <exception cref="DynamicError"> /// Dynamic error. </exception> /// <returns> Result of fs: operation. </returns> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public static org.eclipse.wst.xml.xpath2.api.ResultSequence convert_operand(java.util.Collection args) throws org.eclipse.wst.xml.xpath2.processor.DynamicError public static ResultSequence convert_operand(ICollection args) { Debug.Assert(args.Count == 2); IEnumerator iter = args.GetEnumerator(); iter.MoveNext(); ResultSequence actual = (ResultSequence)iter.Current; iter.MoveNext(); ResultSequence expected = (ResultSequence)iter.Current; if (expected == null || expected.size() != 1) { DynamicError.throw_type_error(); } Item at = expected.first(); if (!(at is AnyAtomicType)) { DynamicError.throw_type_error(); } AnyAtomicType exp_aat = (AnyAtomicType)at; ResultBuffer result = new ResultBuffer(); // 1 if (actual.empty()) { return(result.Sequence); } // convert sequence for (var i = actual.iterator(); i.MoveNext();) { AnyType item = (AnyType)i.Current; // 2 if (item is XSUntypedAtomic) { // a if (exp_aat is XSUntypedAtomic) { result.add(new XSString(item.StringValue)); } // b else if (exp_aat is NumericType) { result.add(new XSDouble(item.StringValue)); } // c else { Debug.Assert(exp_aat is CtrType); CtrType cons = (CtrType)exp_aat; result.concat(cons.constructor(new XSString(item.StringValue))); } } // 4 else { result.add(item); } } return(result.Sequence); }