Author: chatellier Date: 2011-04-21 13:50:33 +0000 (Thu, 21 Apr 2011) New Revision: 3280 Log: Factorisation des domaines continue (operator, coefficient, valueDeReference) Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/xml/DomXMLParser.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/ContinuousDomain.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/EquationContinuousDomain.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/MatrixContinuousDomain.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/package-info.java isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/launcher/SimulationServiceTest.java isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/sensitivity/FactorTest.java isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/ui/sensitivity/FactorTreeModelTest.java Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/xml/DomXMLParser.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/xml/DomXMLParser.java 2011-04-21 12:53:31 UTC (rev 3279) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/xml/DomXMLParser.java 2011-04-21 13:50:33 UTC (rev 3280) @@ -170,69 +170,6 @@ factor.setDomain(domain); } factorGroup.addFactor(factor); - } else if ("integer".equals(type)) { - Factor factor = new Factor(name); - factor.setPath(path); - Element fixedElement = factorElement.element("domain").element("fixed"); - if ("continuous".equals(property)) { - ContinuousDomain domain = null; - - if(property.equals("matrixcontinuous")) { - // matrix specific - MatrixContinuousDomain mdomain = new MatrixContinuousDomain(); - - Element coefficientElement = fixedElement.element("coefficient"); - mdomain.setCoefficient(Double.valueOf(coefficientElement.attributeValue("value"))); - mdomain.setOperator(coefficientElement.attributeValue("operator")); - - // matrix specific - Element matrixElement = fixedElement.element("mx"); - MatrixND matrix = MexicoHelper.getMatrixFromXml(matrixElement, topiaContext); - mdomain.setMatrix(matrix); - - domain = mdomain; - } - else if (property.equals("equationcontinuous")) { - // equation specific - - EquationContinuousDomain edomain = new EquationContinuousDomain(); - - Element coefficientElement = fixedElement.element("coefficient"); - edomain.setCoefficient(Double.valueOf(coefficientElement.attributeValue("value"))); - edomain.setOperator(coefficientElement.attributeValue("operator")); - - Element equationElement = fixedElement.element("equation"); - edomain.setReferenceValue(Double.valueOf(equationElement.attributeValue("reference"))); - edomain.setVariableName(equationElement.attributeValue("variable")); - - domain = edomain; - } - else { - // continous domain - domain = new ContinuousDomain(); - } - - domain.setCardinality(Integer.valueOf(fixedElement.attributeValue("cardinality"))); - - // <range max="1" min="3"/> - Element rangeElement = fixedElement.element("range"); - domain.setMinBound(Integer.valueOf(rangeElement.attributeValue("min"))); - domain.setMaxBound(Integer.valueOf(rangeElement.attributeValue("max"))); - - factor.setDomain(domain); - } else if ("discrete".equals(property)) { - DiscreteDomain domain = new DiscreteDomain(); - List<Element> valueElements = fixedElement.element( - "enumeration").elements("value"); - int label = 0; - for (Element valueElement : valueElements) { - domain.getValues().put(Integer.valueOf(label), - Integer.valueOf(valueElement.getTextTrim())); - ++label; - } - factor.setDomain(domain); - } - factorGroup.addFactor(factor); } else if ("rule".equals(type)) { Factor factor = new Factor(name); factor.setPath(path); Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/ContinuousDomain.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/ContinuousDomain.java 2011-04-21 12:53:31 UTC (rev 3279) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/ContinuousDomain.java 2011-04-21 13:50:33 UTC (rev 3280) @@ -44,12 +44,21 @@ /** serialVersionUID. */ private static final long serialVersionUID = -2037768174807839046L; - /** Borne inférieure */ - protected double minBound; + /** Borne inférieure. {@link Double} pour gerer la nullité. */ + protected Double minBound; - /** Borne supérieure */ - protected double maxBound; + /** Borne supérieure. {@link Double} pour gerer la nullité. */ + protected Double maxBound; + /** Operation. (=,+,-,/) */ + protected String operator; + + /** Coefficient in percent */ + protected Double coefficient; + + /** Value used to create the factor. */ + protected Double referenceValue; + /** Cardinality */ protected int cardinality; @@ -66,7 +75,7 @@ * @param minBound min bound * @param maxBound max bound */ - public ContinuousDomain(double minBound, double maxBound) { + public ContinuousDomain(Double minBound, Double maxBound) { this(); this.minBound = minBound; this.maxBound = maxBound; @@ -82,7 +91,7 @@ /** * @param minBound the minBound to set */ - public void setMinBound(double minBound) { + public void setMinBound(Double minBound) { this.minBound = minBound; } @@ -96,11 +105,65 @@ /** * @param maxBound the maxBound to set */ - public void setMaxBound(double maxBound) { + public void setMaxBound(Double maxBound) { this.maxBound = maxBound; } /** + * Get operator. + * + * @return the operator + */ + public String getOperator() { + return operator; + } + + /** + * Set operator. + * + * @param operator the operator to set + */ + public void setOperator(String operator) { + this.operator = operator; + } + + /** + * Get coefficient. + * + * @return the coefficient + */ + public Double getCoefficient() { + return coefficient; + } + + /** + * Set coefficient. + * + * @param coefficient the coefficient to set + */ + public void setCoefficient(Double coefficient) { + this.coefficient = coefficient; + } + + /** + * Get reference value. + * + * @return the reference value + */ + public Double getReferenceValue() { + return referenceValue; + } + + /** + * Set reference value. + * + * @param referenceValue the reference value.to set + */ + public void setReferenceValue(Double referenceValue) { + this.referenceValue = referenceValue; + } + + /** * {@inheritDoc}. * * In continuous domain, just return identifier Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/EquationContinuousDomain.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/EquationContinuousDomain.java 2011-04-21 12:53:31 UTC (rev 3279) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/EquationContinuousDomain.java 2011-04-21 13:50:33 UTC (rev 3280) @@ -43,17 +43,11 @@ /** Variable name (must be java valid identifier) */ protected String variableName; - - /** Operation. (=,+,-,/) */ - protected String operator; - - /** Coefficient in percent */ - protected Double coefficient; - - /** Reference value*/ - protected Double referenceValue; - /** Value used to create the equation */ + /** + * Value used to create the factor. + * @deprecated since 20110421 : on ne fait rien de la value ? + */ protected Double value; /** @@ -74,61 +68,6 @@ public void setVariableName(String variableName) { this.variableName = variableName; } - - /** - * Get operator. - * - * @return the operator - */ - public String getOperator() { - return operator; - } - - /** - * Set operator. - * - * @param operator - * the operator to set - */ - public void setOperator(String operator) { - this.operator = operator; - } - - /** - * Get coefficient. - * - * @return the coefficient - */ - public Double getCoefficient() { - return coefficient; - } - - /** - * Set coefficient. - * - * @param coefficient the coefficient to set - */ - public void setCoefficient(Double coefficient) { - this.coefficient = coefficient; - } - - /** - * Get reference value. - * - * @return the reference value - */ - public Double getReferenceValue() { - return referenceValue; - } - - /** - * Set reference value. - * - * @param referenceValue the reference value.to set - */ - public void setReferenceValue(Double referenceValue) { - this.referenceValue = referenceValue; - } /** * {@inheritDoc}. @@ -190,6 +129,7 @@ * Get value used to create the equation. * * @return the value + * @deprecated since 20110421, on n'en fait rien de la value. */ public Double getValue() { return this.value; @@ -198,8 +138,8 @@ /** * Set value used to create the equation. * - * @param value - * the value to set + * @param value the value to set + * @deprecated since 20110421, on n'en fait rien de la value. */ public void setValue(Double value) { this.value = value; Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/MatrixContinuousDomain.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/MatrixContinuousDomain.java 2011-04-21 12:53:31 UTC (rev 3279) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/MatrixContinuousDomain.java 2011-04-21 13:50:33 UTC (rev 3280) @@ -46,13 +46,10 @@ /** Matrix */ protected MatrixND matrix; - /** Coefficient. */ - protected double coefficient; - - /** Operation. (=,+,-,/) */ - protected String operator; - - /** Value used to create the matrix */ + /** + * Value used to create the matrix + * @deprecated since 20110421, on n'en fait rien de la value. + */ protected double value; /** @@ -74,38 +71,6 @@ } /** - * @return the coefficient - */ - public double getCoefficient() { - return coefficient; - } - - /** - * @param coefficient the coefficient to set - */ - public void setCoefficient(double coefficient) { - this.coefficient = coefficient; - } - - /** - * Get operator. - * - * @return the operator - */ - public String getOperator() { - return operator; - } - - /** - * Set operator. - * - * @param operator the operator to set - */ - public void setOperator(String operator) { - this.operator = operator; - } - - /** * {@inheritDoc}. * * In matrix continuous domain, always return 0 @@ -180,6 +145,7 @@ * Get value used to create the matrix. * * @return the value + * @deprecated since 20110421, on n'en fait rien de la value. */ public Double getValue() { return this.value; @@ -189,6 +155,7 @@ * Set value used to create the matrix. * * @param value the value to set + * @deprecated since 20110421, on n'en fait rien de la value. */ public void setValue(Double value) { this.value = value; Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/package-info.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/package-info.java 2011-04-21 12:53:31 UTC (rev 3279) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/package-info.java 2011-04-21 13:50:33 UTC (rev 3280) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2009 - 2010 Ifremer, CodeLutin + * Copyright (C) 2009 - 2011 Ifremer, CodeLutin, Chatellier Eric * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as Modified: isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/launcher/SimulationServiceTest.java =================================================================== --- isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/launcher/SimulationServiceTest.java 2011-04-21 12:53:31 UTC (rev 3279) +++ isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/launcher/SimulationServiceTest.java 2011-04-21 13:50:33 UTC (rev 3280) @@ -235,8 +235,8 @@ // factor Factor factor = new Factor("testint"); ContinuousDomain domain = new ContinuousDomain(); - domain.setMinBound(0); - domain.setMaxBound(50); + domain.setMinBound(0.0); + domain.setMaxBound(50.0); factor.setDomain(domain); factor.setPath("fr.ifremer.entities.Cell#1234567890#length"); factor.setValueForIdentifier(49); Modified: isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/sensitivity/FactorTest.java =================================================================== --- isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/sensitivity/FactorTest.java 2011-04-21 12:53:31 UTC (rev 3279) +++ isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/sensitivity/FactorTest.java 2011-04-21 13:50:33 UTC (rev 3280) @@ -64,8 +64,8 @@ Factor factor = new Factor("testint"); ContinuousDomain domain = new ContinuousDomain(); - domain.setMinBound(0); - domain.setMaxBound(50); + domain.setMinBound(0.0); + domain.setMaxBound(50.0); factor.setDomain(domain); factor.setPath("org.nuiton.factor#1234567890#0.12242345354#name"); factor.setValueForIdentifier(49); @@ -363,8 +363,8 @@ factor.setValue(42.0); ContinuousDomain domain = new ContinuousDomain(); - domain.setMinBound(0); - domain.setMaxBound(50); + domain.setMinBound(0.0); + domain.setMaxBound(50.0); factor.setDomain(domain); // clone Modified: isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/ui/sensitivity/FactorTreeModelTest.java =================================================================== --- isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/ui/sensitivity/FactorTreeModelTest.java 2011-04-21 12:53:31 UTC (rev 3279) +++ isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/ui/sensitivity/FactorTreeModelTest.java 2011-04-21 13:50:33 UTC (rev 3280) @@ -73,8 +73,8 @@ Factor factor1 = new Factor( "testint"); ContinuousDomain domain1 = new ContinuousDomain(); - domain1.setMinBound(0); - domain1.setMaxBound(50); + domain1.setMinBound(0.0); + domain1.setMaxBound(50.0); factor1.setDomain(domain1); factor1.setPath("org.nuiton.factor#1234567890#0.12242345354#name"); factor1.setValueForIdentifier(49);