CPD Results

The following document contains the results of PMD's CPD 7.3.0.

Duplications

File Project Line
org/djutils/serialization/TypedMessage.java DJUTILS serialization of data structures 1163
org/djutils/serialization/TypedMessage.java DJUTILS serialization of data structures 1239
Serializer[] serializers = buildEncoderList(false, objectArray);
                    for (int i = 0; i < objectArray.length; i++)
                    {
                        buffer[pointer.getAndIncrement(1)] = serializers[i].fieldType();
                    }
                    for (int i = 0; i < objects.length; i++)
                    {
                        List<Object> row = objects[i].exportAsList();
                        Throw.when(row.size() != objectArray.length, SerializationException.class,
                                "List in row %d has %d elements which differs from the %d elements in row 0", i, row.size(),
                                objectArray.length);
                        for (int j = 0; j < row.size(); j++)
                        {
                            serializers[j].serialize(row.get(j), buffer, pointer, endianUtil);
                        }
                    }
                }

                @Override
                public SerializableObject<?>[] deSerialize(final byte[] buffer, final Pointer pointer,
                        final EndianUtil endianUtil) throws SerializationException
                {
                    int arraySize = endianUtil.decodeInt(buffer, pointer.getAndIncrement(4));
                    int fieldCount = endianUtil.decodeInt(buffer, pointer.getAndIncrement(4));
                    Serializer<?>[] deSerializers = new Serializer[fieldCount];
                    for (int i = 0; i < fieldCount; i++)
                    {
                        Byte key = buffer[pointer.getAndIncrement(1)];
                        Serializer<?> deSerializer = PRIMITIVE_DATA_DECODERS.get(key);
                        Throw.whenNull(SerializationException.class, "No decoder for %d", key);
                        deSerializers[i] = deSerializer;
                    }
                    MinimalSerializableObject[] result = new MinimalSerializableObject[arraySize];
                    for (int i = 0; i < arraySize; i++)
                    {
                        List<Object> element = new ArrayList<>();
                        for (int j = 0; j < fieldCount; j++)
                        {
                            element.add(deSerializers[j].deSerialize(buffer, pointer, endianUtil));
                        }
                        result[i] = new MinimalSerializableObject(element);
                    }
                    return result;
                }
            };
File Project Line
org/djutils/draw/line/Clothoid.java DJUTILS - Drawing and animation primitives 642
org/djutils/draw/line/Clothoid.java DJUTILS - Drawing and animation primitives 732
double dx = x1 - x0;
        double dy = y1 - y0;
        double r = Math.hypot(dx, dy);
        double phi = Math.atan2(dy, dx);

        double phi0 = theta0 - phi;
        double phi1 = theta1 - phi;

        phi0 -= m_2pi * Math.rint(phi0 / m_2pi);
        phi1 -= m_2pi * Math.rint(phi1 / m_2pi);

        if (phi0 > m_pi)
        {
            phi0 -= m_2pi;
        }
        if (phi0 < -m_pi)
        {
            phi0 += m_2pi;
        }
        if (phi1 > m_pi)
        {
            phi1 -= m_2pi;
        }
        if (phi1 < -m_pi)
        {
            phi1 += m_2pi;
        }

        double delta = phi1 - phi0;

        // punto iniziale
        double x = phi0 * m_1_pi;
        double y = phi1 * m_1_pi;
        double xy = x * y;
        y *= y;
        x *= x;
        double a =
                (phi0 + phi1) * (CF[0] + xy * (CF[1] + xy * CF[2]) + (CF[3] + xy * CF[4]) * (x + y) + CF[5] * (x * x + y * y));

        // newton
        double g = 0;
        double dg;
        double[] intC = new double[3];
        double[] intS = new double[3];
        int niter = 0;
        do
        {
            GeneralizedFresnelCS(3, 2 * a, delta - a, phi0, intC, intS);
            g = intS[0];
            dg = intC[2] - intC[1];
            a -= g / dg;
        }
        while (++niter <= 10 && Math.abs(g) > 1E-12);

        Throw.when(Math.abs(g) > 1E-8, DrawRuntimeException.class, "Newton did not converge, g = " + g + " niter = " + niter);
