make sure immutable PointCostPair internal representation is not accessible

JIRA: MATH-183

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@617855 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Luc Maisonobe 2008-02-02 18:17:19 +00:00
parent 4bfee0420d
commit 654a4018c4
1 changed files with 4 additions and 3 deletions

View File

@ -25,7 +25,8 @@ package org.apache.commons.math.optimization;
public class PointCostPair { public class PointCostPair {
/** Build a point/cost pair. /** 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 * @param cost point cost
*/ */
public PointCostPair(double[] point, double cost) { public PointCostPair(double[] point, double cost) {
@ -34,10 +35,10 @@ public class PointCostPair {
} }
/** Get the point. /** Get the point.
* @return the stored point * @return a copy of the stored point
*/ */
public double[] getPoint() { public double[] getPoint() {
return point; return (double[]) point.clone();
} }
/** Get the cost. /** Get the cost.