[MATH-1072] Added constructor for AbstractListChromosome that does not copy the input argument.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1561508 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Thomas Neidhart 2014-01-26 15:46:49 +00:00
parent 6a6c06acdf
commit 91291520cf
2 changed files with 28 additions and 14 deletions

View File

@ -51,19 +51,23 @@ If the output is not quite correct, check for invisible trailing spaces!
</properties>
<body>
<release version="3.3" date="TBD" description="TBD">
<action dev="tn" type="add" issue="MATH-1072">
Added a constructor to "AbstractListChromosome" that does not copy the
input argument.
</action>
<action dev="luc" type="add" issue="MATH-1091">
BSP tree now provides an API to compute a global signed distance from
a test point to the region. The distance is positive if the point is
outside of the region, negative if the point is inside, and zero
when the point is at the boundary. The distance is continuous
everywhere, so it can be used with a root solver to identify accurately
boundary crossings. This API is available for all BSP trees, in
Euclidean and spherical geometries, and in all dimensions.
BSP tree now provides an API to compute a global signed distance from
a test point to the region. The distance is positive if the point is
outside of the region, negative if the point is inside, and zero
when the point is at the boundary. The distance is continuous
everywhere, so it can be used with a root solver to identify accurately
boundary crossings. This API is available for all BSP trees, in
Euclidean and spherical geometries, and in all dimensions.
</action>
<action dev="luc" type="add" issue="MATH-1090">
IntervalsSet now implements Iterable&lt;double[]&gt;, so one can iterate
over the sub-intervals without building a full list containing
a copy of everything beforehand.
IntervalsSet now implements Iterable&lt;double[]&gt;, so one can iterate
over the sub-intervals without building a full list containing
a copy of everything beforehand.
</action>
<action dev="tn" type="fix" issue="MATH-1089">
"Precision#round(double, ...)" will now return negative zero for negative

View File

@ -34,17 +34,16 @@ public abstract class AbstractListChromosome<T> extends Chromosome {
private final List<T> representation;
/**
* Constructor.
* Constructor, copying the input representation.
* @param representation inner representation of the chromosome
* @throws InvalidRepresentationException iff the <code>representation</code> can not represent a valid chromosome
*/
public AbstractListChromosome(final List<T> representation) throws InvalidRepresentationException {
checkValidity(representation);
this.representation = Collections.unmodifiableList(new ArrayList<T>(representation));
this(representation, true);
}
/**
* Constructor.
* Constructor, copying the input representation.
* @param representation inner representation of the chromosome
* @throws InvalidRepresentationException iff the <code>representation</code> can not represent a valid chromosome
*/
@ -52,6 +51,17 @@ public abstract class AbstractListChromosome<T> extends Chromosome {
this(Arrays.asList(representation));
}
/**
* Constructor.
* @param representation inner representation of the chromosome
* @param copyList if {@code true}, the representation will be copied, otherwise it will be referenced.
*/
public AbstractListChromosome(final List<T> representation, final boolean copyList) {
checkValidity(representation);
this.representation =
Collections.unmodifiableList(copyList ? new ArrayList<T>(representation) : representation);
}
/**
* Asserts that <code>representation</code> can represent a valid chromosome.
*