コード例 #1
0
ファイル: Array.cs プロジェクト: shannah/CN1WindowsPort
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)]
}
コード例 #2
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();
            }
        }
コード例 #3
0
ファイル: _nTIB.cs プロジェクト: Pmovil/CN1WindowsPort
 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();
     }
 }
コード例 #4
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)]
        }