File Project Line
org/djutils/data/serialization/DoubleScalarSerializer.java DJUTILS sampling / output data storage 23
org/djutils/data/serialization/FloatScalarSerializer.java DJUTILS sampling / output data storage 25
public class DoubleScalarSerializer<U extends Unit<U>, S extends DoubleScalar<U, S>> implements TextSerializer<S>
{
    /** cache of the retrieved valueOf(String) methods for scalars based on the stored string. */
    private static Map<String, Method> valueOfMethodCache = new LinkedHashMap<>();

    /** cache of the retrieved unit instances based on the unit string. */
    private static Map<String, Unit<?>> unitCache = new LinkedHashMap<>();

    /**
     * Serialize an Scalar value to text in such a way that it can be deserialized with the corresponding deserializer.
     * @param value Object; the scalar to serialize
     * @return String; a string representation of the value that can later be deserialized
     */
    @SuppressWarnings("unchecked")
    @Override
    public String serialize(final S value, final String unitString)
    {
        if (value == null)
        {
            return null;
        }

        String key = value.getClass().getSimpleName() + "_" + unitString;
        Unit<?> unit = unitCache.get(key);
        if (unit == null)
        {
            unit = value.getDisplayUnit().getQuantity().of(unitString);
            unitCache.put(key, unit);
        }
        return String.valueOf(value.getInUnit((U) unit));
    }

