Esempio n. 1
0
        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));
        }
Esempio n. 2
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="val">Value for this type</param>
 public ONNat(ONNat val)
 {
     if (val == null)
         Value = null;
     else
         Value = val.Value;
 }
Esempio n. 3
0
        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))));
        }
Esempio n. 4
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="val">Value for this type</param>
 public ONNat(ONNat val)
 {
     if (val == null)
     {
         Value = null;
     }
     else
     {
         Value = val.Value;
     }
 }
Esempio n. 5
0
        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)));
        }
Esempio n. 6
0
        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)))));
        }
Esempio n. 7
0
 /// <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();
     }
 }
Esempio n. 8
0
        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)));
        }
Esempio n. 9
0
        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));
        }
Esempio n. 10
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="val">Value for this type</param>
 public ONInt(ONNat val)
 {
     TypedValue = (int) val.TypedValue;
 }
Esempio n. 11
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="val">Value for this type</param>
 public ONReal(ONNat val)
 {
     TypedValue = (decimal)val.TypedValue;
 }
Esempio n. 12
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="val">Value for this type</param>
 public ONInt(ONNat val)
 {
     TypedValue = (int)val.TypedValue;
 }
Esempio n. 13
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="val">Value for this type</param>
 public ONReal(ONNat val)
 {
     TypedValue = (decimal) val.TypedValue;
 }
Esempio n. 14
0
        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));
        }
Esempio n. 15
0
        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)));
        }