CPD Results

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

Duplications

File Line
org/deegree/geometry/standard/points/PointsPoints.java 151
org/deegree/geometry/standard/points/PointsSubsequence.java 123
        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();
    }
}
File Line
org/deegree/geometry/standard/points/PointsArray.java 145
org/deegree/geometry/standard/points/PointsPoints.java 160
org/deegree/geometry/standard/points/PointsSubsequence.java 132
        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() {
File Line
org/deegree/geometry/standard/points/PackedPoints.java 155
org/deegree/geometry/standard/points/PointsArray.java 146
org/deegree/geometry/standard/points/PointsPoints.java 161
org/deegree/geometry/standard/points/PointsSubsequence.java 133
            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];
File Line
org/deegree/geometry/linearization/CurveLinearizer.java 626
org/deegree/geometry/linearization/CurveLinearizer.java 692
    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 } );
File Line
org/deegree/geometry/linearization/CurveLinearizer.java 571
org/deegree/geometry/linearization/CurveLinearizer.java 854
    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 } );
File Line
org/deegree/geometry/standard/points/PointsArray.java 115
org/deegree/geometry/standard/points/PointsList.java 94
    }

    @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 ) {
File Line
org/deegree/geometry/linearization/CurveLinearizer.java 575
org/deegree/geometry/linearization/CurveLinearizer.java 630
org/deegree/geometry/linearization/CurveLinearizer.java 696
org/deegree/geometry/linearization/CurveLinearizer.java 858
        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 } );
File Line
org/deegree/geometry/standard/surfacepatches/DefaultCylinder.java 77
org/deegree/geometry/standard/surfacepatches/DefaultGriddedSurfacePatch.java 77
org/deegree/geometry/standard/surfacepatches/DefaultSphere.java 77
    }

    @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;
    }

}
File Line
org/deegree/geometry/linearization/CurveLinearizer.java 585
org/deegree/geometry/linearization/CurveLinearizer.java 638
        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,
File Line
org/deegree/geometry/standard/points/JTSPoints.java 139
org/deegree/geometry/standard/points/PointsArray.java 115
org/deegree/geometry/standard/points/PointsList.java 94
    }

    @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 ) {