Author: jcouteau Date: 2009-09-28 15:14:37 +0000 (Mon, 28 Sep 2009) New Revision: 2650 Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/MatrixContinuousDomain.java Log: Add getRealMinBound and getRealMaxBounf methods Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/MatrixContinuousDomain.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/MatrixContinuousDomain.java 2009-09-28 15:03:28 UTC (rev 2649) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/MatrixContinuousDomain.java 2009-09-28 15:14:37 UTC (rev 2650) @@ -33,8 +33,7 @@ * * Last update : $Date: 24 févr. 2009 $ By : $Author: chatellier $ */ -public class MatrixContinuousDomain extends - ContinuousDomain<MatrixND, Double> { +public class MatrixContinuousDomain extends ContinuousDomain<MatrixND, Double> { /** serialVersionUID. */ private static final long serialVersionUID = -2037768174807839046L; @@ -47,7 +46,7 @@ /** Operation. (=,+,-,/) */ protected String operator; - + /** Value used to create the matrix */ protected double value; @@ -135,9 +134,9 @@ * In continuous domain, just return identifier. */ public MatrixND getValueForIdentifier(final Serializable identifier) { - return getValueForIdentifier((Double)identifier); + return getValueForIdentifier((Double) identifier); } - + /** * {@inheritDoc}. * @@ -173,7 +172,7 @@ } return temp; } - + /** * Get value used to create the matrix. * @@ -192,7 +191,7 @@ public void setValue(Double value) { this.value = value; } - + public MatrixContinuousDomain clone() { MatrixContinuousDomain cloned = new MatrixContinuousDomain(); cloned.setCardinality(this.cardinality); @@ -204,4 +203,42 @@ cloned.setValue(this.value); return cloned; } + + /** + * Get the minimum bound of the coefficient used to create the matrix. As + * the getMinBound for use in R always return 0. + * + * @return the real minimum bound + */ + public Double getRealMinBound() { + if (operator.equals("+")) { + return (1.0 + ((1.0 + coefficient) * ((2 * 0.0 - 1)))); + } else if (operator.equals("-")) { + return (1.0 + ((1.0 - coefficient) * ((2 * 0.0 - 1)))); + } else if (operator.equals("*")) { + return (1.0 + ((1.0 * coefficient) * ((2 * 0.0 - 1)))); + } else if (operator.equals("/")) { + return (1.0 + ((1.0 / coefficient) * ((2 * 0.0 - 1)))); + } else + return null; + } + + /** + * Get the maximal bound of the coefficient used to create the matrix. As + * the getMaxBound for use in R always return 1. + * + * @return the real maximum bound + */ + public Double getRealMaxBound() { + if (operator.equals("+")) { + return (1.0 + ((1.0 + coefficient) * ((2 * 1.0 - 1)))); + } else if (operator.equals("-")) { + return (1.0 + ((1.0 - coefficient) * ((2 * 1.0 - 1)))); + } else if (operator.equals("*")) { + return (1.0 + ((1.0 * coefficient) * ((2 * 1.0 - 1)))); + } else if (operator.equals("/")) { + return (1.0 + ((1.0 / coefficient) * ((2 * 1.0 - 1)))); + } else + return null; + } }