Insert scalar, spectrum or image. spectrum can be arrays of Objects or
primitives. image can be 2D arrays of Objects or primitives

@param value
@throws DevFailed
488386
public void insert(final Object value) throws DevFailed {
        logger.debug(LOG_INSERTING, this);
        attributeImpl.insert(value);
    }
341078
private void putValue(Object value) {
        if (value==null) {
            return;
        }
        if (value instanceof MwsObject) {
            parameterPrefix.append('.');
            ((MwsObject)value).writeFragmentTo(this);
            return;
        }
        String svalue = value.toString();
        if (svalue!=null && svalue.length()>0) {
            String name = parameterPrefix.toString();
            parameters.put(name, svalue);
        }
    }
1261383
public static void insertFromStringArray(final String[] stringValues,
	    final DeviceData deviceDataArgin, final int dataType) throws DevFailed {
	// by default for xdim = 1, send the first value.
	String firsString = "";
	Double numericalValue = Double.NaN;

	if (stringValues.length > 0) {
	    firsString = stringValues[0];
	}

	try {
	    numericalValue = Double.valueOf(firsString);
	} catch (final Exception e) {
	    numericalValue = Double.NaN;
	}

	switch (dataType) {
	case TangoConst.Tango_DEV_SHORT:
	    if (!numericalValue.isNaN()) {
		deviceDataArgin.insert(numericalValue.shortValue());
	    } else {
		Except.throw_exception("TANGO_WRONG_DATA_ERROR", firsString
			+ " is not a Tango_DEV_SHORT",
			"CommandHelper.insertFromStringArray(String[] values,deviceDataArgin)");
	    }
	    break;
	case TangoConst.Tango_DEV_USHORT:
	    if (!numericalValue.isNaN()) {
		deviceDataArgin.insert_us(numericalValue.shortValue());
	    } else {
		Except.throw_exception("TANGO_WRONG_DATA_ERROR", firsString
			+ " is not a Tango_DEV_USHORT",
			"CommandHelper.insertFromStringArray(String[] values,deviceDataArgin)");
	    }
	    break;
	case TangoConst.Tango_DEV_CHAR:
	    deviceDataArgin.insert(numericalValue.byteValue());
	    Except.throw_exception("TANGO_WRONG_DATA_ERROR",
		    "input type Tango_DEV_CHAR not supported",
		    "CommandHelper.insertFromStringArray(String[] values,deviceDataArgin)");
	    break;
	case TangoConst.Tango_DEV_UCHAR:
	    if (!numericalValue.isNaN()) {
		deviceDataArgin.insert(numericalValue.shortValue());
	    } else {
		Except.throw_exception("TANGO_WRONG_DATA_ERROR", firsString
			+ " is not a Tango_DEV_UCHAR",
			"CommandHelper.insertFromStringArray(String[] values,deviceDataArgin)");
	    }
	    break;
	case TangoConst.Tango_DEV_LONG:
	    if (!numericalValue.isNaN()) {
		deviceDataArgin.insert(numericalValue.intValue());
	    } else {
		Except.throw_exception("TANGO_WRONG_DATA_ERROR", firsString
			+ " is not a Tango_DEV_LONG",
			"CommandHelper.insertFromStringArray(String[] values,deviceDataArgin)");
	    }
	    break;
	case TangoConst.Tango_DEV_ULONG:
	    if (!numericalValue.isNaN()) {
		deviceDataArgin.insert_ul(numericalValue.longValue());
	    } else {
		Except.throw_exception("TANGO_WRONG_DATA_ERROR", firsString
			+ " is not a Tango_DEV_ULONG",
			"CommandHelper.insertFromStringArray(String[] values,deviceDataArgin)");
	    }
	    break;
	case TangoConst.Tango_DEV_LONG64:
	    Except.throw_exception("TANGO_WRONG_DATA_ERROR",
		    "input type Tango_DEV_LONG64 not supported",
		    "CommandHelper.insertFromStringArray(String[] values,deviceDataArgin)");
	    break;
	case TangoConst.Tango_DEV_ULONG64:
	    if (!numericalValue.isNaN()) {
		deviceDataArgin.insert_u64(numericalValue.longValue());
	    } else {
		Except.throw_exception("TANGO_WRONG_DATA_ERROR", firsString
			+ " is not a Tango_DEV_ULONG64",
			"CommandHelper.insertFromStringArray(String[] values,deviceDataArgin)");
	    }
	    break;
	case TangoConst.Tango_DEV_INT:
	    if (!numericalValue.isNaN()) {
		deviceDataArgin.insert(numericalValue.intValue());
	    } else {
		Except.throw_exception("TANGO_WRONG_DATA_ERROR", firsString
			+ " is not a Tango_DEV_INT",
			"CommandHelper.insertFromStringArray(String[] values,deviceDataArgin)");
	    }
	    break;
	case TangoConst.Tango_DEV_FLOAT:
	    if (!numericalValue.isNaN()) {
		deviceDataArgin.insert(numericalValue.floatValue());
	    } else {
		Except.throw_exception("TANGO_WRONG_DATA_ERROR", firsString
			+ " is not a Tango_DEV_FLOAT",
			"CommandHelper.insertFromStringArray(String[] values,deviceDataArgin)");
	    }
	    break;
	case TangoConst.Tango_DEV_DOUBLE:
	    if (!numericalValue.isNaN()) {
		deviceDataArgin.insert(numericalValue.doubleValue());
	    } else {
		Except.throw_exception("TANGO_WRONG_DATA_ERROR", firsString
			+ " is not a Tango_DEV_DOUBLE",
			"CommandHelper.insertFromStringArray(String[] values,deviceDataArgin)");
	    }
	    break;
	case TangoConst.Tango_DEV_STRING:
	    deviceDataArgin.insert(firsString);
	    break;
	case TangoConst.Tango_DEV_BOOLEAN:
	    if (!numericalValue.isNaN()) {
		if (numericalValue.doubleValue() == 1) {
		    deviceDataArgin.insert(true);
		} else {
		    deviceDataArgin.insert(false);
		}
	    } else {
		Except.throw_exception("TANGO_WRONG_DATA_ERROR", firsString
			+ " is not a Tango_DEV_BOOLEAN",
			"CommandHelper.insertFromStringArray(String[] values,deviceDataArgin)");
	    }
	    break;
	case TangoConst.Tango_DEV_STATE:
	    Except.throw_exception("TANGO_WRONG_DATA_ERROR", "Tango_DEV_STATE is not supported",
		    "CommandHelper.insertFromStringArray(String[] values,deviceDataArgin)");
	    break;

	// Array input type
	case TangoConst.Tango_DEVVAR_SHORTARRAY:
	    final short[] shortValues = new short[stringValues.length];
	    for (int i = 0; i < stringValues.length; i++) {
		try {
		    shortValues[i] = Double.valueOf(stringValues[i]).shortValue();
		} catch (final Exception e) {
		    Except.throw_exception("TANGO_WRONG_DATA_ERROR",
			    "input is not a Tango_DEVVAR_SHORTARRAY",
			    "CommandHelper.insertFromStringArray(String[] values,deviceDataArgin)");
		}
	    }
	    deviceDataArgin.insert(shortValues);
	    break;

	case TangoConst.Tango_DEVVAR_USHORTARRAY:
	    final short[] ushortValues = new short[stringValues.length];
	    for (int i = 0; i < stringValues.length; i++) {
		try {
		    ushortValues[i] = Double.valueOf(stringValues[i]).shortValue();
		} catch (final Exception e) {
		    Except.throw_exception("TANGO_WRONG_DATA_ERROR",
			    "input is not a Tango_DEVVAR_USHORTARRAY",
			    "CommandHelper.insertFromStringArray(String[] values,deviceDataArgin)");
		}
	    }
	    deviceDataArgin.insert_us(ushortValues);
	    break;
	case TangoConst.Tango_DEVVAR_CHARARRAY:
	    final byte[] byteValues = new byte[stringValues.length];
	    for (int i = 0; i < stringValues.length; i++) {
		try {
		    byteValues[i] = Double.valueOf(stringValues[i]).byteValue();
		} catch (final Exception e) {
		    Except.throw_exception("TANGO_WRONG_DATA_ERROR",
			    "input is not a Tango_DEVVAR_CHARARRAY",
			    "CommandHelper.insertFromStringArray(String[] values,deviceDataArgin)");
		}
	    }
	    deviceDataArgin.insert(byteValues);
	    break;
	case TangoConst.Tango_DEVVAR_LONGARRAY:
	    final int[] longValues = new int[stringValues.length];
	    for (int i = 0; i < stringValues.length; i++) {
		try {
		    longValues[i] = Double.valueOf(stringValues[i]).intValue();
		} catch (final Exception e) {
		    Except.throw_exception("TANGO_WRONG_DATA_ERROR",
			    "input is not a Tango_DEVVAR_LONGARRAY",
			    "CommandHelper.insertFromStringArray(String[] values,deviceDataArgin)");
		}
	    }
	    deviceDataArgin.insert(longValues);
	    break;
	case TangoConst.Tango_DEVVAR_ULONGARRAY:
	    final long[] ulongValues = new long[stringValues.length];
	    for (int i = 0; i < stringValues.length; i++) {
		try {
		    ulongValues[i] = Double.valueOf(stringValues[i]).longValue();
		} catch (final Exception e) {
		    Except.throw_exception("TANGO_WRONG_DATA_ERROR",
			    "input is not a Tango_DEVVAR_LONGARRAY",
			    "CommandHelper.insertFromStringArray(String[] values,deviceDataArgin)");
		}
	    }
	    deviceDataArgin.insert_ul(ulongValues);
	    break;
	case TangoConst.Tango_DEVVAR_LONG64ARRAY:
	    final int[] long64Values = new int[stringValues.length];
	    for (int i = 0; i < stringValues.length; i++) {
		try {
		    long64Values[i] = Double.valueOf(stringValues[i]).intValue();
		} catch (final Exception e) {
		    Except.throw_exception("TANGO_WRONG_DATA_ERROR",
			    "input is not a Tango_DEVVAR_LONGARRAY",
			    "CommandHelper.insertFromStringArray(String[] values,deviceDataArgin)");
		}
	    }
	    deviceDataArgin.insert(long64Values);
	    break;
	case TangoConst.Tango_DEVVAR_ULONG64ARRAY:
	    final long[] ulong64Values = new long[stringValues.length];
	    for (int i = 0; i < stringValues.length; i++) {
		try {
		    ulong64Values[i] = Double.valueOf(stringValues[i]).longValue();
		} catch (final Exception e) {
		    Except.throw_exception("TANGO_WRONG_DATA_ERROR",
			    "input is not a Tango_DEVVAR_LONGARRAY",
			    "CommandHelper.insertFromStringArray(String[] values,deviceDataArgin)");
		}
	    }
	    deviceDataArgin.insert_u64(ulong64Values);
	    break;
	case TangoConst.Tango_DEVVAR_FLOATARRAY:
	    final float[] floatValues = new float[stringValues.length];
	    for (int i = 0; i < stringValues.length; i++) {
		try {
		    floatValues[i] = Double.valueOf(stringValues[i]).floatValue();
		} catch (final Exception e) {
		    Except.throw_exception("TANGO_WRONG_DATA_ERROR",
			    "input is not a Tango_DEVVAR_FLOATARRAY",
			    "CommandHelper.insertFromStringArray(String[] values,deviceDataArgin)");
		}
	    }
	    deviceDataArgin.insert(floatValues);
	    break;
	case TangoConst.Tango_DEVVAR_DOUBLEARRAY:
	    final double[] doubleValues = new double[stringValues.length];
	    for (int i = 0; i < stringValues.length; i++) {
		try {
		    doubleValues[i] = Double.valueOf(stringValues[i]).doubleValue();
		} catch (final Exception e) {
		    Except.throw_exception("TANGO_WRONG_DATA_ERROR",
			    "input is not a Tango_DEVVAR_DOUBLEARRAY",
			    "CommandHelper.insertFromStringArray(String[] values,deviceDataArgin)");
		}
	    }
	    deviceDataArgin.insert(doubleValues);
	    break;
	case TangoConst.Tango_DEVVAR_STRINGARRAY:
	    deviceDataArgin.insert(stringValues);
	    break;

	default:
	    Except.throw_exception("TANGO_WRONG_DATA_ERROR", "input type "
		    + deviceDataArgin.getType() + " not supported",
		    "CommandHelper.insertFromStringArray(String[] value,deviceDataArgin)");
	    break;
	}
    }
