Beispiel #1
0
        public static int CompareTo(javaDouble self, double value)
        {
            double m_value = self.doubleValue();

            if (m_value < value)
            {
                return(-1);
            }
            if (m_value > value)
            {
                return(1);
            }
            if (m_value == value)
            {
                return(0);
            }

            // At least one of the values is NaN.
            if (javaDouble.isNaN(m_value))
            {
                return(javaDouble.isNaN(value) ? 0 : -1);
            }
            else
            {
                return(1);
            }
        }
Beispiel #2
0
        private void verifyCDvQuantityValue(org.openehr.am.archetype.constraintmodel.ArchetypeConstraint node)
        {
            Assert.IsTrue(node is org.openehr.am.openehrprofile.datatypes.quantity.CDvQuantity, "CDvQuantity expected");

            org.openehr.am.openehrprofile.datatypes.quantity.CDvQuantity cdvquantity = (org.openehr.am.openehrprofile.datatypes.quantity.CDvQuantity)node;

            // verify property
            org.openehr.rm.datatypes.text.CodePhrase property = cdvquantity.getProperty();
            Assert.IsNotNull(property, "property is null");
            Assert.AreEqual("openehr", property.getTerminologyId().name());
            Assert.AreEqual("128", property.getCodeString());

            // verify item list
            java.util.List list = cdvquantity.getList();
            Assert.AreEqual(2, list.size(), "unexpected size of list");
            java.lang.Double  temp1 = new java.lang.Double(0.0);
            java.lang.Double  temp2 = new java.lang.Double(200.0);
            java.lang.Integer temp3 = new java.lang.Integer(2);
            assertCDvQuantityItem((org.openehr.am.openehrprofile.datatypes.quantity.CDvQuantityItem)list.get(0), "yr", new org.openehr.rm.support.basic.Interval(temp1, temp2), new org.openehr.rm.support.basic.Interval(temp3, temp3));
            temp1 = new java.lang.Double(1.0);
            temp2 = new java.lang.Double(36.0);
            assertCDvQuantityItem((org.openehr.am.openehrprofile.datatypes.quantity.CDvQuantityItem)list.get(1), "mth", new org.openehr.rm.support.basic.Interval(temp1, temp2), new org.openehr.rm.support.basic.Interval(temp3, temp3));

            org.openehr.rm.support.measurement.MeasurementService ms       = org.openehr.rm.support.measurement.SimpleMeasurementService.getInstance();
            org.openehr.rm.datatypes.quantity.DvQuantity          expected = new org.openehr.rm.datatypes.quantity.DvQuantity("yr", new java.lang.Double(8.0), new java.lang.Integer(2), ms);
            Assert.AreEqual(expected,
                            cdvquantity.getAssumedValue(), "assumed value wrong");
        }
