private void assertBooleanValue(AttributeValue attr, bool value) { Assert.IsInstanceOfType(attr.getValue(), typeof(PrimitiveObjectBlock)); PrimitiveObjectBlock pob = (PrimitiveObjectBlock)attr.getValue(); Assert.IsInstanceOfType(pob.getSimpleValue(), typeof(BooleanValue)); BooleanValue actual = (BooleanValue)pob.getSimpleValue(); java.lang.Boolean expected = new java.lang.Boolean(value); Assert.AreEqual(actual.getValue(), expected); }
public static void set(object arrayObj, int index, object value) { if (arrayObj == null) { throw new java.lang.NullPointerException(); } Type type = arrayObj.GetType(); if (ReflectUtil.IsVector(type) && ClassLoaderWrapper.GetWrapperFromType(type.GetElementType()).IsPrimitive) { java.lang.Boolean booleanValue = value as java.lang.Boolean; if (booleanValue != null) { setBoolean(arrayObj, index, booleanValue.booleanValue()); return; } java.lang.Byte byteValue = value as java.lang.Byte; if (byteValue != null) { setByte(arrayObj, index, byteValue.byteValue()); return; } java.lang.Character charValue = value as java.lang.Character; if (charValue != null) { setChar(arrayObj, index, charValue.charValue()); return; } java.lang.Short shortValue = value as java.lang.Short; if (shortValue != null) { setShort(arrayObj, index, shortValue.shortValue()); return; } java.lang.Integer intValue = value as java.lang.Integer; if (intValue != null) { setInt(arrayObj, index, intValue.intValue()); return; } java.lang.Float floatValue = value as java.lang.Float; if (floatValue != null) { setFloat(arrayObj, index, floatValue.floatValue()); return; } java.lang.Long longValue = value as java.lang.Long; if (longValue != null) { setLong(arrayObj, index, longValue.longValue()); return; } java.lang.Double doubleValue = value as java.lang.Double; if (doubleValue != null) { setDouble(arrayObj, index, doubleValue.doubleValue()); return; } } try { CheckArray(arrayObj).SetValue(value, index); } catch (InvalidCastException) { throw new java.lang.IllegalArgumentException("argument type mismatch"); } catch (IndexOutOfRangeException) { throw new java.lang.ArrayIndexOutOfBoundsException(); } }