code cleanup

This commit is contained in:
Andrin Fassbind 2022-03-25 21:55:19 +01:00
parent 00cb917842
commit 77652705dc
4 changed files with 45 additions and 36 deletions

View File

@ -7,5 +7,8 @@ public class InvalidFileFormatException extends Exception {
public InvalidFileFormatException(String errorMessage) { public InvalidFileFormatException(String errorMessage) {
super(errorMessage); super(errorMessage);
} }
public InvalidFileFormatException(){super();}
public InvalidFileFormatException() {
super();
}
} }

View File

@ -7,6 +7,7 @@ public class InvalidTrackFormatException extends Exception {
public InvalidTrackFormatException(String errorMessage) { public InvalidTrackFormatException(String errorMessage) {
super(errorMessage); super(errorMessage);
} }
public InvalidTrackFormatException() { public InvalidTrackFormatException() {
super(); super();
} }

View File

@ -103,6 +103,7 @@ public class PathFinderMoveStrategy implements MoveStrategy{
/** /**
* Constructor of State * Constructor of State
*
* @param position the PositionVector object with coordinates of the Position * @param position the PositionVector object with coordinates of the Position
* @param velocity the PositionVector object with coordinates of the Velocity * @param velocity the PositionVector object with coordinates of the Velocity
*/ */
@ -113,6 +114,7 @@ public class PathFinderMoveStrategy implements MoveStrategy{
/** /**
* Checks if a state has the same Position and the same Velocity * Checks if a state has the same Position and the same Velocity
*
* @param compareState the State object to compare * @param compareState the State object to compare
* @return true if it is equal, false if it is not equal * @return true if it is equal, false if it is not equal
*/ */
@ -136,6 +138,7 @@ public class PathFinderMoveStrategy implements MoveStrategy{
/** /**
* Constructor of PossibleMove * Constructor of PossibleMove
*
* @param previousMove The move which must be executed bevor this move can be executed * @param previousMove The move which must be executed bevor this move can be executed
* @param nextDirection The direction of the move * @param nextDirection The direction of the move
*/ */
@ -149,8 +152,7 @@ public class PathFinderMoveStrategy implements MoveStrategy{
directions.addAll(previousMove.directions); //copy the LIst of Directions from the previousMove directions.addAll(previousMove.directions); //copy the LIst of Directions from the previousMove
startPosition = previousMove.endPosition; //use the endPosition from previousMove as startPosition startPosition = previousMove.endPosition; //use the endPosition from previousMove as startPosition
startVelocity = previousMove.endVelocity; //use the endVelocity from previousMove as startVelocity startVelocity = previousMove.endVelocity; //use the endVelocity from previousMove as startVelocity
} } else { //if there was no previousMove
else { //if there was no previousMove
startPosition = track.getCarPos(carIndex); //use the current Position of the car from track as startPosition startPosition = track.getCarPos(carIndex); //use the current Position of the car from track as startPosition
startVelocity = track.getCar(carIndex).getVelocity(); //use the current Velocity of the car from track as startVelocity startVelocity = track.getCar(carIndex).getVelocity(); //use the current Velocity of the car from track as startVelocity
} }
@ -161,6 +163,7 @@ public class PathFinderMoveStrategy implements MoveStrategy{
/** /**
* check if the finishline is crossed (in correct direction) if this move is executed * check if the finishline is crossed (in correct direction) if this move is executed
*
* @return true if finishline will be crossed * @return true if finishline will be crossed
*/ */
public boolean finished() { public boolean finished() {
@ -169,6 +172,7 @@ public class PathFinderMoveStrategy implements MoveStrategy{
/** /**
* checks if the car will crash or finishline will be crossed in wrong direction if this move is executed * checks if the car will crash or finishline will be crossed in wrong direction if this move is executed
*
* @return true if car will crash * @return true if car will crash
*/ */
public boolean crashed() { public boolean crashed() {
@ -187,6 +191,7 @@ public class PathFinderMoveStrategy implements MoveStrategy{
/** /**
* Checks if the next Move in moveList will crash. If no crash next move in moveList will be executed. * Checks if the next Move in moveList will crash. If no crash next move in moveList will be executed.
* If crash the moveList will be recreated. * If crash the moveList will be recreated.
*
* @return the direction of acceleration which should be executed. * @return the direction of acceleration which should be executed.
*/ */
@Override @Override