Beispiel #3
0
public static global::System.Object get(global::java.lang.Object n1, int n2){
//XMLVM_BEGIN_WRAPPER[java.lang.reflect.Array: java.lang.Object get(java.lang.Object, int)]
    throw new org.xmlvm._nNotYetImplementedException("native/wrapper method not yet implemented");
    if (n1==null) {
        java.lang.NullPointerException jex = new java.lang.NullPointerException();
        jex.@this();
        throw new org.xmlvm._nExceptionAdapter(jex);
    } else if (n1 is org.xmlvm._nArrayAdapter<object>) {
        return ((org.xmlvm._nArrayAdapter<object>) n1)[n2];
    } else if (n1 is org.xmlvm._nArrayAdapter<bool>) {
        bool unwrappedBoolean = ((org.xmlvm._nArrayAdapter<bool>) n1)[n2];
        java.lang.Boolean result = new java.lang.Boolean();
        result.@this(unwrappedBoolean);
        return result;
    } else if (n1 is org.xmlvm._nArrayAdapter<sbyte>) {
        sbyte unwrappedByte = ((org.xmlvm._nArrayAdapter<sbyte>) n1)[n2];
        java.lang.Byte result = new java.lang.Byte();
        result.@this(unwrappedByte);
        return result;
    } else if (n1 is org.xmlvm._nArrayAdapter<char>) {
        char unwrappedChar = ((org.xmlvm._nArrayAdapter<char>) n1)[n2];
        java.lang.Character result = new java.lang.Character();
        result.@this(unwrappedChar);
        return result;
    } else if (n1 is org.xmlvm._nArrayAdapter<short>) {
        short unwrappedShort = ((org.xmlvm._nArrayAdapter<short>) n1)[n2];
        java.lang.Short result = new java.lang.Short();
        result.@this(unwrappedShort);
        return result;
    } else if (n1 is org.xmlvm._nArrayAdapter<int>) {
        int unwrappedInteger = ((org.xmlvm._nArrayAdapter<int>) n1)[n2];
        java.lang.Integer result = new java.lang.Integer();
        result.@this(unwrappedInteger);
        return result;
    } else if (n1 is org.xmlvm._nArrayAdapter<long>) {
        long unwrappedLong = ((org.xmlvm._nArrayAdapter<long>) n1)[n2];
        java.lang.Long result = new java.lang.Long();
        result.@this(unwrappedLong);
        return result;
    } else if (n1 is org.xmlvm._nArrayAdapter<float>) {
        float unwrappedFloat = ((org.xmlvm._nArrayAdapter<float>) n1)[n2];
        java.lang.Float result = new java.lang.Float();
        result.@this(unwrappedFloat);
        return result;
    } else if (n1 is org.xmlvm._nArrayAdapter<double>) {
        double unwrappedDouble = ((org.xmlvm._nArrayAdapter<double>) n1)[n2];
        java.lang.Double result = new java.lang.Double();
        result.@this(unwrappedDouble);
        return result;
    } else if (!(n1 is org.xmlvm._nIArray)) {
        // it is not an org.xmlvm._nIArray 
        java.lang.IllegalArgumentException jex = new java.lang.IllegalArgumentException();
        jex.@this(org.xmlvm._nUtil.toJavaString("Not an array"));
        throw new org.xmlvm._nExceptionAdapter(jex);
    } else {
        // something went wrong
        throw new org.xmlvm._nNativeImplementationException();
    }
//XMLVM_END_WRAPPER[java.lang.reflect.Array: java.lang.Object get(java.lang.Object, int)]
}
Beispiel #4
0
 public void assertCReal(Object obj, org.openehr.rm.support.basic.Interval interval, double[] values,
                         java.lang.Double assumed)
 {
     org.openehr.am.archetype.constraintmodel.primitive.CReal c = (org.openehr.am.archetype.constraintmodel.primitive.CReal)fetchFirst(obj);
     Assert.AreEqual(interval, c.getInterval(), "interval");
     Assert.AreEqual(doubleSet(values), c.getList(), "list");
     Assert.AreEqual(assumed, c.assumedValue(), "unexpected assumed value");
 }
Beispiel #5
0
 public void testParseDouble()
 {
     try {
         JDouble.parseDouble("TRUE");
         Fail();
     } catch (Exception success) {
         Matches("For input string", success);
     }
 }
Beispiel #6
0
 public int compareTo(java.lang.Double arg0)
 {
     global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
     if (!IsClrObject)
     {
         return(@__env.CallIntMethod(this.JvmHandle, global::java.lang.Double._compareTo12924, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0)));
     }
     else
     {
         return(@__env.CallNonVirtualIntMethod(this.JvmHandle, global::java.lang.Double.staticClass, global::java.lang.Double._compareTo12924, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0)));
     }
 }
Beispiel #7
0
 public void put(java.lang.String arg0, java.lang.Double arg1)
 {
     global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
     if (!IsClrObject)
     {
         @__env.CallVoidMethod(this.JvmHandle, global::android.content.ContentValues._put1260, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1));
     }
     else
     {
         @__env.CallNonVirtualVoidMethod(this.JvmHandle, global::android.content.ContentValues.staticClass, global::android.content.ContentValues._put1260, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1));
     }
 }
Beispiel #8
0
        internal static object Unbox(object val)
        {
#if STATIC_COMPILER || FIRST_PASS || STUB_GENERATOR
            return(null);
#else
            java.lang.Byte b = val as java.lang.Byte;
            if (b != null)
            {
                return(b.byteValue());
            }
            java.lang.Boolean b1 = val as java.lang.Boolean;
            if (b1 != null)
            {
                return(b1.booleanValue());
            }
            java.lang.Short s = val as java.lang.Short;
            if (s != null)
            {
                return(s.shortValue());
            }
            java.lang.Character c = val as java.lang.Character;
            if (c != null)
            {
                return(c.charValue());
            }
            java.lang.Integer i = val as java.lang.Integer;
            if (i != null)
            {
                return(i.intValue());
            }
            java.lang.Float f = val as java.lang.Float;
            if (f != null)
            {
                return(f.floatValue());
            }
            java.lang.Long l = val as java.lang.Long;
            if (l != null)
            {
                return(l.longValue());
            }
            java.lang.Double d = val as java.lang.Double;
            if (d != null)
            {
                return(d.doubleValue());
            }
            else
            {
                throw new java.lang.IllegalArgumentException();
            }
#endif
        }