394281
public void addTangoArchiveListener(ITangoArchiveListener listener, String attrName, String[] filters)
            throws DevFailed {
        addTangoArchiveListener(listener, attrName, filters, false);
    }
1291037
public void setAttributePropertyInDB(final String attributeName, final String propertyName, final String value)
            throws DevFailed {
        xlogger.entry(propertyName);

        // insert value in db only if input value is different and not a
        // default value
        // if (checkCurrentValue) {
        // final String presentValue = getAttributePropertyFromDB(attributeName, propertyName);
        // final boolean isADefaultValue = presentValue.isEmpty()
        // && (value.equalsIgnoreCase(AttributePropertiesImpl.NOT_SPECIFIED)
        // || value.equalsIgnoreCase(AttributePropertiesImpl.NO_DIPLAY_UNIT)
        // || value.equalsIgnoreCase(AttributePropertiesImpl.NO_UNIT) || value
        // .equalsIgnoreCase(AttributePropertiesImpl.NO_STD_UNIT));
        // if (!isADefaultValue && !presentValue.equals(value) && !value.isEmpty() && !value.equals("NaN")) {
        // LOGGER.debug("update in DB {}, property {}= {}", new Object[] { attributeName, propertyName, value });
        // final Map<String, String[]> propInsert = new HashMap<String, String[]>();
        // propInsert.put(propertyName, new String[] { value });
        // DatabaseFactory.getDatabase().setAttributeProperties(deviceName, attributeName, propInsert);
        // }
        // } else {
        logger.debug("update in DB {}, property {}= {}", new Object[] { attributeName, propertyName, value });
        final Map<String, String[]> propInsert = new HashMap<String, String[]>();
        propInsert.put(propertyName, new String[] { value });
        DatabaseFactory.getDatabase().setAttributeProperties(deviceName, attributeName, propInsert);
        // }
        xlogger.exit();
    }
