/** * Uses the class member operator to perform the calculation. More operations can * be added here as needed. * * @param operand1 the first value to use in the calculation * @param operand2 the second value to use in the calculation * @return Number represents the result of the calculation */ public Number calculate(Number operand1, Number operand2) { return calculate(operand1, operand2, null); } }
@Override public List<T> getDefaultValue () { List<T> default1 = _tileData1.getDefaultValue(); List<T> default2 = _tileData2.getDefaultValue(); if (null == default1 || null == default2) return null; else { List<T> ourDefault = new ArrayList<>(); for (int i=0; i<Math.min(default1.size(), default2.size()); ++i) { ourDefault.add((T) _op.calculate(default1.get(i), default2.get(i), _errorValue)); } return ourDefault; } }
@SuppressWarnings("unchecked") @Override public List<T> getBin (int x, int y) { List<T> result = new ArrayList<>(); for (int i = 0; i < _tileData1.getBin(x, y).size(); i++) { result.add((T) _op.calculate(_tileData1.getBin(x, y).get(i), _tileData2.getBin(x, y).get(i), _errorValue)); } return result; }