Beispiel #9
0
        public static bool Equals(javaDouble self, object obj)
        {
            double m_value = self.doubleValue();

            if (!(obj is Double))
            {
                return(false);
            }
            double temp = ((Double)obj);

            // This code below is written this way for performance reasons i.e the != and == check is intentional.
            if (temp == m_value)
            {
                return(true);
            }
            return(javaDouble.isNaN(temp) && javaDouble.isNaN(m_value));
        }
Beispiel #10
0
        public static int CompareTo(javaDouble self, object value)
        {
            double m_value = self.doubleValue();

            if (value == null)
            {
                return(1);
            }
            if (value is Double)
            {
                double d = (double)value;
                if (m_value < d)
                {
                    return(-1);
                }
                if (m_value > d)
                {
                    return(1);
                }
                if (m_value == d)
                {
                    return(0);
                }

                // At least one of the values is NaN.
                if (javaDouble.isNaN(m_value))
                {
                    return(javaDouble.isNaN(d) ? 0 : -1);
                }
                else
                {
                    return(1);
                }
            }
            throw new ArgumentException(Environment.GetResourceString("Arg_MustBeDouble"));
        }
        public Term random_int_1(Term val0)
        {
            Term result = new Var();

              if (!(val0 is Number))
              {
            throw new Exception(
            "random_int requires a bound integer parameter.");
              }
              int n = ((alice.tuprolog.Number)val0).intValue();

              java.lang.Double d = new java.lang.Double(1 + (_random.NextDouble() * n));
              unify(result, new alice.tuprolog.Int(d.intValue()));

              return result;
        }
// Generating method code for initPointerEvent
        public virtual void InitPointerEvent(string type, bool bubbles, bool cancelable, object view, int detail, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, int button, object relatedTarget, int offsetX, int offsetY, int width, int height, java.lang.Double pressure, int rotation, int tiltX, int tiltY, int pointerId, string pointerType, int hwTimestamp, bool isPrimary)
        {
            WObj.initPointerEvent(type, bubbles, cancelable, view, detail, screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey, metaKey, button, relatedTarget, offsetX, offsetY, width, height, pressure, rotation, tiltX, tiltY, pointerId, pointerType, hwTimestamp, isPrimary);
        }
        private void verifyCDvQuantityValue(org.openehr.am.archetype.constraintmodel.ArchetypeConstraint node)
        {
            Assert.IsTrue(node is org.openehr.am.openehrprofile.datatypes.quantity.CDvQuantity, "CDvQuantity expected");

            org.openehr.am.openehrprofile.datatypes.quantity.CDvQuantity cdvquantity = (org.openehr.am.openehrprofile.datatypes.quantity.CDvQuantity) node;

            // verify property
            org.openehr.rm.datatypes.text.CodePhrase property = cdvquantity.getProperty();
            Assert.IsNotNull(property, "property is null");
            Assert.AreEqual("openehr", property.getTerminologyId().name());
            Assert.AreEqual("128", property.getCodeString());

            // verify item list
            java.util.List list = cdvquantity.getList();
            Assert.AreEqual(2, list.size(), "unexpected size of list");
            java.lang.Double temp1 = new java.lang.Double(0.0);
            java.lang.Double temp2 = new java.lang.Double(200.0);
            java.lang.Integer temp3 = new java.lang.Integer(2);
            assertCDvQuantityItem((org.openehr.am.openehrprofile.datatypes.quantity.CDvQuantityItem)list.get(0), "yr", new org.openehr.rm.support.basic.Interval(temp1, temp2), new org.openehr.rm.support.basic.Interval(temp3, temp3));
            temp1 = new java.lang.Double(1.0);
            temp2 = new java.lang.Double(36.0);
            assertCDvQuantityItem((org.openehr.am.openehrprofile.datatypes.quantity.CDvQuantityItem)list.get(1), "mth", new org.openehr.rm.support.basic.Interval(temp1, temp2), new org.openehr.rm.support.basic.Interval(temp3, temp3));

            org.openehr.rm.support.measurement.MeasurementService ms = org.openehr.rm.support.measurement.SimpleMeasurementService.getInstance();
            org.openehr.rm.datatypes.quantity.DvQuantity expected = new org.openehr.rm.datatypes.quantity.DvQuantity("yr", new java.lang.Double(8.0), new java.lang.Integer(2), ms);
            Assert.AreEqual(expected,
                    cdvquantity.getAssumedValue(), "assumed value wrong");
        }