    /**
     * Deserialize a String to the correct Scalar value. The method caches the valueOf(String) method for repeated use.
     * @param text String; the text to deserialize
     * @return S; the reconstructed scalar
     */
    @SuppressWarnings("unchecked")
    @Override
    public S deserialize(final Class<S> type, final String text, final String unit)
    {
        if (text == null || text.isEmpty())
        {
            return null;
        }
        try
        {
            Method valueOfMethod = valueOfMethodCache.get(type.getName());
            if (valueOfMethod == null)
            {
                valueOfMethod = type.getDeclaredMethod("valueOf", String.class);
                valueOfMethodCache.put(type.getName(), valueOfMethod);
            }
            return (S) valueOfMethod.invoke(null, text + unit);
        }
        catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException
                | SecurityException exception)
        {
            throw new RuntimeException(exception);
        }
    }

}
File Project Line
org/djutils/draw/line/Bezier.java DJUTILS - Drawing and animation primitives 377
org/djutils/draw/line/Bezier.java DJUTILS - Drawing and animation primitives 747
Point2d projectedPoint = medianPoint.closestPointOnSegment(prevPoint, nextPoint);
            double errorPosition = medianPoint.distance(projectedPoint);
            if (errorPosition >= epsilon)
            {
                // We need to insert another point
                result.put(medianT, medianPoint);
                continue;
            }
            if (prevPoint.distance(nextPoint) > epsilon)
            {
                // Check for an inflection point by creating additional points at one quarter and three quarters. If these
                // are on opposite sides of the line from prevPoint to nextPoint; there must be an inflection point.
                // https://stackoverflow.com/questions/1560492/how-to-tell-whether-a-point-is-to-the-right-or-left-side-of-a-line
                double quarterT = (prevT + medianT) / 2;
                double quarterX = Bn(quarterT, px);
                double quarterY = Bn(quarterT, py);
                int sign1 = (int) Math.signum((nextPoint.x - prevPoint.x) * (quarterY - prevPoint.y)
                        - (nextPoint.y - prevPoint.y) * (quarterX - prevPoint.x));
                double threeQuarterT = (nextT + medianT) / 2;
                double threeQuarterX = Bn(threeQuarterT, px);
                double threeQuarterY = Bn(threeQuarterT, py);
                int sign2 = (int) Math.signum((nextPoint.x - prevPoint.x) * (threeQuarterY - prevPoint.y)
                        - (nextPoint.y - prevPoint.y) * (threeQuarterX - prevPoint.x));
                if (sign1 != sign2)
                {
File Project Line
org/djutils/draw/line/PolyLine2d.java DJUTILS - Drawing and animation primitives 1134
org/djutils/draw/line/PolyLine3d.java DJUTILS - Drawing and animation primitives 958
List<Point2d> pointList = new ArrayList<>();
        int indexInStart = 0;
        int indexInEnd = 0;
        while (indexInStart < this.size() && indexInEnd < endLine.size())
        {
            double fractionInStart = lengthAtIndex(indexInStart) / this.length;
            double fractionInEnd = endLine.lengthAtIndex(indexInEnd) / endLine.length;
            if (fractionInStart < fractionInEnd)
            {
                pointList.add(get(indexInStart).interpolate(endLine.getLocation(fractionInStart * endLine.length),
                        transition.function(fractionInStart)));
                indexInStart++;
            }
            else if (fractionInStart > fractionInEnd)
            {
                pointList.add(this.getLocation(fractionInEnd * this.length).interpolate(endLine.get(indexInEnd),
                        transition.function(fractionInEnd)));
                indexInEnd++;
            }
            else
            {
                pointList.add(this.get(indexInStart).interpolate(endLine.getLocation(fractionInEnd * endLine.length),
                        transition.function(fractionInStart)));
                indexInStart++;
                indexInEnd++;
            }
        }
        return new PolyLine2d(true, pointList);
File Project Line
org/djutils/stats/DistNormalTable.java DJUTILS statistical and data storage utilities 283
org/djutils/stats/DistNormalTable.java DJUTILS statistical and data storage utilities 301
0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, /* 8.20 - 8.24 */
            1.0000000000000000, 1.0000000000000000, 1.0000000000000000, 1.0000000000000000, 1.0000000000000000, /* 8.25 - 8.29 */
            1.0000000000000000, 1.0000000000000000, 1.0000000000000000, 1.0000000000000000, 1.0000000000000000, /* 8.30 - 8.34 */
            1.0000000000000000, 1.0000000000000000, 1.0000000000000000, 1.0000000000000000, 1.0000000000000000, /* 8.35 - 8.39 */
            1.0000000000000000, 1.0000000000000000, 1.0000000000000000, 1.0000000000000000, 1.0000000000000000, /* 8.40 - 8.44 */
            1.0000000000000000, 1.0000000000000000, 1.0000000000000000, 1.0000000000000000, 1.0000000000000000, /* 8.45 - 8.49 */
            1.0000000000000000, 1.0000000000000000, 1.0000000000000000, 1.0000000000000000, 1.0000000000000000, /* 8.50 - 8.54 */
            1.0000000000000000, 1.0000000000000000, 1.0000000000000000, 1.0000000000000000, 1.0000000000000000, /* 8.55 - 8.59 */
            1.0000000000000000, 1.0000000000000000, 1.0000000000000000, 1.0000000000000000, 1.0000000000000000, /* 8.60 - 8.64 */
            1.0000000000000000, 1.0000000000000000, 1.0000000000000000, 1.0000000000000000, 1.0000000000000000, /* 8.65 - 8.69 */
            1.0000000000000000, 1.0000000000000000, 1.0000000000000000, 1.0000000000000000, 1.0000000000000000, /* 8.70 - 8.74 */
            1.0000000000000000, 1.0000000000000000, 1.0000000000000000, 1.0000000000000000, 1.0000000000000000, /* 8.75 - 8.79 */
            1.0000000000000000, 1.0000000000000000, 1.0000000000000000, 1.0000000000000000, 1.0000000000000000, /* 8.80 - 8.84 */
            1.0000000000000000, 1.0000000000000000, 1.0000000000000000, 1.0000000000000000, 1.0000000000000000, /* 8.85 - 8.89 */
            1.0000000000000000, 1.0000000000000000, 1.0000000000000000, 1.0000000000000000, 1.0000000000000000, /* 8.90 - 8.94 */
            1.0000000000000000, 1.0000000000000000, 1.0000000000000000, 1.0000000000000000, 1.0000000000000000, /* 8.95 - 8.99 */
            1.0000000000000000, 1.0000000000000000, 1.0000000000000000, 1.0000000000000000, 1.0000000000000000, /* 9.00 - 9.04 */
            1.0000000000000000, 1.0000000000000000, 1.0000000000000000, 1.0000000000000000, 1.0000000000000000, /* 9.05 - 9.09 */
            1.0000000000000000, 1.0000000000000000, 1.0000000000000000, 1.0000000000000000, 1.0000000000000000, /* 9.10 - 9.14 */
File Project Line
org/djutils/draw/line/PolyLine2d.java DJUTILS - Drawing and animation primitives 551
org/djutils/draw/line/PolyLine3d.java DJUTILS - Drawing and animation primitives 549
public static PolyLine2d concatenate(final double tolerance, final PolyLine2d... lines) throws DrawRuntimeException
    {
        if (0 == lines.length)
        {
            throw new DrawRuntimeException("Empty argument list");
        }
        else if (1 == lines.length)
        {
            return lines[0];
        }
        int size = lines[0].size();
        for (int i = 1; i < lines.length; i++)
        {
            if (lines[i - 1].getLast().distance(lines[i].getFirst()) > tolerance)
            {
                throw new DrawRuntimeException(
                        "Lines are not connected: " + lines[i - 1].getLast() + " to " + lines[i].getFirst() + " distance is "
                                + lines[i - 1].getLast().distance(lines[i].getFirst()) + " > " + tolerance);
            }
            size += lines[i].size() - 1;
        }
File Project Line
org/djutils/data/json/JsonData.java DJUTILS sampling / output data storage 247
org/djutils/data/xml/XmlData.java DJUTILS sampling / output data storage 264
Table table;
            Consumer<Object[]> unserializableTable;
            if (tableProperties[2].equals(ListTable.class.getName()))
            {
                ListTable listTable = new ListTable(tableProperties[0], tableProperties[1], columns);
                table = listTable;
                unserializableTable = (
                        data
                ) -> listTable.addRow(data);
            }
            else
            {
                // fallback
                ListTable listTable = new ListTable(tableProperties[0], tableProperties[1], columns);
                table = listTable;
                unserializableTable = (
                        data
                ) -> listTable.addRow(data);
            }

            // obtain the serializers
            TextSerializer<?>[] serializers = new TextSerializer[table.getNumberOfColumns()];
            for (int i = 0; i < table.getNumberOfColumns(); i++)
            {
                serializers[i] = TextSerializer.resolve(columns.get(i).getValueType());
            }
File Project Line
org/djutils/serialization/TypedMessage.java DJUTILS serialization of data structures 1145
org/djutils/serialization/TypedMessage.java DJUTILS serialization of data structures 1221
Serializer[] serializers = buildEncoderList(false, objectArray);
                    result += serializers.length;
                    for (int i = 0; i < objectArray.length; i++)
                    {
                        result += objects.length * serializers[i].size(objectArray[i]);
                    }
                    return result;
                }

                @SuppressWarnings({"unchecked", "rawtypes"})
                @Override
                public void serialize(final SerializableObject<?>[] objects, final byte[] buffer, final Pointer pointer,
                        final EndianUtil endianUtil) throws SerializationException
                {
                    SerializableObject<?> so = objects[0];
                    Object[] objectArray = so.exportAsList().toArray();
                    endianUtil.encodeInt(objects.length, buffer, pointer.getAndIncrement(4));
                    endianUtil.encodeInt(objectArray.length, buffer, pointer.getAndIncrement(4));
                    Serializer[] serializers = buildEncoderList(false, objectArray);
File Project Line
org/djutils/draw/line/PolyLine2d.java DJUTILS - Drawing and animation primitives 696
org/djutils/draw/line/PolyLine3d.java DJUTILS - Drawing and animation primitives 724
point.y - (this.y[index - 1] + fraction * (this.y[index] - this.y[index - 1])));
            if (distance < bestDistanceExtended && (fraction >= 0.0 && fraction <= 1.0 || (fraction < 0.0 && index == 1)
                    || fraction > 1.0 && index == this.size() - 1))
            {
                bestDistanceExtended = distance;
            }
            if (distance < bestDistance && (fraction >= 0.0 || index == 1 && limitHandling != null && !limitHandling)
                    && (fraction <= 1.0 || index == this.size() - 1 && limitHandling != null && !limitHandling))
            {
                bestDistance = distance;
                result = lengthAtIndex(index - 1) + fraction * (lengthAtIndex(index) - lengthAtIndex(index - 1));
            }
            else if (fraction < 0.0 && limitHandling != null && limitHandling)
            {
                distance = Math.hypot(point.x - this.x[index - 1], point.y - this.y[index - 1]);
File Project Line
org/djutils/serialization/serializers/ArrayOrMatrixWithUnitSerializer.java DJUTILS serialization of data structures 55
org/djutils/serialization/serializers/ObjectWithUnitSerializer.java DJUTILS serialization of data structures 28
}

    /**
     * Code a unit, including MoneyUnits.
     * @param unit U; the unit to code in the byte array
     * @param message byte[]; the byte array
     * @param pointer Pointer; the start pointer in the byte array
     * @param endianUtil EndianUtil; encoder to use for multi-byte values
     */
    protected void encodeUnit(final U unit, final byte[] message, final Pointer pointer, final EndianUtil endianUtil)
    {
        SerializationUnits unitType = SerializationUnits.getUnitType(unit);
        message[pointer.getAndIncrement(1)] = unitType.getCode();
        DisplayType displayType = DisplayType.getDisplayType(unit);
        message[pointer.getAndIncrement(1)] = displayType.getByteCode();
    }

    /**
     * Retrieve and decode a DJUNITS unit.
     * @param buffer byte[]; the encoded data
     * @param pointer Pointer; position in the encoded data where the unit is to be decoded from
     * @param endianUtil EndianUtil; decoder for multi-byte values
     * @return Unit
     */
    @SuppressWarnings("unchecked")
    protected U getUnit(final byte[] buffer, final Pointer pointer, final EndianUtil endianUtil)
    {
        SerializationUnits unitType = SerializationUnits.getUnitType(buffer[pointer.getAndIncrement(1)]);
        DisplayType displayType = DisplayType.getDisplayType(unitType, 0 + buffer[pointer.getAndIncrement(1)]);
        return (U) displayType.getDjunitsType();
    }

}
File Project Line
org/djutils/serialization/EndianUtil.java DJUTILS serialization of data structures 260
org/djutils/serialization/EndianUtil.java DJUTILS serialization of data structures 290
message[p++] = (byte) ((v >> 24) & 0xFF);
            message[p++] = (byte) ((v >> 16) & 0xFF);
            message[p++] = (byte) ((v >> 8) & 0xFF);
            message[p++] = (byte) (v & 0xFF);
        }
        else
        {
            message[p++] = (byte) (v & 0xFF);
            message[p++] = (byte) ((v >> 8) & 0xFF);
            message[p++] = (byte) ((v >> 16) & 0xFF);
            message[p++] = (byte) ((v >> 24) & 0xFF);
File Project Line
org/djutils/draw/line/PolyLine2d.java DJUTILS - Drawing and animation primitives 466
org/djutils/draw/line/PolyLine3d.java DJUTILS - Drawing and animation primitives 464
Point2d currentPoint = get(index);
            if (null != prevPoint && prevPoint.distance(currentPoint) < noiseLevel)
            {
                if (index == this.size() - 1)
                {
                    if (list.size() > 1)
                    {
                        // Replace the last point of the result by the last point of this PolyLine2d
                        list.set(list.size() - 1, currentPoint);
                    }
                    else
                    {
                        // Append the last point of this even though it is close to the first point than the noise value to
                        // comply with the requirement that first and last point of this are ALWAYS included in the result.
                        list.add(currentPoint);
                    }
                }
                continue; // Do not replace prevPoint by currentPoint
            }
            list.add(currentPoint);
            prevPoint = currentPoint;
        }
        if (list.size() == this.x.length)
        {
            return this;
        }
        if (list.size() == 2 && list.get(0).equals(list.get(1)))
        {
            // Insert point 1 of this; it MUST be different from point 0; so we don't have to test for anything.
            list.add(1, get(1));
        }
        return new PolyLine2d(list);
