public override int CompareTo(object obj) { ONNat lVal = obj as ONNat; if (lVal == null) { return(1); } if (Value == null && lVal.Value == null) { return(0); } if (Value == null) { return(-1); } if (lVal.Value == null) { return(1); } return(TypedValue.CompareTo(lVal.TypedValue)); }
/// <summary> /// Constructor /// </summary> /// <param name="val">Value for this type</param> public ONNat(ONNat val) { if (val == null) Value = null; else Value = val.Value; }
public static ONReal Exp(ONNat obj1) { if (((object)obj1 == null) || (obj1.Value == null)) { throw new ONNullException(null); } return(new ONReal(Convert.ToDecimal(Math.Exp(obj1.TypedValue)))); }
/// <summary> /// Constructor /// </summary> /// <param name="val">Value for this type</param> public ONNat(ONNat val) { if (val == null) { Value = null; } else { Value = val.Value; } }
public static ONReal Min(ONReal obj1, ONNat obj2) { if (((object)obj1 == null) || ((object)obj2 == null)) { throw new ONNullException(null); } if ((obj1.Value == null) || (obj2.Value == null)) { return(ONReal.Null); } return(new ONReal(Math.Min(obj1.TypedValue, obj2.TypedValue))); }
public static ONReal Pow(ONReal obj1, ONNat obj2) { if (((object)obj1 == null) || ((object)obj2 == null)) { throw new ONNullException(null); } if ((obj1.Value == null) || (obj2.Value == null)) { return(ONReal.Null); } return(new ONReal(Convert.ToDecimal(Math.Pow(Convert.ToDouble(obj1.TypedValue), Convert.ToDouble(obj2.TypedValue))))); }
/// <summary> /// Creates XML elements from the data of the system. /// </summary> /// <param name="xmlWriter">Object with the XML message to add new information and return to client side</param> /// <param name="val">Value to be puted inside the XML message</param> /// <param name="dtdVersion">Version of the DTD that follows the XML message</param> /// <param name="xmlElement">Element of the XML that is checked</param> public static void ON2XML(XmlWriter xmlWriter, ONNat val, double dtdVersion, string xmlElement) { if (val == null) { if (xmlElement == ONXml.XMLTAG_V) xmlWriter.WriteElementString(xmlElement, ""); else xmlWriter.WriteElementString(ONXml.XMLTAG_NULL, null); } else { xmlWriter.WriteStartElement(xmlElement); if (xmlElement == ONXml.XMLTAG_OIDFIELD && dtdVersion > 2.0) xmlWriter.WriteAttributeString("Type", "nat"); xmlWriter.WriteString(val.TypedValue.ToString()); xmlWriter.WriteEndElement(); } }
public static ONReal Pow(ONInt obj1, ONNat obj2) { if (((object) obj1 == null) || ((object) obj2 == null)) throw new ONNullException(null); if ((obj1.Value == null) || (obj2.Value == null)) return ONReal.Null; return new ONReal(Convert.ToDecimal(Math.Pow(obj1.TypedValue, obj2.TypedValue))); }
public static ONInt Min(ONInt obj1, ONNat obj2) { if (((object) obj1 == null) || ((object) obj2 == null)) throw new ONNullException(null); if ((obj1.Value == null) || (obj2.Value == null)) return ONInt.Null; return new ONInt(Math.Min(obj1.TypedValue, obj2.TypedValue)); }
/// <summary> /// Constructor /// </summary> /// <param name="val">Value for this type</param> public ONInt(ONNat val) { TypedValue = (int) val.TypedValue; }
/// <summary> /// Constructor /// </summary> /// <param name="val">Value for this type</param> public ONReal(ONNat val) { TypedValue = (decimal)val.TypedValue; }
/// <summary> /// Constructor /// </summary> /// <param name="val">Value for this type</param> public ONInt(ONNat val) { TypedValue = (int)val.TypedValue; }
/// <summary> /// Constructor /// </summary> /// <param name="val">Value for this type</param> public ONReal(ONNat val) { TypedValue = (decimal) val.TypedValue; }
public static ONReal Max(ONReal obj1, ONNat obj2) { if (((object) obj1 == null) || ((object) obj2 == null)) throw new ONNullException(null); if ((obj1.Value == null) || (obj2.Value == null)) return ONReal.Null; return new ONReal(Math.Max(obj1.TypedValue, obj2.TypedValue)); }
public static ONReal Exp(ONNat obj1) { if (((object) obj1 == null) || (obj1.Value == null)) throw new ONNullException(null); return new ONReal(Convert.ToDecimal(Math.Exp(obj1.TypedValue))); }