Beispiel #14
0
        /*
         * public static java.lang.String nativeTypeToJavaTypeName(global::System.Type nativeType) {
         *  string result;
         *  _nTIB tib;
         *  if(!tibTable.TryGetValue(nativeType, out tib)) {
         *      // if it is not already in the table,
         *      //   then the native type name is the same as the java counterpart
         *      result = nativeType.ToString();
         *      tib = new _nTIB(nativeType, result);
         *      tibTable.Add(nativeType, tib);
         *      jNameTable.Add(result, tib);
         *      bootstrapSetClass(tib);
         *  } else {
         *      result = tib.getJavaName();
         *  }
         *  return org.xmlvm._nUtil.toJavaString(result);
         * }
         */

        public static java.lang.Object boxIfPrimitive(global::System.Object aValue,
                                                      global::System.Type aType)
        {
            if (!aType.IsPrimitive)
            {
                return((java.lang.Object)aValue); // do nothing
            }
            else if (aType.Equals(booleanType))
            {
                java.lang.Boolean boolBox = new java.lang.Boolean();
                boolBox.@this((bool)aValue);
                return(boolBox);
            }
            else if (aType.Equals(byteType))
            {
                java.lang.Byte byteBox = new java.lang.Byte();
                byteBox.@this((sbyte)aValue);
                return(byteBox);
            }
            else if (aType.Equals(charType))
            {
                java.lang.Character charBox = new java.lang.Character();
                charBox.@this((char)aValue);
                return(charBox);
            }
            else if (aType.Equals(shortType))
            {
                java.lang.Short shortBox = new java.lang.Short();
                shortBox.@this((short)aValue);
                return(shortBox);
            }
            else if (aType.Equals(intType))
            {
                java.lang.Integer intBox = new java.lang.Integer();
                intBox.@this((int)aValue);
                return(intBox);
            }
            else if (aType.Equals(longType))
            {
                java.lang.Long longBox = new java.lang.Long();
                longBox.@this((long)aValue);
                return(longBox);
            }
            else if (aType.Equals(floatType))
            {
                java.lang.Float floatBox = new java.lang.Float();
                floatBox.@this((float)aValue);
                return(floatBox);
            }
            else if (aType.Equals(doubleType))
            {
                java.lang.Double doubleBox = new java.lang.Double();
                doubleBox.@this((double)aValue);
                return(doubleBox);
            }
            else if (aType.Equals(voidType))
            {
                java.lang.Void voidBox = new java.lang.Void();
                voidBox.@this();
                return(voidBox);
            }
            else
            {
                throw new org.xmlvm._nNativeImplementationException();
            }
        }
Beispiel #15
0
 public static java.lang.Object boxIfPrimitive(global::System.Object aValue,
                                               global::System.Type aType)
 {
     if (!aType.GetTypeInfo().IsPrimitive) {
         return (java.lang.Object) aValue; // do nothing
     } else if (aType.Equals(booleanType)) {
         java.lang.Boolean boolBox = new java.lang.Boolean();
         boolBox.@this((bool) aValue);
         return boolBox;
     } else if (aType.Equals(byteType)) {
         java.lang.Byte byteBox = new java.lang.Byte();
         byteBox.@this((sbyte) aValue);
         return byteBox;
     } else if (aType.Equals(charType)) {
         java.lang.Character charBox = new java.lang.Character();
         charBox.@this((char) aValue);
         return charBox;
     } else if (aType.Equals(shortType)) {
         java.lang.Short shortBox = new java.lang.Short();
         shortBox.@this((short) aValue);
         return shortBox;
     } else if (aType.Equals(intType)) {
         java.lang.Integer intBox = new java.lang.Integer();
         intBox.@this((int) aValue);
         return intBox;
     } else if (aType.Equals(longType)) {
         java.lang.Long longBox = new java.lang.Long();
         longBox.@this((long) aValue);
         return longBox;
     } else if (aType.Equals(floatType)) {
         java.lang.Float floatBox = new java.lang.Float();
         floatBox.@this((float) aValue);
         return floatBox;
     } else if (aType.Equals(doubleType)) {
         java.lang.Double doubleBox = new java.lang.Double();
         doubleBox.@this((double) aValue);
         return doubleBox;
     }  else if (aType.Equals(voidType)) {
         java.lang.Void voidBox = new java.lang.Void();
         voidBox.@this();
         return voidBox;
     }
     else {
         throw new org.xmlvm._nNativeImplementationException();
     }
 }
