@@ -0,0 +1,2026 @@
+/*%0A * Copyright 2016 Will Knez %3Cwbknez.dev@gmail.com%3E%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0A%0Apackage com.solsticesquared.schelling.ui;%0A%0Aimport org.jfree.data.xy.XYSeries;%0A%0Aimport java.util.ArrayList;%0A%0A/**%0A * Represents an implementation of an %7B@link XYSeries%7D that pre-allocates the%0A * underlying array in order to help improve performance.%0A */%0Apublic class FixedSizeXYSeries extends XYSeries %7B%0A%0A    /**%0A     * Constructor.%0A     *%0A     * @param key%0A     *        The unique name, or id, for the series.%0A     * @param autoSort%0A     *        Whether or not to automatically sort incoming data values.%0A     * @param allowDuplicateXValues%0A     *        Whether or not to allow duplicate data values.%0A     * @param reserveElements%0A     *        The amount of memory to reserve in advance.%0A     * @throws IllegalArgumentException%0A     *         If %7B@code reserveElements%7D is less than zero.%0A     */%0A    public FixedSizeXYSeries(final Comparable%3C?%3E key,%0A                             final boolean autoSort,%0A                             final boolean allowDuplicateXValues,%0A                             final int reserveElements) %7B%0A        super(key, autoSort, allowDuplicateXValues);%0A%0A        if(reserveElements %3C 0) %7B%0A            throw new IllegalArgumentException(%22number of elements to reserve%22 +%0A                                               %22 must be positive!%22);%0A        %7D%0A%0A        // Reserve the appropriate amount of memory.%0A        ((ArrayList%3C?%3E)this.data).ensureCapacity(reserveElements);%0A    %7D%0A%7D%0A

Add fixed-size numeric series.