public Map<String, Object> calculateObjects(Map<String, Object> input) { int dimension = defaultDimension; boolean ignoreNaN = defaultIgnoreNaN; Map<String, Object> result = new HashMap<String, Object>(); Matrix source = MathUtil.getMatrix(input.get(SOURCE)); Object o2 = input.get(DIMENSION); if (o2 != null) { dimension = MathUtil.getInt(o2); } Object o3 = input.get(IGNORENAN); if (o3 != null) { ignoreNaN = MathUtil.getBoolean(o3); } Matrix target = source.mean(Ret.NEW, dimension, ignoreNaN); result.put(TARGET, target); return result; }
@SuppressWarnings("unchecked") public final void setAsObject(Object o, long... coordinates) { switch (getValueType()) { case BOOLEAN: setAsBoolean(MathUtil.getBoolean(o), coordinates); break; case BIGINTEGER: setAsBigInteger(MathUtil.getBigInteger(o), coordinates); break; case BIGDECIMAL: setAsBigDecimal(MathUtil.getBigDecimal(o), coordinates); break; case BYTE: setAsByte(MathUtil.getByte(o), coordinates); break; case CHAR: setAsChar(MathUtil.getChar(o), coordinates); break; case DOUBLE: setAsDouble(MathUtil.getDouble(o), coordinates); break; case FLOAT: setAsFloat(MathUtil.getFloat(o), coordinates); break; case INT: setAsInt(MathUtil.getInt(o), coordinates); break; case LONG: setAsLong(MathUtil.getLong(o), coordinates); break; case OBJECT: setObject((T) o, coordinates); break; case SHORT: setAsShort(MathUtil.getShort(o), coordinates); break; case STRING: setAsString(StringUtil.convert(o), coordinates); break; } }