Beispiel #16
0
        public static global::System.Object get(global::java.lang.Object n1, int n2)
        {
//XMLVM_BEGIN_WRAPPER[java.lang.reflect.Array: java.lang.Object get(java.lang.Object, int)]
            throw new org.xmlvm._nNotYetImplementedException("native/wrapper method not yet implemented");
            if (n1 == null)
            {
                java.lang.NullPointerException jex = new java.lang.NullPointerException();
                jex.@this();
                throw new org.xmlvm._nExceptionAdapter(jex);
            }
            else if (n1 is org.xmlvm._nArrayAdapter <object> )
            {
                return(((org.xmlvm._nArrayAdapter <object>)n1)[n2]);
            }
            else if (n1 is org.xmlvm._nArrayAdapter <bool> )
            {
                bool unwrappedBoolean    = ((org.xmlvm._nArrayAdapter <bool>)n1)[n2];
                java.lang.Boolean result = new java.lang.Boolean();
                result.@this(unwrappedBoolean);
                return(result);
            }
            else if (n1 is org.xmlvm._nArrayAdapter <sbyte> )
            {
                sbyte          unwrappedByte = ((org.xmlvm._nArrayAdapter <sbyte>)n1)[n2];
                java.lang.Byte result        = new java.lang.Byte();
                result.@this(unwrappedByte);
                return(result);
            }
            else if (n1 is org.xmlvm._nArrayAdapter <char> )
            {
                char unwrappedChar         = ((org.xmlvm._nArrayAdapter <char>)n1)[n2];
                java.lang.Character result = new java.lang.Character();
                result.@this(unwrappedChar);
                return(result);
            }
            else if (n1 is org.xmlvm._nArrayAdapter <short> )
            {
                short           unwrappedShort = ((org.xmlvm._nArrayAdapter <short>)n1)[n2];
                java.lang.Short result         = new java.lang.Short();
                result.@this(unwrappedShort);
                return(result);
            }
            else if (n1 is org.xmlvm._nArrayAdapter <int> )
            {
                int unwrappedInteger     = ((org.xmlvm._nArrayAdapter <int>)n1)[n2];
                java.lang.Integer result = new java.lang.Integer();
                result.@this(unwrappedInteger);
                return(result);
            }
            else if (n1 is org.xmlvm._nArrayAdapter <long> )
            {
                long           unwrappedLong = ((org.xmlvm._nArrayAdapter <long>)n1)[n2];
                java.lang.Long result        = new java.lang.Long();
                result.@this(unwrappedLong);
                return(result);
            }
            else if (n1 is org.xmlvm._nArrayAdapter <float> )
            {
                float           unwrappedFloat = ((org.xmlvm._nArrayAdapter <float>)n1)[n2];
                java.lang.Float result         = new java.lang.Float();
                result.@this(unwrappedFloat);
                return(result);
            }
            else if (n1 is org.xmlvm._nArrayAdapter <double> )
            {
                double           unwrappedDouble = ((org.xmlvm._nArrayAdapter <double>)n1)[n2];
                java.lang.Double result          = new java.lang.Double();
                result.@this(unwrappedDouble);
                return(result);
            }
            else if (!(n1 is org.xmlvm._nIArray))
            {
                // it is not an org.xmlvm._nIArray
                java.lang.IllegalArgumentException jex = new java.lang.IllegalArgumentException();
                jex.@this(org.xmlvm._nUtil.toJavaString("Not an array"));
                throw new org.xmlvm._nExceptionAdapter(jex);
            }
            else
            {
                // something went wrong
                throw new org.xmlvm._nNativeImplementationException();
            }
//XMLVM_END_WRAPPER[java.lang.reflect.Array: java.lang.Object get(java.lang.Object, int)]
        }
Beispiel #17
0
 public static bool Equals(javaDouble self, double obj)
 {
     return(self.doubleValue() == obj);
 }
Beispiel #18
0
 public static TypeCode GetTypeCode(javaDouble self)
 {
     return(TypeCode.Double);
 }
Beispiel #19
0
        public static string ToString(javaDouble self, string format, IFormatProvider provider)
        {
            double m_value = self.doubleValue();

            return(Number.FormatDouble(m_value, format, NumberFormatInfo.GetInstance(provider)));
        }
Beispiel #20
0
 public static DoubleMap GetAdapter(javaDouble self)
 {
     return(new DoubleMap(self.doubleValue()));
 }
Beispiel #21
0
        public static string ToString(javaDouble self, string format)
        {
            double m_value = self.doubleValue();

            return(Number.FormatDouble(m_value, format, NumberFormatInfo.CurrentInfo));
        }