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:
parent
4bfee0420d
commit
654a4018c4
|
@ -25,7 +25,8 @@ package org.apache.commons.math.optimization;
|
|||
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 @@ public class PointCostPair {
|
|||
}
|
||||
|
||||
/** 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.
|
||||
|
|
Loading…
Reference in New Issue