//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: protected static boolean hasValue(org.eclipse.wst.xml.xpath2.api.ResultBuffer rs, org.eclipse.wst.xml.xpath2.processor.internal.types.AnyAtomicType item, org.eclipse.wst.xml.xpath2.api.DynamicContext context, String collationURI) throws org.eclipse.wst.xml.xpath2.processor.DynamicError protected internal static bool hasValue(ResultBuffer rs, AnyAtomicType item, DynamicContext context, string collationURI) { XSString itemStr = new XSString(item.StringValue); for (IEnumerator i = rs.iterator(); i.MoveNext();) { AnyType at = (AnyType)i.Current; if (!(at is CmpEq)) { continue; } if (isBoolean(item, at)) { XSBoolean boolat = (XSBoolean)at; if (boolat.eq(item, context)) { return(true); } } if (isNumeric(item, at)) { NumericType numericat = (NumericType)at; if (numericat.eq(item, context)) { return(true); } } if (isDuration(item, at)) { XSDuration durat = (XSDuration)at; if (durat.eq(item, context)) { return(true); } } if (needsStringComparison(item, at)) { XSString xstr1 = new XSString(at.StringValue); if (FnCompare.compare_string(collationURI, xstr1, itemStr, context).Equals(System.Numerics.BigInteger.Zero)) { return(true); } } } return(false); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: protected static boolean hasValue(org.eclipse.wst.xml.xpath2.processor.internal.types.AnyType itema, org.eclipse.wst.xml.xpath2.processor.internal.types.AnyType itemb, org.eclipse.wst.xml.xpath2.api.DynamicContext context, String collationURI) throws org.eclipse.wst.xml.xpath2.processor.DynamicError protected internal static bool hasValue(AnyType itema, AnyType itemb, DynamicContext context, string collationURI) { XSString itemStr = new XSString(itema.StringValue); if (isBoolean(itema, itemb)) { XSBoolean boolat = (XSBoolean)itema; if (boolat.eq(itemb, context)) { return(true); } } if (isNumeric(itema, itemb)) { NumericType numericat = (NumericType)itema; if (numericat.eq(itemb, context)) { return(true); } } if (isDuration(itema, itemb)) { XSDuration durat = (XSDuration)itema; if (durat.eq(itemb, context)) { return(true); } } if (needsStringComparison(itema, itemb)) { XSString xstr1 = new XSString(itema.StringValue); if (FnCompare.compare_string(collationURI, xstr1, itemStr, context).Equals(System.Numerics.BigInteger.Zero)) { return(true); } } return(false); }
/// <summary> /// Index-Of operation. /// </summary> /// <param name="args"> /// Result from the expressions evaluation. </param> /// <param name="dynamicContext"> </param> /// <exception cref="DynamicError"> /// Dynamic error. </exception> /// <returns> Result of fn:index-of operation. </returns> public static ResultSequence index_of(ICollection args, DynamicContext dc) { Function.convert_arguments(args, expected_args()); // get args IEnumerator citer = args.GetEnumerator(); citer.MoveNext(); ResultSequence arg1 = (ResultSequence)citer.Current; citer.MoveNext(); ResultSequence arg2 = (ResultSequence)citer.Current; if (arg1 == null || arg1.empty()) { return(ResultBuffer.EMPTY); } // sanity chex if (arg2 == null || arg2.size() != 1) { DynamicError.throw_type_error(); } string collationUri = dc.CollationProvider.DefaultCollation; if (citer.MoveNext()) { ResultSequence arg3 = (ResultSequence)citer.Current; if (!arg3.empty()) { XSString collation = (XSString)arg3.first(); collationUri = collation.StringValue; } } ResultBuffer rb = new ResultBuffer(); AnyAtomicType at = (AnyAtomicType)arg2.first(); get_comparable(at); int index = 1; for (var i = arg1.iterator(); i.MoveNext();) { AnyType cmptype = (AnyType)i.Current; get_comparable(cmptype); if (!(at is CmpEq)) { continue; } if (isBoolean(cmptype, at)) { XSBoolean boolat = (XSBoolean)cmptype; if (boolat.eq(at, dc)) { rb.add(new XSInteger(new System.Numerics.BigInteger(index))); } } else { if (isNumeric(cmptype, at)) { NumericType numericat = (NumericType)at; if (numericat.eq(cmptype, dc)) { rb.add(new XSInteger(new System.Numerics.BigInteger(index))); } } else { if (isDuration(cmptype, at)) { XSDuration durat = (XSDuration)at; if (durat.eq(cmptype, dc)) { rb.add(new XSInteger(new System.Numerics.BigInteger(index))); } } else { if (at is QName && cmptype is QName) { QName qname = (QName)at; if (qname.eq(cmptype, dc)) { rb.add(new XSInteger(new System.Numerics.BigInteger(index))); } } else { if (needsStringComparison(cmptype, at)) { XSString xstr1 = new XSString(cmptype.StringValue); XSString itemStr = new XSString(at.StringValue); if (FnCompare.compare_string(collationUri, xstr1, itemStr, dc).Equals(System.Numerics.BigInteger.Zero)) { rb.add(new XSInteger(new System.Numerics.BigInteger(index))); } } } } } } index++; } return(rb.Sequence); }