1328354
public void addTangoPeriodicListener(ITangoPeriodicListener listener, String attrName, String[] filters)
            throws DevFailed {
        addTangoPeriodicListener(listener, attrName, filters, false);
    }
741770
public void put(byte[] value) {
		if (value == null) {
			this.compiledStatement.bindNull(compiledStatementBindIndex++);
		} else {
			compiledStatement.bindBlob(compiledStatementBindIndex++, value);
		}
	}
1113591
public void add(T value) {
        if (value == null)
            return;

        if (map.containsKey(value)) {
            map.put(value, map.get(value) + 1);
        } else {
            map.put(value, 1l);
        }
    }
887601
public static void insertFromArray(final Object[] values, final DeviceData deviceDataArgin,
	    final int dataType) throws DevFailed {
	if (values.length > 0) {
	    final Object firstValue = values[0];
	    if (firstValue instanceof Short) {
		final short[] tmpValues = new short[values.length];
		for (int i = 0; i < tmpValues.length; i++) {
		    tmpValues[i] = ((Short) values[i]).shortValue();
		}
		CommandHelper.insertFromShortArray(tmpValues, deviceDataArgin, dataType);
	    } else if (firstValue instanceof String) {
		final String[] tmpValues = new String[values.length];
		for (int i = 0; i < tmpValues.length; i++) {
		    tmpValues[i] = (String) values[i];
		}
		CommandHelper.insertFromStringArray(tmpValues, deviceDataArgin, dataType);
	    } else if (firstValue instanceof Integer) {
		final int[] tmpValues = new int[values.length];
		for (int i = 0; i < tmpValues.length; i++) {
		    tmpValues[i] = ((Integer) values[i]).intValue();
		}
		CommandHelper.insertFromIntegerArray(tmpValues, deviceDataArgin, dataType);
	    } else if (firstValue instanceof Long) {
		final long[] tmpValues = new long[values.length];
		for (int i = 0; i < tmpValues.length; i++) {
		    tmpValues[i] = ((Long) values[i]).intValue();
		}
		CommandHelper.insertFromLongArray(tmpValues, deviceDataArgin, dataType);
	    } else if (firstValue instanceof Float) {
		final float[] tmpValues = new float[values.length];
		for (int i = 0; i < tmpValues.length; i++) {
		    tmpValues[i] = ((Float) values[i]).floatValue();
		}
		CommandHelper.insertFromFloatArray(tmpValues, deviceDataArgin, dataType);
	    } else if (firstValue instanceof Byte) {
		final byte[] tmpValues = new byte[values.length];
		for (int i = 0; i < tmpValues.length; i++) {
		    tmpValues[i] = ((Byte) values[i]).byteValue();
		}
		CommandHelper.insertFromByteArray(tmpValues, deviceDataArgin, dataType);
	    } else if (firstValue instanceof Boolean) {
		final boolean[] tmpValues = new boolean[values.length];
		for (int i = 0; i < tmpValues.length; i++) {
		    tmpValues[i] = ((Boolean) values[i]).booleanValue();
		}

		CommandHelper.insertFromBooleanArray(tmpValues, deviceDataArgin, dataType);
	    } else if (firstValue instanceof Double) {
		final double[] tmpValues = new double[values.length];
		for (int i = 0; i < tmpValues.length; i++) {
		    tmpValues[i] = ((Double) values[i]).doubleValue();
		}

		CommandHelper.insertFromDoubleArray(tmpValues, deviceDataArgin, dataType);
	    }
	}
    }
