CPD Results

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

Duplications

FileLine
SteeringProperties/PathFollowingProperties.java102
SteeringProperties/StickToPathProperties.java57
        this.projection = values.projection;
    }

    protected void setNewBehaviorType(BehaviorType behaviorType) {
        if (behaviorType.equals(BehaviorType.BASIC)) {
            regulatingForce = 0;
            projection = 5;
        } else if (behaviorType.equals(BehaviorType.ADVANCED)) {
            regulatingForce = 50;
            projection = 5;
        } 
    }

	public int getRepulsiveForce() {
        return repulsiveForce;
    }

    public void setRepulsiveForce(int orderOfTheForce) {
        this.repulsiveForce = orderOfTheForce;
    }


    public int getDistanceFromThePath() {
        return distance;
    }

    public void setDistanceFromThePath(int distanceFromThePath) {
        this.distance = distanceFromThePath;
    }

    public IPathFuture<ILocated> getPath() {
        return path;
    }

    public void setPath(IPathFuture<ILocated> path) {
        this.path = path;
    }

    public Location getTargetLocation() {
        return targetLocation;
    }

    public void setTargetLocation(Location targetLocation) {
        this.targetLocation = targetLocation;
    }

    public double getRegulatingForce() {
        return regulatingForce;
    }

    public void setRegulatingForce(double regulatingForce) {
        this.regulatingForce = regulatingForce;
    }

    public int getProjection() {
        return projection;
    }

    public void setProjection(int projection) {
        this.projection = projection;
    }

    @Override
    public String getSpecialText() {
        String text = "";
        text += "  * Repulsive Force: " + repulsiveForce + "\n";
        text += "  * Target Location: " + targetLocation.toString() + "\n";
        text += "  * Distance: " + distance + "\n";
        text += "  * Regulation: " + regulatingForce + "\n";
        text += "  * Projection: " + projection + "\n";
        return text;
    }

    @Override
    public void setProperties(SteeringProperties newProperties) {
        this.repulsiveForce = ((StickToPathProperties)newProperties).getRepulsiveForce();
FileLine
SteeringStuff/SteeringTools.java25
SteeringStuff/SteeringTools.java60
        dA.normalize();
        dB.normalize();
        if (!dA.equals(dB)) {
            if (dA.x == 0) dA.x = 0.001;
            if (dB.x == 0) dB.x = 0.001;
            if (dA.y == 0) dA.y = 0.001;
            if (dB.y == 0) dB.y = 0.001;
            double tB = ( (sA.y - sB.y) / dB.y ) + ( ( dA.y * (sB.x - sA.x) ) / (dA.x * dB.y) );
            tB = tB / (1 - ((dB.x * dA.y)/(dA.x * dB.y)) );
            double tA = ( sB.x - sA.x + (tB*dB.x) );
            tA = tA / dA.x;
            double pointX = sA.x + tA * dA.x;
            double pointY = sA.y + tA * dA.y;
FileLine
Steerings/WallFollowingSteer.java390
Steerings/WallFollowingSteer.java410
            normal = nrightfront.getHitNormal();
            multiplier = Math.pow(1 - (longSideFrontRayLength - botToHitLocation.length()) / longSideFrontRayLength, orderOfTheForce);
            normal.scale(attractiveForceWeight * multiplier * wallForce);
            nextVelocity.sub((Tuple3d) normal);
            //if (SteeringManager.DEBUG) System.out.println("right-front to "+normal.length());

            //When closer, the bot is pushed away from the wall by another force.
            if (botToHitLocation.length() < shortSideFrontRayLength) {
                shortrays = true;
                multiplier = Math.pow(((shortSideFrontRayLength - botToHitLocation.length()) * 2f / shortSideFrontRayLength), orderOfTheForce);
                normal.normalize();
                normal.scale(repulsiveForceWeight * multiplier * wallForce);
                nextVelocity.add((Tuple3d) normal);
                //if (SteeringManager.DEBUG) System.out.println("right-front from "+normal.length());
            }
        }
        if (sensornFront) {
FileLine
Steerings/WallFollowingSteer.java351
Steerings/WallFollowingSteer.java371
            normal = nright.getHitNormal();
            multiplier = Math.pow(1 - (longSideRayLength - botToHitLocation.length()) / longSideRayLength, orderOfTheForce);
            normal.scale(attractiveForceWeight * multiplier * wallForce);
            nextVelocity.sub((Tuple3d) normal);
            //if (SteeringManager.DEBUG) System.out.println("right to "+normal.length());

            //When closer, the bot is pushed away from the wall by another force.
            if (botToHitLocation.length() < shortSideRayLength) {
                shortrays = true;
                multiplier = Math.pow(((shortSideRayLength - botToHitLocation.length()) * 2f / shortSideRayLength), orderOfTheForce);
                normal.normalize();
                normal.scale(repulsiveForceWeight * multiplier * wallForce);
                nextVelocity.add((Tuple3d) normal);
                //if (SteeringManager.DEBUG) System.out.println("right from "+normal.length());
            }
        }
        if (sensornLeftFront) {
FileLine
SteeringProperties/WallFollowingProperties.java192
Steerings/WallFollowingSteer.java594
        this.orderOfTheForce = ((WallFollowingProperties)newProperties).getOrderOfTheForce();
        this.attractiveForceWeight = ((WallFollowingProperties)newProperties).getAttractiveForceWeight();
        this.repulsiveForceWeight = ((WallFollowingProperties)newProperties).getRepulsiveForceWeight();
        this.concaveEdgesForceWeight = ((WallFollowingProperties)newProperties).getConcaveEdgesForceWeight();
        this.convexEdgesForceWeight = ((WallFollowingProperties)newProperties).getConvexEdgesForceWeight();
        this.justMySide = ((WallFollowingProperties)newProperties).isJustMySide();
        this.specialDetection = ((WallFollowingProperties)newProperties).isSpecialDetection();
        this.frontCollisions = ((WallFollowingProperties)newProperties).isFrontCollisions();
    }

    public WallFollowingProperties getProperties() {
FileLine
SteeringProperties/LeaderFollowingProperties.java247
Steerings/LeaderFollowingSteer.java344
        this.distanceFromTheLeader = ((LeaderFollowingProperties)newProperties).getDistanceFromTheLeader();
        this.forceDistance = ((LeaderFollowingProperties)newProperties).getForceDistance();
        this.myLFtype = ((LeaderFollowingProperties)newProperties).getMyLFtype();
        this.deceleration = ((LeaderFollowingProperties)newProperties).isDeceleration();
        this.angleFromTheLeader = ((LeaderFollowingProperties)newProperties).getAngleFromTheLeader();
        this.velocityMemory = ((LeaderFollowingProperties)newProperties).isVelocityMemory();
        this.sizeOfMemory = ((LeaderFollowingProperties)newProperties).getSizeOfMemory();
        this.circumvention = ((LeaderFollowingProperties)newProperties).isCircumvention();