/// <summary> /// Creates a new ResultSequence consisting of the extractable unsignedByte /// in the supplied ResultSequence /// </summary> /// <param name="arg"> /// The ResultSequence from which the unsignedByte is to be extracted </param> /// <returns> New ResultSequence consisting of the 'unsignedByte' supplied </returns> /// <exception cref="DynamicError"> </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public org.eclipse.wst.xml.xpath2.api.ResultSequence constructor(org.eclipse.wst.xml.xpath2.api.ResultSequence arg) throws org.eclipse.wst.xml.xpath2.processor.DynamicError public override ResultSequence constructor(ResultSequence arg) { if (arg.empty()) { return(ResultBuffer.EMPTY); } // the function conversion rules apply here too. Get the argument // and convert it's string value to a unsignedByte. Item aat = arg.first(); try { System.Numerics.BigInteger.TryParse(aat.StringValue, out System.Numerics.BigInteger bigInt); // doing the range checking // min value is 0 // max value is 255 System.Numerics.BigInteger min = new System.Numerics.BigInteger(0); System.Numerics.BigInteger max = new System.Numerics.BigInteger(255L); if (bigInt.CompareTo(min) < 0 || bigInt.CompareTo(max) > 0) { // invalid input throw DynamicError.cant_cast(null); } return(new XSUnsignedByte(bigInt)); } catch (System.FormatException) { throw DynamicError.cant_cast(null); } }
/// <summary> /// Creates a new ResultSequence consisting of the extractable long in the /// supplied ResultSequence /// </summary> /// <param name="arg"> /// The ResultSequence from which the long is to be extracted </param> /// <returns> New ResultSequence consisting of the 'long' supplied </returns> /// <exception cref="DynamicError"> </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public org.eclipse.wst.xml.xpath2.api.ResultSequence constructor(org.eclipse.wst.xml.xpath2.api.ResultSequence arg) throws org.eclipse.wst.xml.xpath2.processor.DynamicError public override ResultSequence constructor(ResultSequence arg) { if (arg.empty()) { return(ResultBuffer.EMPTY); } // the function conversion rules apply here too. Get the argument // and convert it's string value to a long. Item aat = arg.first(); try { System.Numerics.BigInteger.TryParse(aat.StringValue, out System.Numerics.BigInteger bigInt); // doing the range checking System.Numerics.BigInteger min = new System.Numerics.BigInteger(-9223372036854775808L); System.Numerics.BigInteger max = new System.Numerics.BigInteger(9223372036854775807L); if (bigInt.CompareTo(min) < 0 || bigInt.CompareTo(max) > 0) { // invalid input DynamicError.throw_type_error(); } return(new XSLong(bigInt)); } catch (System.FormatException) { throw DynamicError.cant_cast(null); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public org.eclipse.wst.xml.xpath2.api.ResultSequence constructor(org.eclipse.wst.xml.xpath2.api.ResultSequence arg) throws org.eclipse.wst.xml.xpath2.processor.DynamicError public override ResultSequence constructor(ResultSequence arg) { if (arg.empty()) { DynamicError.throw_type_error(); } throw new DynamicError("XPST0080", "Can't Cast to NOTATION"); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public org.eclipse.wst.xml.xpath2.api.ResultSequence constructor(org.eclipse.wst.xml.xpath2.api.ResultSequence arg) throws org.eclipse.wst.xml.xpath2.processor.DynamicError public override ResultSequence constructor(ResultSequence arg) { if (arg.empty()) { return(ResultBuffer.EMPTY); } AnyAtomicType aat = (AnyAtomicType)arg.first(); return(new XSUntypedAtomic(aat.StringValue)); }
public static ResultSequence newToOld(org.eclipse.wst.xml.xpath2.api.ResultSequence result) { if (result is ResultSequence) { return((ResultSequence)result); } ResultSequence rs = ResultSequenceFactory.create_new(); for (int i = 0; i < result.size(); ++i) { rs.add((AnyType)result.item(i)); } return(rs); }
/// <summary> /// Creation of a result sequence consisting of a URI from a previous result /// sequence. /// </summary> /// <param name="arg"> /// previous result sequence </param> /// <exception cref="DynamicError"> </exception> /// <returns> new result sequence consisting of the URI supplied </returns> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public org.eclipse.wst.xml.xpath2.api.ResultSequence constructor(org.eclipse.wst.xml.xpath2.api.ResultSequence arg) throws org.eclipse.wst.xml.xpath2.processor.DynamicError public override ResultSequence constructor(ResultSequence arg) { if (arg.empty()) { return(ResultBuffer.EMPTY); } AnyType aat = (AnyType)arg.first(); if (!(aat.string_type().Equals("xs:string") || aat.string_type().Equals(XS_ANY_URI) || aat.string_type().Equals("xs:untypedAtomic"))) { throw DynamicError.invalidType(); } return(new XSAnyURI(aat.string_value())); }
/// <summary> /// Creates a new ResultSequence consisting of the ENTITY within /// the supplied ResultSequence. The specification says that this /// is relaxed from the XML Schema requirement. The ENTITY does /// not have to be located or expanded during construction and /// evaluation for casting. /// </summary> /// <param name="arg"> /// The ResultSequence from which to extract the ENTITY </param> /// <returns> New ResultSequence consisting of the ENTITY supplied </returns> /// <exception cref="DynamicError"> </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public org.eclipse.wst.xml.xpath2.api.ResultSequence constructor(org.eclipse.wst.xml.xpath2.api.ResultSequence arg) throws org.eclipse.wst.xml.xpath2.processor.DynamicError public override ResultSequence constructor(ResultSequence arg) { if (arg.empty()) { return(ResultBuffer.EMPTY); } AnyAtomicType aat = (AnyAtomicType)arg.first(); string strValue = aat.StringValue; if (!isConstraintSatisfied(strValue)) { // invalid input DynamicError.throw_type_error(); } return(new XSEntity(strValue)); }
/// <summary> /// Creates a new ResultSequence consisting of the extractable NMTOKEN within /// the supplied ResultSequence /// </summary> /// <param name="arg"> /// The ResultSequence from which to extract the NMTOKEN </param> /// <returns> New ResultSequence consisting of the NMTOKEN supplied </returns> /// <exception cref="DynamicError"> </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public org.eclipse.wst.xml.xpath2.api.ResultSequence constructor(org.eclipse.wst.xml.xpath2.api.ResultSequence arg) throws org.eclipse.wst.xml.xpath2.processor.DynamicError public override ResultSequence constructor(ResultSequence arg) { if (arg.empty()) { return(ResultBuffer.EMPTY); } AnyAtomicType aat = (AnyAtomicType)arg.first(); string strValue = aat.StringValue; if (!XMLChar.isValidNmtoken(strValue)) { // invalid input DynamicError.throw_type_error(); } return(new XSNMTOKEN(strValue)); }
public CollectionAnonymousInnerClass(ResultBuffer outerInstance, org.eclipse.wst.xml.xpath2.api.ResultSequence rs) { this.outerInstance = outerInstance; this.rs = rs; }
// convert argument according to section 3.1.5 of xpath 2.0 spec /// <summary> /// Convert the input argument according to section 3.1.5 of specification. /// </summary> /// <param name="arg"> /// input argument. </param> /// <param name="expected"> /// Expected Sequence type. </param> /// <exception cref="DynamicError"> /// Dynamic error. </exception> /// <returns> Converted argument. </returns> public static org.eclipse.wst.xml.xpath2.api.ResultSequence convert_argument(org.eclipse.wst.xml.xpath2.api.ResultSequence arg, SeqType expected) { ResultBuffer result = new ResultBuffer(); // XXX: Should use type_class instead and use item.getClass().isAssignableTo(expected.type_class()) AnyType expected_type = expected.type(); // expected is atomic if (expected_type is AnyAtomicType) { AnyAtomicType expected_aat = (AnyAtomicType)expected_type; // atomize org.eclipse.wst.xml.xpath2.api.ResultSequence rs = FnData.atomize(arg); // cast untyped to expected type for (var i = rs.iterator(); i.MoveNext();) { AnyType item = (AnyType)i.Current; if (item is XSUntypedAtomic) { // create a new item of the expected // type initialized with from the string // value of the item ResultSequence converted = null; if (expected_aat is XSString) { XSString strType = new XSString(item.StringValue); converted = ResultSequenceFactory.create_new(strType); } else { converted = ResultSequenceFactory.create_new(item); } result.concat(converted); } // xs:anyURI promotion to xs:string else if (item is XSAnyURI && expected_aat is XSString) { result.add(new XSString(item.StringValue)); } // numeric type promotion else if (item is NumericType) { if (expected_aat is XSDouble) { XSDouble doubleType = new XSDouble(item.StringValue); result.add(doubleType); } else { result.add(item); } } else { result.add(item); } } // do sequence type matching on converted arguments return(expected.match(result.Sequence)); } else { // do sequence type matching on converted arguments return(expected.match(arg)); } }
// used for constructor functions // arg is either empty sequence, or 1 anyatomictype /// <summary> /// Used for constructor function. /// </summary> /// <param name="arg"> /// Either an empty sequence or 1 atomic type </param> /// <returns> The resulting ResultSequence </returns> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public abstract org.eclipse.wst.xml.xpath2.api.ResultSequence constructor(org.eclipse.wst.xml.xpath2.api.ResultSequence arg) throws org.eclipse.wst.xml.xpath2.processor.DynamicError; public abstract ResultSequence constructor(ResultSequence arg);
private ResultSequence _rs; // all items in context /// <summary> /// Sets the _rs to rs and context position to 1. /// </summary> /// <param name="rs"> /// is a ResultSequence and is set to _rs. </param> public Focus(ResultSequence rs) { _rs = rs; _cp = 1; }