Author: bpoussin Date: 2012-08-31 19:29:07 +0200 (Fri, 31 Aug 2012) New Revision: 445 Url: http://nuiton.org/repositories/revision/nuiton-matrix/445 Log: all semantics objects must be undecorate before call method on backend matrix Modified: trunk/nuiton-matrix/src/main/java/org/nuiton/math/matrix/MatrixSemanticsDecorator.java Modified: trunk/nuiton-matrix/src/main/java/org/nuiton/math/matrix/MatrixSemanticsDecorator.java =================================================================== --- trunk/nuiton-matrix/src/main/java/org/nuiton/math/matrix/MatrixSemanticsDecorator.java 2012-08-31 16:43:29 UTC (rev 444) +++ trunk/nuiton-matrix/src/main/java/org/nuiton/math/matrix/MatrixSemanticsDecorator.java 2012-08-31 17:29:07 UTC (rev 445) @@ -206,27 +206,40 @@ @Override public double getValue(Object[] coordinates) { - return matrix.getValue(coordinates); + Object[] tmp = new Object[coordinates.length]; + for (int i=0; i<tmp.length; i++) { + tmp[i] = decorator.undecorate(coordinates[i]); + } + return matrix.getValue(tmp); } @Override public double getValue(Object x) { - return matrix.getValue(x); + return matrix.getValue(decorator.undecorate(x)); } @Override public double getValue(Object x, Object y) { - return matrix.getValue(x, y); + return matrix.getValue( + decorator.undecorate(x), + decorator.undecorate(y)); } @Override public double getValue(Object x, Object y, Object z) { - return matrix.getValue(x, y, z); + return matrix.getValue( + decorator.undecorate(x), + decorator.undecorate(y), + decorator.undecorate(z)); } @Override public double getValue(Object x, Object y, Object z, Object t) { - return matrix.getValue(x, y, z, t); + return matrix.getValue( + decorator.undecorate(x), + decorator.undecorate(y), + decorator.undecorate(z), + decorator.undecorate(t)); } @Override @@ -256,27 +269,46 @@ @Override public void setValue(Object[] coordinates, double d) { - matrix.setValue(coordinates, d); + Object[] tmp = new Object[coordinates.length]; + for (int i=0; i<tmp.length; i++) { + tmp[i] = decorator.undecorate(coordinates[i]); + } + + matrix.setValue(tmp, d); } @Override public void setValue(Object x, double d) { - matrix.setValue(x, d); + matrix.setValue( + decorator.undecorate(x), + d); } @Override public void setValue(Object x, Object y, double d) { - matrix.setValue(x, y, d); + matrix.setValue( + decorator.undecorate(x), + decorator.undecorate(y), + d); } @Override public void setValue(Object x, Object y, Object z, double d) { - matrix.setValue(x, y, z, d); + matrix.setValue( + decorator.undecorate(x), + decorator.undecorate(y), + decorator.undecorate(z), + d); } @Override public void setValue(Object x, Object y, Object z, Object t, double d) { - matrix.setValue(x, y, z, t, d); + matrix.setValue( + decorator.undecorate(x), + decorator.undecorate(y), + decorator.undecorate(z), + decorator.undecorate(t), + d); } @Override @@ -349,6 +381,7 @@ @Override public MatrixND getSubMatrix(int dim, Object start, int nb) { + start = decorator.undecorate(start); return wrap(matrix.getSubMatrix(dim, start, nb)); } @@ -359,7 +392,11 @@ @Override public MatrixND getSubMatrix(int dim, Object... elem) { - return wrap(matrix.getSubMatrix(dim, elem)); + Object[] tmp = new Object[elem.length]; + for (int i=0; i<tmp.length; i++) { + tmp[i] = decorator.undecorate(elem[i]); + } + return wrap(matrix.getSubMatrix(dim, tmp)); } @Override @@ -369,7 +406,11 @@ @Override public MatrixND getSubMatrix(Object[]... elem) { - return wrap(matrix.getSubMatrix(elem)); + Object[] tmp = new Object[elem.length]; + for (int i=0; i<tmp.length; i++) { + tmp[i] = decorator.undecorate(elem[i]); + } + return wrap(matrix.getSubMatrix(tmp)); } @Override