Author: luc
Date: Sat Feb 2 10:17:19 2008
New Revision: 617855
URL: http://svn.apache.org/viewvc?rev=617855&view=rev
Log:
make sure immutable PointCostPair internal representation is not accessible
JIRA: MATH-183
Modified:
commons/proper/math/trunk/src/java/org/apache/commons/math/optimization/PointCostPair.java
Modified:
commons/proper/math/trunk/src/java/org/apache/commons/math/optimization/PointCostPair.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/optimization/PointCostPair.java?rev=617855&r1=617854&r2=617855&view=diff
==============================================================================
---
commons/proper/math/trunk/src/java/org/apache/commons/math/optimization/PointCostPair.java
(original)
+++
commons/proper/math/trunk/src/java/org/apache/commons/math/optimization/PointCostPair.java
Sat Feb 2 10:17:19 2008
@@ -25,7 +25,8 @@
public class PointCostPair {
/** Build a point/cost pair.
- * @param point point coordinates
+ * @param point point coordinates (the built instance will store
+ * a copy of the array, not the array passed as argument)
* @param cost point cost
*/
public PointCostPair(double[] point, double cost) {
@@ -34,10 +35,10 @@
}
/** Get the point.
- * @return the stored point
+ * @return a copy of the stored point
*/
public double[] getPoint() {
- return point;
+ return (double[]) point.clone();
}
/** Get the cost.