811356
public void addValue(double value)
    {
        if (dataSetSize == dataSet.length)
        {
            // Increase the capacity of the array.
            int newLength = (int) (GROWTH_RATE * dataSetSize);
            double[] newDataSet = new double[newLength];
            System.arraycopy(dataSet, 0, newDataSet, 0, dataSetSize);
            dataSet = newDataSet;
        }
        dataSet[dataSetSize] = value;
        updateStatsWithNewValue(value);
        ++dataSetSize;
    }
12908
public static void insertFromShortArray(final short[] shortValues,
	    final DeviceData deviceDataArgin, final int dataType) throws DevFailed {
	// by default for xdim = 1, send the sum.
	Double doubleSum = new Double(0);
	for (final short shortValue : shortValues) {
	    doubleSum = doubleSum + shortValue;
	}

	switch (dataType) {
	case TangoConst.Tango_DEV_SHORT:
	    deviceDataArgin.insert(doubleSum.shortValue());
	    break;
	case TangoConst.Tango_DEV_USHORT:
	    deviceDataArgin.insert_us(doubleSum.intValue());
	    break;
	case TangoConst.Tango_DEV_CHAR:
	    Except.throw_exception("TANGO_WRONG_DATA_ERROR",
		    "input type Tango_DEV_CHAR not supported",
		    "CommandHelper.insertFromShortArray(short[] values,deviceDataArgin)");
	    break;
	case TangoConst.Tango_DEV_UCHAR:
	    deviceDataArgin.insert(doubleSum.shortValue());
	    break;
	case TangoConst.Tango_DEV_LONG:
	    deviceDataArgin.insert(doubleSum.intValue());
	    break;
	case TangoConst.Tango_DEV_ULONG:
	    deviceDataArgin.insert_ul(doubleSum.longValue());
	    break;
	case TangoConst.Tango_DEV_LONG64:
	    deviceDataArgin.insert(doubleSum.intValue());
	    break;
	case TangoConst.Tango_DEV_ULONG64:
	    deviceDataArgin.insert_u64(doubleSum.longValue());
	    break;
	case TangoConst.Tango_DEV_INT:
	    deviceDataArgin.insert(doubleSum.intValue());
	    break;
	case TangoConst.Tango_DEV_FLOAT:
	    deviceDataArgin.insert(doubleSum.floatValue());
	    break;
	case TangoConst.Tango_DEV_DOUBLE:
	    deviceDataArgin.insert(doubleSum.doubleValue());
	    break;
	case TangoConst.Tango_DEV_STRING:
	    deviceDataArgin.insert(doubleSum.toString());
	    break;
	case TangoConst.Tango_DEV_BOOLEAN:
	    if (doubleSum.doubleValue() == 1) {
		deviceDataArgin.insert(true);
	    } else {
		deviceDataArgin.insert(false);
	    }
	    break;
	case TangoConst.Tango_DEV_STATE:
	    DevState devStateValue = DevState.UNKNOWN;
	    if (shortValues.length > 0) {
		try {
		    devStateValue = DevState.from_int(Short.valueOf(shortValues[0]).intValue());
		} catch (final org.omg.CORBA.BAD_PARAM badParam) {
		    devStateValue = DevState.UNKNOWN;
		}
	    }
	    deviceDataArgin.insert(devStateValue);
	    break;

	// Array input type
	case TangoConst.Tango_DEVVAR_SHORTARRAY:
	    deviceDataArgin.insert(shortValues);
	    break;
	case TangoConst.Tango_DEVVAR_USHORTARRAY:
	    deviceDataArgin.insert_us(shortValues);
	    break;
	case TangoConst.Tango_DEVVAR_CHARARRAY:
	    final byte[] byteValues = new byte[shortValues.length];
	    for (int i = 0; i < shortValues.length; i++) {
		byteValues[i] = Short.valueOf(shortValues[i]).byteValue();
	    }
	    deviceDataArgin.insert(byteValues);
	    break;
	case TangoConst.Tango_DEVVAR_LONGARRAY:
	    final int[] longValues = new int[shortValues.length];
	    for (int i = 0; i < shortValues.length; i++) {
		longValues[i] = Short.valueOf(shortValues[i]).intValue();
	    }
	    deviceDataArgin.insert(longValues);
	    break;
	case TangoConst.Tango_DEVVAR_ULONGARRAY:
	    final long[] ulongValues = new long[shortValues.length];
	    for (int i = 0; i < shortValues.length; i++) {
		ulongValues[i] = Short.valueOf(shortValues[i]).longValue();
	    }
	    deviceDataArgin.insert_ul(ulongValues);
	    break;
	case TangoConst.Tango_DEVVAR_LONG64ARRAY:
	    final int[] long64Values = new int[shortValues.length];
	    for (int i = 0; i < shortValues.length; i++) {
		long64Values[i] = Short.valueOf(shortValues[i]).intValue();
	    }
	    deviceDataArgin.insert(long64Values);
	    break;
	case TangoConst.Tango_DEVVAR_ULONG64ARRAY:
	    final long[] uLong64Values = new long[shortValues.length];
	    for (int i = 0; i < shortValues.length; i++) {
		uLong64Values[i] = Short.valueOf(shortValues[i]).longValue();
	    }
	    deviceDataArgin.insert_u64(uLong64Values);
	    break;
	case TangoConst.Tango_DEVVAR_FLOATARRAY:
	    final float[] floatValues = new float[shortValues.length];
	    for (int i = 0; i < shortValues.length; i++) {
		floatValues[i] = Short.valueOf(shortValues[i]).floatValue();
	    }
	    deviceDataArgin.insert(floatValues);
	    break;
	case TangoConst.Tango_DEVVAR_DOUBLEARRAY:
	    final double[] doubleValues = new double[shortValues.length];
	    for (int i = 0; i < shortValues.length; i++) {
		doubleValues[i] = Short.valueOf(shortValues[i]).doubleValue();
	    }
	    deviceDataArgin.insert(doubleValues);
	    break;
	case TangoConst.Tango_DEVVAR_STRINGARRAY:
	    final String[] stringValues = new String[shortValues.length];
	    for (int i = 0; i < shortValues.length; i++) {
		stringValues[i] = Short.valueOf(shortValues[i]).toString();
	    }
	    deviceDataArgin.insert(stringValues);
	    break;

	default:
	    Except.throw_exception("TANGO_WRONG_DATA_ERROR", "input type "
		    + deviceDataArgin.getType() + " not supported",
		    "CommandHelper.insertFromShortArray(short[] values,deviceDataArgin)");
	    break;
	}
    }
