From dea6794c050eb09b39cafcfd3af104fbc4265dcd Mon Sep 17 00:00:00 2001 From: Quinn Date: Wed, 5 Apr 2023 23:31:35 -0500 Subject: [PATCH] Got rid of as many warnings as possible. --- src/Car.java | 4 ++-- src/Processing.java | 2 +- src/SLAM.java | 4 ++-- src/View.java | 7 +++---- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/Car.java b/src/Car.java index 6a53891..b449ecd 100644 --- a/src/Car.java +++ b/src/Car.java @@ -18,12 +18,12 @@ public class Car{ // default constructor Car(PApplet processing){ - this.proc = processing; + proc = processing; slam = new SLAM(proc); } Car(PApplet processing, int xPos, int yPos, int carLength, int carWidth){ - this.proc = processing; + proc = processing; slam = new SLAM(proc); this.pose = new PVector(xPos, yPos); this.carLength = carLength; diff --git a/src/Processing.java b/src/Processing.java index 3084f03..6abbf3f 100644 --- a/src/Processing.java +++ b/src/Processing.java @@ -6,7 +6,7 @@ import java.util.ArrayList; public class Processing extends PApplet { Car car; - ArrayList objects = new ArrayList(); + ArrayList objects = new ArrayList<>(); public static PApplet processing; diff --git a/src/SLAM.java b/src/SLAM.java index 7185753..ec7fa81 100644 --- a/src/SLAM.java +++ b/src/SLAM.java @@ -5,7 +5,7 @@ import java.util.ArrayList; import static processing.core.PApplet.pow; public class SLAM{ - ArrayList points = new ArrayList(); + ArrayList points = new ArrayList<>(); private static PApplet proc; SLAM(PApplet processing){ @@ -33,7 +33,7 @@ class Line{ } /** - * @brief attempt to find the line of best fit for the given points + * attempt to find the line of best fit for the given points * @param points the points to get the line of best for */ Line(PApplet processing, ArrayList points){ diff --git a/src/View.java b/src/View.java index 3ed973a..32375f8 100644 --- a/src/View.java +++ b/src/View.java @@ -67,7 +67,7 @@ public class View{ //gets the point that each ray has collided with public ArrayList getPoints(){ - ArrayList points = new ArrayList(); + ArrayList points = new ArrayList<>(); for(Ray ray : rays){ if(!Objects.equals(ray.getPoint(), new PVector(0, 0) { @@ -102,7 +102,7 @@ class Ray{ //checks to see at what coordinate the ray will collide with an object and sets the ray length to meet that point. public void castRay(ArrayList objects){ this.rayLength = defaultRayLength; - ArrayList distances = new ArrayList(); + ArrayList distances = new ArrayList<>(); //sees what objects it collides with for(Wall object : objects){ float theta1 = angle; @@ -141,8 +141,7 @@ class Ray{ public float getAngle(){return this.angle;} public boolean hasCollided(){ - if(this.defaultRayLength != this.rayLength){return true;} - else{return false;} + return this.defaultRayLength != this.rayLength; } //returns the absolute position of the point