CPD Results

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

Duplications

FileLine
org/deegree/geometry/standard/points/PointsPoints.java151
org/deegree/geometry/standard/points/PointsSubsequence.java123
        return get( 0 );
    }

    // -----------------------------------------------------------------------
    // Implementation of JTS methods
    // -----------------------------------------------------------------------

    @Override
    public Envelope expandEnvelope( Envelope env ) {
        for ( Point p : this ) {
            env.expandToInclude( p.get0(), p.get1() );
        }
        return env;
    }

    @Override
    public Coordinate getCoordinate( int index ) {
        Point point = get( index );
        return new Coordinate( point.get0(), point.get1(), point.get2() );
    }

    @Override
    public void getCoordinate( int index, Coordinate coord ) {
        Point point = get( index );
        coord.x = point.get0();
        coord.y = point.get1();
        coord.z = point.get2();
    }

    @Override
    public Coordinate getCoordinateCopy( int index ) {
        Point point = get( index );
        return new Coordinate( point.get0(), point.get1(), point.get2() );
    }

    @Override
    public double getOrdinate( int index, int ordinateIndex ) {
        return get( index ).get( ordinateIndex );
    }

    @Override
    public double getX( int index ) {
        return get( index ).get0();
    }

    @Override
    public double getY( int index ) {
        return get( index ).get1();
    }

    @Override
    public void setOrdinate( int index, int ordinateIndex, double value ) {
        throw new UnsupportedOperationException();
    }

    @Override
    public Coordinate[] toCoordinateArray() {
        Coordinate[] coords = new Coordinate[size()];
        int i = 0;
        for ( Point p : this ) {
            coords[i++] = new Coordinate( p.get0(), p.get1() );
        }
        return coords;
    }

    @Override
    public Object clone() {
        throw new UnsupportedOperationException();
    }
}
FileLine
org/deegree/geometry/standard/points/PointsArray.java145
org/deegree/geometry/standard/points/PointsPoints.java160
org/deegree/geometry/standard/points/PointsSubsequence.java132
        for ( Point p : points ) {
            env.expandToInclude( p.get0(), p.get1() );
        }
        return env;
    }

    @Override
    public Coordinate getCoordinate( int index ) {
        Point point = get( index );
        return new Coordinate( point.get0(), point.get1(), point.get2() );
    }

    @Override
    public void getCoordinate( int index, Coordinate coord ) {
        Point point = get( index );
        coord.x = point.get0();
        coord.y = point.get1();
        coord.z = point.get2();
    }

    @Override
    public Coordinate getCoordinateCopy( int index ) {
        Point point = get( index );
        return new Coordinate( point.get0(), point.get1(), point.get2() );
    }

    @Override
    public double getOrdinate( int index, int ordinateIndex ) {
        return get( index ).get( ordinateIndex );
    }

    @Override
    public double getX( int index ) {
        return get( index ).get0();
    }

    @Override
    public double getY( int index ) {
        return get( index ).get1();
    }

    @Override
    public void setOrdinate( int index, int ordinateIndex, double value ) {
        throw new UnsupportedOperationException();
    }

    @Override
    public Coordinate[] toCoordinateArray() {
        Coordinate[] coords = new Coordinate[size()];
        int i = 0;
        for ( Point p : this ) {
            coords[i++] = new Coordinate( p.get0(), p.get1() );
        }
        return coords;
    }

    @Override
    public Object clone() {
FileLine
org/deegree/geometry/standard/points/PackedPoints.java155
org/deegree/geometry/standard/points/PointsArray.java146
org/deegree/geometry/standard/points/PointsPoints.java161
org/deegree/geometry/standard/points/PointsSubsequence.java133
            env.expandToInclude( coordinates[i], coordinates[i + 1] );
        }
        return env;
    }

    @Override
    public Coordinate getCoordinate( int index ) {
        Point point = get( index );
        return new Coordinate( point.get0(), point.get1(), point.get2() );
    }

    @Override
    public void getCoordinate( int index, Coordinate coord ) {
        Point point = get( index );
        coord.x = point.get0();
        coord.y = point.get1();
        coord.z = point.get2();
    }

    @Override
    public Coordinate getCoordinateCopy( int index ) {
        Point point = get( index );
        return new Coordinate( point.get0(), point.get1(), point.get2() );
    }

    @Override
    public double getOrdinate( int index, int ordinateIndex ) {
        return get( index ).get( ordinateIndex );
    }

    @Override
    public double getX( int index ) {
        return get( index ).get0();
    }

    @Override
    public double getY( int index ) {
        return get( index ).get1();
    }

    @Override
    public void setOrdinate( int index, int ordinateIndex, double value ) {
        throw new UnsupportedOperationException();
    }

    @Override
    public Coordinate[] toCoordinateArray() {
        Coordinate[] coords = new Coordinate[coordinates.length / dimension];
FileLine
org/deegree/geometry/linearization/CurveLinearizer.java626
org/deegree/geometry/linearization/CurveLinearizer.java692
    private int calcNumPoints( Point p0, Point p1, Point p2, boolean isCircle, double error ) {

        // shift the points down (to reduce the occurrence of floating point errors), independently on the x and y axes
        double minOrd0 = CurveLinearizer.findShiftOrd0( p0, p1, p2 );
        double minOrd1 = CurveLinearizer.findShiftOrd1( p0, p1, p2 );

        // if the points are already shifted, this does no harm!
        Point p0Shifted = new DefaultPoint( null, p0.getCoordinateSystem(), p0.getPrecision(),
                                            new double[] { p0.get0() - minOrd0, p0.get1() - minOrd1 } );
        Point p1Shifted = new DefaultPoint( null, p1.getCoordinateSystem(), p1.getPrecision(),
                                            new double[] { p1.get0() - minOrd0, p1.get1() - minOrd1 } );
        Point p2Shifted = new DefaultPoint( null, p2.getCoordinateSystem(), p2.getPrecision(),
                                            new double[] { p2.get0() - minOrd0, p2.get1() - minOrd1 } );
FileLine
org/deegree/geometry/linearization/CurveLinearizer.java571
org/deegree/geometry/linearization/CurveLinearizer.java854
    private Points interpolate( Point p0, Point p1, Point p2, int numPoints, boolean isCircle ) {

        // shift the points down (to reduce the occurrence of floating point errors), independently on the x and y axes
        double minOrd0 = findShiftOrd0( p0, p1, p2 );
        double minOrd1 = findShiftOrd1( p0, p1, p2 );

        // if the points are already shifted, this does no harm!
        Point p0Shifted = new DefaultPoint( null, p0.getCoordinateSystem(), p0.getPrecision(),
                                            new double[] { p0.get0() - minOrd0, p0.get1() - minOrd1 } );
        Point p1Shifted = new DefaultPoint( null, p1.getCoordinateSystem(), p1.getPrecision(),
                                            new double[] { p1.get0() - minOrd0, p1.get1() - minOrd1 } );
        Point p2Shifted = new DefaultPoint( null, p2.getCoordinateSystem(), p2.getPrecision(),
                                            new double[] { p2.get0() - minOrd0, p2.get1() - minOrd1 } );
FileLine
org/deegree/geometry/standard/points/PointsArray.java115
org/deegree/geometry/standard/points/PointsList.java94
    }

    @Override
    public double[] getAsArray() {
        double[] coords = new double[getDimension() * size()];
        int i = 0;
        for ( Point p : this ) {
            for ( double coord : p.getAsArray() ) {
                coords[i++] = coord;
            }
        }
        return coords;
    }

    @Override
    public Point getEndPoint() {
        return get( size() - 1 );
    }

    @Override
    public Point getStartPoint() {
        return get( 0 );
    }

    // -----------------------------------------------------------------------
    // Implementation of JTS methods
    // -----------------------------------------------------------------------

    @Override
    public Envelope expandEnvelope( Envelope env ) {
        for ( Point p : points ) {
            env.expandToInclude( p.get0(), p.get1() );
        }
        return env;
    }

    @Override
    public Coordinate getCoordinate( int index ) {
FileLine
org/deegree/geometry/linearization/CurveLinearizer.java575
org/deegree/geometry/linearization/CurveLinearizer.java630
org/deegree/geometry/linearization/CurveLinearizer.java696
org/deegree/geometry/linearization/CurveLinearizer.java858
        double minOrd1 = findShiftOrd1( p0, p1, p2 );

        // if the points are already shifted, this does no harm!
        Point p0Shifted = new DefaultPoint( null, p0.getCoordinateSystem(), p0.getPrecision(),
                                            new double[] { p0.get0() - minOrd0, p0.get1() - minOrd1 } );
        Point p1Shifted = new DefaultPoint( null, p1.getCoordinateSystem(), p1.getPrecision(),
                                            new double[] { p1.get0() - minOrd0, p1.get1() - minOrd1 } );
        Point p2Shifted = new DefaultPoint( null, p2.getCoordinateSystem(), p2.getPrecision(),
                                            new double[] { p2.get0() - minOrd0, p2.get1() - minOrd1 } );
FileLine
org/deegree/geometry/standard/surfacepatches/DefaultCylinder.java77
org/deegree/geometry/standard/surfacepatches/DefaultGriddedSurfacePatch.java77
org/deegree/geometry/standard/surfacepatches/DefaultSphere.java77
    }

    @Override
    public int getNumColumns() {
        return grid.get( 0 ).size();
    }

    @Override
    public int getNumRows() {
        return grid.size();
    }

    @Override
    public Points getRow( int rownum ) {
        return grid.get( rownum );
    }

    @Override
    public List<Points> getRows() {
        return grid;
    }

    @Override
    public Measure getArea( Unit requestedBaseUnit ) {
        // TODO
        throw new UnsupportedOperationException();
    }

    @Override
    public int getCoordinateDimension() {
        return grid.get( 0 ).getDimension();
    }

    @Override
    public SurfacePatchType getSurfacePatchType() {
        return SurfacePatchType.GRIDDED_SURFACE_PATCH;
    }

}
FileLine
org/deegree/geometry/linearization/CurveLinearizer.java585
org/deegree/geometry/linearization/CurveLinearizer.java638
        List<Point> interpolationPoints = new ArrayList<Point>( numPoints );
        Point center = calcCircleCenter( p0Shifted, p1Shifted, p2Shifted );

        double centerX = center.get0();
        double centerY = center.get1();

        double dx = p0Shifted.get0() - centerX;
        double dy = p0Shifted.get1() - centerY;
        double ex = p2Shifted.get0() - centerX;
        double ey = p2Shifted.get1() - centerY;

        double startAngle = Math.atan2( dy, dx );
        double endAngle = isCircle ? startAngle : Math.atan2( ey, ex );
        double radius = Math.sqrt( dx * dx + dy * dy );

        double angleStep = createAngleStep( startAngle, endAngle, numPoints,
FileLine
org/deegree/geometry/standard/points/JTSPoints.java139
org/deegree/geometry/standard/points/PointsArray.java115
org/deegree/geometry/standard/points/PointsList.java94
    }

    @Override
    public double[] getAsArray() {
        double[] coords = new double[getDimension() * size()];
        int i = 0;
        for ( Point p : this ) {
            for ( double coord : p.getAsArray() ) {
                coords[i++] = coord;
            }
        }
        return coords;
    }

    @Override
    public Point getEndPoint() {
        return get( size() - 1 );
    }

    @Override
    public Point getStartPoint() {
        return get( 0 );
    }

    // -----------------------------------------------------------------------
    // Implementation of JTS methods
    // -----------------------------------------------------------------------

    @Override
    public Envelope expandEnvelope( Envelope env ) {