503643
public void addValue(int... value) {
        /* no-op if disabled */
        if (!enabled.get())
            return;

        for (int v : value) {
            try {
                getCurrentBucket().data.addValue(v);
            } catch (Exception e) {
                logger.error("Failed to add value: " + v, e);
            }
        }
    }
570617
public void putClassPipeProperty(Database database, String className, DbPipe dbPipe) throws DevFailed {
        DeviceData argIn = new DeviceData();
        String[]    array = ApiUtil.toStringArray(className, dbPipe);
        argIn.insert(array);
        database.command_inout("DbPutClassPipeProperty", argIn);
    }
1219248
public void insert(final String argin) {
	final String[] values = new String[1];
	values[0] = argin;
	attrval.r_dim.dim_x = 1;
	attrval.r_dim.dim_y = 0;
	DevVarStringArrayHelper.insert(attrval.value, values);
    }
1248438
public static AttrValUnion set(final int tangoType, final Object value) throws DevFailed {
        final AttributeDataType discriminator = AttributeTangoType.getTypeFromTango(tangoType).getAttributeDataType();
        final AttrValUnion union = new AttrValUnion();
        Object array = null;
        if (value.getClass().isArray()) {
            // convert to array of primitives if necessary
            array = org.tango.utils.ArrayUtils.toPrimitiveArray(value);
        } else {
            // put in an array before inserting for scalars
            array = Array.newInstance(AttributeTangoType.getTypeFromTango(tangoType).getType(), 1);
            try {
                Array.set(array, 0, value);
            } catch (final IllegalArgumentException e) {
                throw DevFailedUtils.newDevFailed(ExceptionMessages.ATTR_OPT_PROP, value.getClass().getCanonicalName()
                        + " is not of the good type");
            }
        }
        try {
            final Method method = union.getClass().getMethod(METHOD_MAP.get(discriminator),
                    PARAM_MAP.get(discriminator));
            method.invoke(union, array);
        } catch (final IllegalArgumentException e) {
            throw DevFailedUtils.newDevFailed(ExceptionMessages.ATTR_OPT_PROP, value.getClass().getCanonicalName()
                    + " is not of the good type");
        } catch (final IllegalAccessException e) {
            throw DevFailedUtils.newDevFailed(e);
        } catch (final InvocationTargetException e) {
            throw DevFailedUtils.newDevFailed(e.getCause());
        } catch (final SecurityException e) {
            throw DevFailedUtils.newDevFailed(e);
        } catch (final NoSuchMethodException e) {
            throw DevFailedUtils.newDevFailed(e);
        }
        return union;
    }
739984
public void insertInOrder(int value)
  {

    for (int i = 0; i < m_firstFree; i++)
    {
      if (value < m_map[i])
      {
        insertElementAt(value, i);

        return;
      }
    }

    addElement(value);
  }
1107066
public void insert(final int argin) {
	final int[] values = new int[1];
	values[0] = argin;
	attrval.r_dim.dim_x = 1;
	attrval.r_dim.dim_y = 0;
	DevVarLongArrayHelper.insert(attrval.value, values);
    }