File Project Line
org/djutils/serialization/TypedMessage.java DJUTILS serialization of data structures 667
org/djutils/serialization/TypedMessage.java DJUTILS serialization of data structures 1051
public void serialize(final byte[][] matrix, final byte[] buffer, final Pointer pointer,
                        final EndianUtil endianUtil) throws SerializationException
                {
                    int height = matrix.length;
                    int width = matrix[0].length;
                    endianUtil.encodeInt(height, buffer, pointer.getAndIncrement(4));
                    endianUtil.encodeInt(width, buffer, pointer.getAndIncrement(4));
                    for (int i = 0; i < height; i++)
                    {
                        Throw.when(matrix[i].length != width, SerializationException.class, "Jagged matrix is not allowed");
                        for (int j = 0; j < width; j++)
                        {
                            buffer[pointer.getAndIncrement(getElementSize())] = matrix[i][j];
File Project Line
org/djutils/serialization/TypedMessage.java DJUTILS serialization of data structures 667
org/djutils/serialization/TypedMessage.java DJUTILS serialization of data structures 731
org/djutils/serialization/TypedMessage.java DJUTILS serialization of data structures 795
org/djutils/serialization/TypedMessage.java DJUTILS serialization of data structures 859
org/djutils/serialization/TypedMessage.java DJUTILS serialization of data structures 923
org/djutils/serialization/TypedMessage.java DJUTILS serialization of data structures 987
org/djutils/serialization/TypedMessage.java DJUTILS serialization of data structures 1051
public void serialize(final byte[][] matrix, final byte[] buffer, final Pointer pointer,
                        final EndianUtil endianUtil) throws SerializationException
                {
                    int height = matrix.length;
                    int width = matrix[0].length;
                    endianUtil.encodeInt(height, buffer, pointer.getAndIncrement(4));
                    endianUtil.encodeInt(width, buffer, pointer.getAndIncrement(4));
                    for (int i = 0; i < height; i++)
                    {
                        Throw.when(matrix[i].length != width, SerializationException.class, "Jagged matrix is not allowed");
                        for (int j = 0; j < width; j++)
                        {
File Project Line
org/djutils/serialization/SerialDataDecoder.java DJUTILS serialization of data structures 265
org/djutils/serialization/SerialDataDecoder.java DJUTILS serialization of data structures 346
if (this.currentSerializer.getNumberOfDimensions() > 0 && 0 == this.rowCount)
                {
                    this.columnCount = this.endianUtil.decodeInt(this.dataElementBytes, 0);
                    this.currentRow = 0;
                    this.currentColumn = 0;
                    if (this.dataElementBytes.length == 8)
                    {
                        this.rowCount = this.columnCount;
                        this.columnCount = this.endianUtil.decodeInt(this.dataElementBytes, 4);
                        this.buffer.append(String.format("height %d, width %d", this.rowCount, this.columnCount));
                    }
                    else
                    {
                        this.rowCount = 1;
                        this.buffer.append(String.format("length %d", this.columnCount));
                    }
File Project Line
org/djutils/draw/line/PolyLine2d.java DJUTILS - Drawing and animation primitives 677
org/djutils/draw/line/PolyLine3d.java DJUTILS - Drawing and animation primitives 703
result = new Ray2d(getLocation(0.0)).projectOrthogonalFractionalExtended(point);
            if (null == limitHandling)
            {
                return result == 0.0 ? 0.0 : Double.NaN;
            }
            // limitHandling is false
            if (result == 0.0)
            {
                return 0.0;
            }
            return result > 0 ? Double.POSITIVE_INFINITY : Double.NEGATIVE_INFINITY;
        }
        double bestDistance = Double.POSITIVE_INFINITY;
        double bestDistanceExtended = Double.POSITIVE_INFINITY;
        for (int index = 1; index < this.size(); index++)
        {
            double fraction = point.fractionalPositionOnLine(this.x[index - 1], this.y[index - 1], this.x[index], this.y[index],
File Project Line
org/djutils/stats/summarizers/event/EventBasedCounter.java DJUTILS statistical and data storage utilities 47
org/djutils/stats/summarizers/event/EventBasedTimestampWeightedTally.java DJUTILS statistical and data storage utilities 52
org/djutils/stats/summarizers/event/EventBasedWeightedTally.java DJUTILS statistical and data storage utilities 49
public EventBasedCounter(final String description, final EventProducer eventProducer)
    {
        super(description);
        Throw.whenNull(eventProducer, "eventProducer cannot be null");
        this.eventProducer = eventProducer;
    }

    @Override
    public EventListenerMap getEventListenerMap() throws RemoteException
    {
        return this.eventProducer.getEventListenerMap();
    }

    @Override
    public void initialize()
    {
        super.initialize();
        if (this.eventProducer != null)
        {
            try
            {
                this.eventProducer.fireEvent(StatisticsEvents.INITIALIZED_EVENT);
            }
            catch (RemoteException exception)
            {
                throw new RuntimeException(exception);
            }
        }
    }

    @Override
    public void notify(final Event event)
    {
File Project Line
org/djutils/data/json/JsonData.java DJUTILS sampling / output data storage 222
org/djutils/data/xml/XmlData.java DJUTILS sampling / output data storage 240
if (Integer.valueOf(columnProperties[0]).intValue() != index)
                {
                    throw new IOException("column nr not ok");
                }
                String type = columnProperties[3];
                Class<?> valueClass = Primitive.forName(type);
                if (valueClass == null)
                {
                    try
                    {
                        valueClass = Class.forName(type);
                    }
                    catch (ClassNotFoundException exception)
                    {
                        throw new IOException("Could not find class " + type, exception);
                    }
                }
                Column<?> column = new Column<>(columnProperties[1], columnProperties[2], valueClass, columnProperties[4]);
File Project Line
org/djutils/draw/line/PolyLine2d.java DJUTILS - Drawing and animation primitives 811
org/djutils/draw/line/PolyLine3d.java DJUTILS - Drawing and animation primitives 840
Point2d toPoint = get(index);
            segmentLength = fromPoint.distance(toPoint);
            cumulativeLength = nextCumulativeLength;
            nextCumulativeLength = cumulativeLength + segmentLength;
            if (nextCumulativeLength >= start)
            {
                break;
            }
        }
        if (start == nextCumulativeLength)
        {
            pointList.add(get(index));
        }
        else
        {
            pointList.add(get(index - 1).interpolate(get(index), (start - cumulativeLength) / segmentLength));
            if (end > nextCumulativeLength)
            {
                pointList.add(get(index));
            }
        }
        while (end > nextCumulativeLength)
        {
File Project Line
org/djutils/draw/line/Polygon2d.java DJUTILS - Drawing and animation primitives 149
org/djutils/draw/line/Polygon3d.java DJUTILS - Drawing and animation primitives 170
if (firstPoint.x == lastPoint.x && firstPoint.y == lastPoint.y)
        {
            if (doNotModifyList)
            {
                result = new ArrayList<>(points.size() - 1);
                for (int i = 0; i < points.size() - 1; i++)
                {
                    result.add(points.get(i));
                }
            }
            else
            {
                result.remove(points.size() - 1);
            }
            lastPoint = result.get(result.size() - 1);
        }
        Throw.when(firstPoint.x == lastPoint.x && firstPoint.y == lastPoint.y, DrawRuntimeException.class,