Commit 4d81b889 authored by Per Bothner's avatar Per Bothner

* FlattenedArray.java (flatten): Check for 'simple' array first.

Fixes GitLab issue #66 "array->vector returns non-vector?".
parent 175d021d
Pipeline #123419174 failed with stage
in 5 minutes and 7 seconds
2020-03-04 Per Bothner <per@bothner.com>
* FlattenedArray.java (flatten): Check for 'simple' array first.
Fixes GitLab issue #66 "array->vector returns non-vector?".
* GeneralArray1.java: Implement GVector.
2020-01-10 Per Bothner <per@bothner.com>
......
......@@ -31,13 +31,13 @@ public class FlattenedArray<E> extends TransformedArray<E> implements AVector<E>
/** Created a shared flattened view of the argument.
*/
public static <E> AVector<E> flatten(Array<E> array) {
if (array instanceof AVector)
return (AVector) array;
if (array instanceof GeneralArray) {
GeneralArray<E> garr = (GeneralArray<E>) array;
if (garr.simple && garr.base instanceof AVector)
return (AVector<E>) garr.base;
}
if (array instanceof AVector)
return (AVector) array;
return new FlattenedArray(array);
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment