/// <summary> /// Equality comparison between this and the supplied representation which /// must be of type hexBinary /// </summary> /// <param name="arg"> /// The representation to compare with </param> /// <returns> True if the two representation are same. False otherwise. /// </returns> /// <exception cref="DynamicError"> </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public boolean eq(AnyType arg, org.eclipse.wst.xml.xpath2.api.DynamicContext dynamicContext) throws org.eclipse.wst.xml.xpath2.processor.DynamicError public virtual bool eq(AnyType arg, DynamicContext dynamicContext) { throw new Exception(); //string valToCompare = arg.StringValue; // sbyte[] value1 = HexBin.decode(_value); // sbyte[] value2 = HexBin.decode(valToCompare); // if (value2 == null) // { //return false; // } // int len = value1.Length; // if (len != value2.Length) // { //return false; // } // for (int i = 0; i < len; i++) // { //if (value1[i] != value2[i]) //{ // return false; //} // } // return true; }
} // getXDMTypedValue /* * Get the XDM typed value for schema "simple content model". */ private ResultSequence getTypedValueForSimpleContent(SimpleTypeDefinition simpType, IList itemValueTypes) { ResultBuffer rs = new ResultBuffer(); if (simpType.Variety == org.eclipse.wst.xml.xpath2.api.typesystem.SimpleTypeDefinition_Fields.VARIETY_ATOMIC) { AnyType schemaTypeValue = SchemaTypeValueFactory.newSchemaTypeValue(PsychoPathTypeHelper.getXSDTypeShortCode(simpType), StringValue); if (schemaTypeValue != null) { return(schemaTypeValue); } else { return(new XSUntypedAtomic(StringValue)); } } else if (simpType.Variety == org.eclipse.wst.xml.xpath2.api.typesystem.SimpleTypeDefinition_Fields.VARIETY_LIST) { addAtomicListItemsToResultSet(simpType, itemValueTypes, rs); } else if (simpType.Variety == org.eclipse.wst.xml.xpath2.api.typesystem.SimpleTypeDefinition_Fields.VARIETY_UNION) { getTypedValueForVarietyUnion(simpType, rs); } return(rs.Sequence); } // getTypedValueForSimpleContent
/// <summary> /// Comparison between this number and the supplied representation. /// </summary> /// <param name="arg"> /// The datatype to compare with </param> /// <returns> True if the supplied representation is a greater number than the /// one stored. False otherwise </returns> /// <exception cref="DynamicError"> </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public boolean lt(AnyType arg, org.eclipse.wst.xml.xpath2.api.DynamicContext context) throws org.eclipse.wst.xml.xpath2.processor.DynamicError public override bool lt(AnyType arg, DynamicContext context) { Item carg = convertArg(arg); XSFloat val = (XSFloat)get_single_type(carg, typeof(XSFloat)); return(float_value() < val.float_value()); }
/// <summary> /// Comparison between this number and the supplied representation. /// </summary> /// <param name="arg"> /// Representation to be compared with (must currently be of type /// XSDecimal) </param> /// <returns> True if the supplied type represents a number greater than this /// one stored. False otherwise </returns> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public boolean lt(AnyType arg, org.eclipse.wst.xml.xpath2.api.DynamicContext context) throws org.eclipse.wst.xml.xpath2.processor.DynamicError public override bool lt(AnyType arg, DynamicContext context) { Item carg = convertArg(arg); XSDecimal val = (XSDecimal)get_single_type(carg, typeof(XSDecimal)); return(_value.CompareTo(val.Value) == -1); }
/// <summary> /// Comparison between this and the supplied representation which must be of /// type String /// </summary> /// <param name="arg"> /// The representation to compare with </param> /// <returns> True if this String is lexographically less than that supplied. /// False otherwise </returns> /// <exception cref="DynamicError"> </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public boolean lt(AnyType arg, org.eclipse.wst.xml.xpath2.api.DynamicContext context) throws org.eclipse.wst.xml.xpath2.processor.DynamicError public virtual bool lt(AnyType arg, DynamicContext context) { int cmp = do_compare(arg, context); Debug.Assert(cmp != 666); return(cmp < 0); }
/// <summary> /// Comparison between this number and the supplied representation. Currently /// no numeric type promotion exists so the supplied representation must be /// of type XSDouble. /// </summary> /// <param name="arg"> /// Representation to be compared with (must currently be of type /// XSDouble) </param> /// <returns> True if the supplied type represents a number greater than this /// one stored. False otherwise </returns> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public boolean lt(AnyType arg, org.eclipse.wst.xml.xpath2.api.DynamicContext context) throws org.eclipse.wst.xml.xpath2.processor.DynamicError public override bool lt(AnyType arg, DynamicContext context) { Item carg = convertArg(arg); XSDouble val = (XSDouble)get_single_type(carg, typeof(XSDouble)); return(double_value() < val.double_value()); }
/// <summary> /// Equality comparison between this and the supplied representation. This /// representation must be of type XSGDay /// </summary> /// <param name="arg"> /// The XSGDay to compare with </param> /// <returns> True if the two representations are of the same day. False /// otherwise </returns> /// <exception cref="DynamicError"> </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public boolean eq(AnyType arg, org.eclipse.wst.xml.xpath2.api.DynamicContext dynamicContext) throws org.eclipse.wst.xml.xpath2.processor.DynamicError public virtual bool eq(AnyType arg, DynamicContext dynamicContext) { XSGDay val = (XSGDay)NumericType.get_single_type(arg, typeof(XSGDay)); Calendar thiscal = normalizeCalendar(calendar(), tz()); Calendar thatcal = normalizeCalendar(val.calendar(), val.tz()); return(thiscal.Equals(thatcal)); }
/// <summary> /// Comparison between this and the supplied XSTime representation /// </summary> /// <param name="arg"> /// The XSTime to compare with </param> /// <returns> True if the supplied time represnts a point in time before that /// represented by the time stored. False otherwise </returns> /// <exception cref="DynamicError"> </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public boolean gt(AnyType arg, org.eclipse.wst.xml.xpath2.api.DynamicContext context) throws org.eclipse.wst.xml.xpath2.processor.DynamicError public virtual bool gt(AnyType arg, DynamicContext context) { XSTime val = (XSTime)NumericType.get_single_type(arg, typeof(XSTime)); Calendar thiscal = normalizeCalendar(calendar(), tz()); Calendar thatcal = normalizeCalendar(val.calendar(), val.tz()); return(thiscal.IsGreaterThan(thatcal)); }
/// <summary> /// Comparison on this and the supplied dates (taking timezones into account) /// </summary> /// <param name="arg"> /// XSDate representation of the date to compare to </param> /// <exception cref="DynamicError"> </exception> /// <returns> True if in time, this date lies after the date supplied. False /// otherwise. </returns> public virtual bool gt(AnyType arg, DynamicContext context) { XSDate val = (XSDate)NumericType.get_single_type((Item)arg, typeof(XSDate)); Calendar thiscal = normalizeCalendar(calendar(), tz()); Calendar thatcal = normalizeCalendar(val.calendar(), val.tz()); return(thiscal.CompareTo(thatcal) > 0); }
/* * (non-Javadoc) * @see org.eclipse.wst.xml.xpath2.processor.internal.types.XSDecimal#lt(org.eclipse.wst.xml.xpath2.processor.internal.types.AnyType) */ //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public boolean lt(AnyType arg, org.eclipse.wst.xml.xpath2.api.DynamicContext context) throws org.eclipse.wst.xml.xpath2.processor.DynamicError public override bool lt(AnyType arg, DynamicContext context) { Item carg = convertArg(arg); XSInteger val = (XSInteger)get_single_type(carg, typeof(XSInteger)); int compareResult = int_value().CompareTo(val.int_value()); return(compareResult < 0); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: protected org.eclipse.wst.xml.xpath2.api.Item convertArg(AnyType arg) throws org.eclipse.wst.xml.xpath2.processor.DynamicError protected internal virtual Item convertArg(AnyType arg) { ResultSequence rs = ResultSequenceFactory.create_new(arg); rs = constructor(rs); Item carg = rs.first(); return(carg); }
/// <summary> /// Creates a new ResultSequence consisting of the retrievable float in the /// supplied ResultSequence /// </summary> /// <param name="arg"> /// The ResultSequence from which to extract the float </param> /// <returns> New ResultSequence consisting of the float 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); } AnyType aat = (AnyType)arg.first(); if (aat is XSDuration || aat is CalendarType || aat is XSBase64Binary || aat is XSHexBinary || aat is XSAnyURI) { throw DynamicError.invalidType(); } if (!(aat.string_type().Equals("xs:string") || aat is NodeType || aat.string_type().Equals("xs:untypedAtomic") || aat.string_type().Equals("xs:boolean") || aat is NumericType)) { throw DynamicError.cant_cast(null); } try { float f; if (aat.StringValue.Equals("INF")) { f = float.PositiveInfinity; } else if (aat.StringValue.Equals("-INF")) { f = float.NegativeInfinity; } else if (aat is XSBoolean) { if (aat.StringValue.Equals("true")) { f = 1.0f; } else { f = 0.0f; } } else { f = Convert.ToSingle(aat.StringValue); } return(new XSFloat(f)); } catch (System.FormatException) { throw DynamicError.cant_cast(null); } }
/// <summary> /// Comparison between the supplied and this boolean representation. Returns /// true if this XSBoolean represents false and that XSBoolean supplied /// represents true. Returns false otherwise /// </summary> /// <param name="arg"> /// The XSBoolean representation of the boolean value to compare /// with. </param> /// <exception cref="DynamicError"> </exception> /// <returns> New XSBoolean representation of true/false result of the /// comparison </returns> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public boolean lt(AnyType arg, org.eclipse.wst.xml.xpath2.api.DynamicContext context) throws org.eclipse.wst.xml.xpath2.processor.DynamicError public virtual bool lt(AnyType arg, DynamicContext context) { XSBoolean barg = (XSBoolean)NumericType.get_single_type((Item)arg, typeof(XSBoolean)); bool result = false; if (!value() && barg.value()) { result = true; } return(result); }
/// <summary> /// Equality comparison between this and the supplied representation which /// must be of type String /// </summary> /// <param name="arg"> /// The representation to compare with </param> /// <returns> True if the two representation are of the same String. False /// otherwise </returns> /// <exception cref="DynamicError"> </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public boolean eq(AnyType arg, org.eclipse.wst.xml.xpath2.api.DynamicContext dynamicContext) throws org.eclipse.wst.xml.xpath2.processor.DynamicError public virtual bool eq(AnyType arg, DynamicContext dynamicContext) { int cmp = do_compare(arg, dynamicContext); // XXX im not sure what to do here!!! because eq has to return // something i fink.... if (cmp == 666) { Debug.Assert(false); } return(cmp == 0); }
// comparisons // 666 indicates death [compare returned empty seq] //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: private int do_compare(AnyType arg, org.eclipse.wst.xml.xpath2.api.DynamicContext dc) throws org.eclipse.wst.xml.xpath2.processor.DynamicError private int do_compare(AnyType arg, DynamicContext dc) { // XXX: This can't happen, I guess if (arg == null) { return(666); } XSString comparand = arg is XSString ? (XSString)arg : new XSString(arg.StringValue); System.Numerics.BigInteger result = FnCompare.compare_string(dc.CollationProvider.DefaultCollation, this, comparand, dc); return((int)result); }
protected internal virtual bool isGDataType(AnyType aat) { if (!(aat is AnyAtomicType)) { return(false); } string type = aat.string_type(); if (type.Equals("xs:gMonthDay") || type.Equals("xs:gDay") || type.Equals("xs:gMonth") || type.Equals("xs:gYear") || type.Equals("xs:gYearMonth")) { return(true); } return(false); }
/// <summary> /// Equality comparison between this and the supplied representation which /// must be of type xs:anyURI (or, by promotion of this, xs:string) /// </summary> /// <param name="arg"> /// The representation to compare with </param> /// <returns> True if the two representation are of the same String. False /// otherwise </returns> /// <exception cref="DynamicError"> </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public boolean eq(AnyType arg, org.eclipse.wst.xml.xpath2.api.DynamicContext dynamicContext) throws org.eclipse.wst.xml.xpath2.processor.DynamicError public virtual bool eq(AnyType arg, DynamicContext dynamicContext) { if (arg is XSAnyURI || arg is XSString) { if (this.string_value().Equals(arg.string_value())) { return(true); } } else { throw DynamicError.throw_type_error(); } return(false); }
private ResultSequence minusXSYearMonthDuration(AnyType at) { XSYearMonthDuration val = (XSYearMonthDuration)at; try { XSDate res = (XSDate)clone(); res.calendar().add(Calendar.MONTH, val.monthValue() * -1); return(ResultSequenceFactory.create_new(res)); } catch { } return(null); }
/// <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())); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: private org.eclipse.wst.xml.xpath2.api.ResultSequence convertResultSequence(org.eclipse.wst.xml.xpath2.api.ResultSequence arg) throws org.eclipse.wst.xml.xpath2.processor.DynamicError private ResultSequence convertResultSequence(ResultSequence arg) { ResultSequence carg = arg; var it = carg.iterator(); while (it.MoveNext()) { AnyType type = (AnyType)it.Current; if (type.string_type().Equals("xs:untypedAtomic") || type.string_type().Equals("xs:string")) { throw DynamicError.invalidType(); } } carg = constructor(carg); return(carg); }
/// <summary> /// Equality comparison between this and the supplied duration of time. /// </summary> /// <param name="arg"> /// The duration of time to compare with </param> /// <returns> True if they both represent the duration of time. False otherwise </returns> /// <exception cref="DynamicError"> </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public boolean eq(AnyType arg, org.eclipse.wst.xml.xpath2.api.DynamicContext dynamicContext) throws org.eclipse.wst.xml.xpath2.processor.DynamicError public override bool eq(AnyType arg, DynamicContext dynamicContext) { if (arg is XSDayTimeDuration) { XSDayTimeDuration dayTimeDuration = (XSDayTimeDuration)arg; return(monthValue() == 0 && dayTimeDuration.value() == 0.0); } else if (arg is XSYearMonthDuration) { XSYearMonthDuration yearMonthDuration = (XSYearMonthDuration)arg; return(monthValue() == yearMonthDuration.monthValue()); } XSDuration val = (XSDuration)NumericType.get_single_type(arg, typeof(XSDuration)); return(base.eq(val, dynamicContext)); }
/// <summary> /// Less than comparison between this and the supplied representation which /// must be of type xs:anyURI (or, by promotion of this, xs:string) /// /// @since 1.1 /// </summary> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public boolean lt(AnyType arg, org.eclipse.wst.xml.xpath2.api.DynamicContext context) throws org.eclipse.wst.xml.xpath2.processor.DynamicError public virtual bool lt(AnyType arg, DynamicContext context) { if (!(arg is XSAnyURI || arg is XSString)) { throw DynamicError.throw_type_error(); } string anyURI = this.string_value(); string compareToURI = arg.string_value(); if (anyURI.CompareTo(compareToURI) < 0) { return(true); } return(false); }
private ResultSequence minusXSDayTimeDuration(AnyType at) { XSDuration val = (XSDuration)at; try { XSDate res = (XSDate)clone(); XMLGregorianCalendar xmlCal = _datatypeFactory .newXMLGregorianCalendar( (GregorianCalendar)calendar()); Duration dtduration = _datatypeFactory.newDuration(val.StringValue); xmlCal.add(dtduration.negate()); res = new XSDate(xmlCal.toGregorianCalendar(), res.tz()); return(ResultSequenceFactory.create_new(res)); } catch { } return(null); }
/// <summary> /// Equality comparison between this number and the supplied representation. </summary> /// <param name="aa"> /// The datatype to compare with /// </param> /// <returns> True if the two representations are of the same number. False /// otherwise </returns> /// <exception cref="DynamicError"> </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public boolean eq(AnyType aa, org.eclipse.wst.xml.xpath2.api.DynamicContext dynamicContext) throws org.eclipse.wst.xml.xpath2.processor.DynamicError public override bool eq(AnyType aa, DynamicContext dynamicContext) { Item carg = convertArg(aa); if (!(carg is XSFloat)) { DynamicError.throw_type_error(); } XSFloat f = (XSFloat)carg; if (nan() && f.nan()) { return(false); } float?thatvalue = new float?(f.float_value()); float?thisvalue = new float?(float_value()); return(thisvalue.Equals(thatvalue)); }
/// <summary> /// Equality comparison between this number and the supplied representation. </summary> /// <param name="aa"> /// Representation to be compared with (must currently be of type /// XSDouble) /// </param> /// <returns> True if the 2 representations represent the same number. False /// otherwise /// @since 1.1 </returns> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public boolean eq(AnyType aa, org.eclipse.wst.xml.xpath2.api.DynamicContext dynamicContext) throws org.eclipse.wst.xml.xpath2.processor.DynamicError public override bool eq(AnyType aa, DynamicContext dynamicContext) { ResultSequence rs = ResultSequenceFactory.create_new(aa); ResultSequence crs = constructor(rs); if (crs.empty()) { throw DynamicError.throw_type_error(); } Item cat = crs.first(); XSDouble d = (XSDouble)cat; if (d.nan() && nan()) { return(false); } double?thatvalue = new double?(d.double_value()); double?thisvalue = new double?(double_value()); return(thisvalue.Equals(thatvalue)); }
// comparisons /// <summary> /// Equality comparison between this number and the supplied representation. </summary> /// <param name="at"> /// Representation to be compared with (must currently be of type /// XSDecimal) /// /// </param> /// <returns> True if the 2 representation represent the same number. False /// otherwise </returns> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public boolean eq(AnyType at, org.eclipse.wst.xml.xpath2.api.DynamicContext dynamicContext) throws org.eclipse.wst.xml.xpath2.processor.DynamicError public override bool eq(AnyType at, DynamicContext dynamicContext) { XSDecimal dt = null; if (!(at is XSDecimal)) { ResultSequence rs = ResultSequenceFactory.create_new(at); ResultSequence crs = constructor(rs); if (crs.empty()) { throw DynamicError.throw_type_error(); } Item cat = crs.first(); dt = (XSDecimal)cat; } else { dt = (XSDecimal)at; } return(_value.CompareTo(dt.Value) == 0); }
/// <summary> /// Equality comparison between this and the supplied representation. This /// representation must be of type XSGMonthDay /// </summary> /// <param name="arg"> /// The XSGMonthDay to compare with </param> /// <returns> True if the two representations are of the same month and day. /// False otherwise </returns> /// <exception cref="DynamicError"> </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public boolean eq(AnyType arg, org.eclipse.wst.xml.xpath2.api.DynamicContext dynamicContext) throws org.eclipse.wst.xml.xpath2.processor.DynamicError public virtual bool eq(AnyType arg, DynamicContext dynamicContext) { XSGMonthDay val = (XSGMonthDay)NumericType.get_single_type(arg, typeof(XSGMonthDay)); return(calendar().Equals(val.calendar())); }
/// <summary> /// Equality comparison between this and the supplied duration of time. /// </summary> /// <param name="arg"> /// The duration of time to compare with </param> /// <returns> True if they both represent the duration of time. False otherwise </returns> /// <exception cref="DynamicError"> </exception> public virtual bool eq(AnyType arg, DynamicContext dynamicContext) { XSDuration val = (XSDuration)NumericType.get_single_type(arg, typeof(XSDuration)); return(value() == val.value()); }
/// <summary> /// Comparison between this and the supplied duration of time. /// </summary> /// <param name="arg"> /// The duration of time to compare with </param> /// <returns> True if the supplied time represents a smaller duration than that /// stored. False otherwise </returns> /// <exception cref="DynamicError"> </exception> public virtual bool gt(AnyType arg, DynamicContext context) { XSDuration val = (XSDuration)NumericType.get_single_type(arg, typeof(XSDayTimeDuration)); return(value() > val.value()); }
/// <summary> /// Equality comparison between this QName and the supplied QName /// </summary> /// <param name="arg"> /// The QName to compare with </param> /// <returns> True if the two represent the same node. False otherwise </returns> /// <exception cref="DynamicError"> </exception> public virtual bool eq(AnyType arg, DynamicContext dynamicContext) { QName val = (QName)NumericType.get_single_type(arg, typeof(QName)); return(Equals(val)); }