mirror of
				https://github.com/inf112-v20/Fiasko.git
				synced 2025-11-04 03:33:45 +01:00 
			
		
		
		
	Auto reformaterer alle klasser og tester for objektegenskaper
This commit is contained in:
		@@ -4,37 +4,31 @@ package inf112.fiasko.roborally.elementproperties;
 | 
				
			|||||||
 * This enum represents all possible directions for an element on the board
 | 
					 * This enum represents all possible directions for an element on the board
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
public enum Direction {
 | 
					public enum Direction {
 | 
				
			||||||
    NORTH (1),
 | 
					    NORTH(1),
 | 
				
			||||||
    NORTH_EAST (2),
 | 
					    NORTH_EAST(2),
 | 
				
			||||||
    EAST (3),
 | 
					    EAST(3),
 | 
				
			||||||
    SOUTH_EAST (4),
 | 
					    SOUTH_EAST(4),
 | 
				
			||||||
    SOUTH (5),
 | 
					    SOUTH(5),
 | 
				
			||||||
    SOUTH_WEST (6),
 | 
					    SOUTH_WEST(6),
 | 
				
			||||||
    WEST (7),
 | 
					    WEST(7),
 | 
				
			||||||
    NORTH_WEST (8);
 | 
					    NORTH_WEST(8);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private final int directionID;
 | 
					    private final int directionID;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Constructor to let a direction to be represented by a numerical identifier
 | 
					     * Constructor to let a direction to be represented by a numerical identifier
 | 
				
			||||||
     * @param directionID <p>The numerical identifier assigned to the direction</p>
 | 
					     *
 | 
				
			||||||
 | 
					     * @param directionID The numerical identifier assigned to the direction
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    Direction(int directionID) {
 | 
					    Direction(int directionID) {
 | 
				
			||||||
        this.directionID = directionID;
 | 
					        this.directionID = directionID;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * Gets the numerical identifier used for alternate identification of a direction
 | 
					 | 
				
			||||||
     * @return <p>The numerical id of the direction</p>
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    public int getDirectionID() {
 | 
					 | 
				
			||||||
        return this.directionID;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Gets a direction from its numerical id
 | 
					     * Gets a direction from its numerical id
 | 
				
			||||||
     * @param directionID <p>The numerical representation of a direction</p>
 | 
					     *
 | 
				
			||||||
     * @return <p>The enum value representing the direction, or null if the id is invalid</p>
 | 
					     * @param directionID The numerical representation of a direction
 | 
				
			||||||
 | 
					     * @return The enum value representing the direction, or null if the id is invalid
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public static Direction getDirectionFromID(int directionID) {
 | 
					    public static Direction getDirectionFromID(int directionID) {
 | 
				
			||||||
        for (Direction direction : Direction.values()) {
 | 
					        for (Direction direction : Direction.values()) {
 | 
				
			||||||
@@ -47,6 +41,7 @@ public enum Direction {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Checks whether two directions are perpendicular
 | 
					     * Checks whether two directions are perpendicular
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
     * @param direction1 The first direction
 | 
					     * @param direction1 The first direction
 | 
				
			||||||
     * @param direction2 The second direction
 | 
					     * @param direction2 The second direction
 | 
				
			||||||
     * @return True if the directions are perpendicular
 | 
					     * @return True if the directions are perpendicular
 | 
				
			||||||
@@ -58,6 +53,7 @@ public enum Direction {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Gets the reverse of a direction
 | 
					     * Gets the reverse of a direction
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
     * @param direction A direction
 | 
					     * @param direction A direction
 | 
				
			||||||
     * @return The reverse direction
 | 
					     * @return The reverse direction
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
@@ -68,7 +64,7 @@ public enum Direction {
 | 
				
			|||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Gets the direction if something rotated to the left
 | 
					     * Gets the direction if something rotated to the left
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
     * A rotation is assumed to be a ninety degrees rotation, so NORTH would become WEST and so on.
 | 
					     * <p>A rotation is assumed to be a ninety degrees rotation, so NORTH would become WEST and so on.</p>
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
     * @param direction A direction
 | 
					     * @param direction A direction
 | 
				
			||||||
     * @return The left rotated direction
 | 
					     * @return The left rotated direction
 | 
				
			||||||
@@ -80,7 +76,7 @@ public enum Direction {
 | 
				
			|||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Gets the direction if something rotated to the right
 | 
					     * Gets the direction if something rotated to the right
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
     * A rotation is assumed to be a ninety degrees rotation, so NORTH would become EAST and so on.
 | 
					     * <p>A rotation is assumed to be a ninety degrees rotation, so NORTH would become EAST and so on.</p>
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
     * @param direction A direction
 | 
					     * @param direction A direction
 | 
				
			||||||
     * @return The left rotated direction
 | 
					     * @return The left rotated direction
 | 
				
			||||||
@@ -88,4 +84,13 @@ public enum Direction {
 | 
				
			|||||||
    public static Direction getRightRotatedDirection(Direction direction) {
 | 
					    public static Direction getRightRotatedDirection(Direction direction) {
 | 
				
			||||||
        return getDirectionFromID((((direction.getDirectionID() + 1) % 8) + 1));
 | 
					        return getDirectionFromID((((direction.getDirectionID() + 1) % 8) + 1));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Gets the numerical identifier used for alternate identification of a direction
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @return The numerical id of the direction
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public int getDirectionID() {
 | 
				
			||||||
 | 
					        return this.directionID;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -1,33 +1,27 @@
 | 
				
			|||||||
package inf112.fiasko.roborally.elementproperties;
 | 
					package inf112.fiasko.roborally.elementproperties;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public enum ParticleType {
 | 
					public enum ParticleType {
 | 
				
			||||||
    LASER_BEAM_SINGLE (1),
 | 
					    LASER_BEAM_SINGLE(1),
 | 
				
			||||||
    LASER_BEAM_DOUBLE (2),
 | 
					    LASER_BEAM_DOUBLE(2),
 | 
				
			||||||
    LASER_BEAM_SINGLE_CROSS (3),
 | 
					    LASER_BEAM_SINGLE_CROSS(3),
 | 
				
			||||||
    LASER_BEAM_DOUBLE_CROSS (4);
 | 
					    LASER_BEAM_DOUBLE_CROSS(4);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private final int particleTypeID;
 | 
					    private final int particleTypeID;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Constructor to let a particle type be represented by a numerical identifier
 | 
					     * Constructor to let a particle type be represented by a numerical identifier
 | 
				
			||||||
     * @param particleTypeID <p>The numerical identifier assigned to the particle type</p>
 | 
					     *
 | 
				
			||||||
 | 
					     * @param particleTypeID The numerical identifier assigned to the particle type
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    ParticleType(int particleTypeID) {
 | 
					    ParticleType(int particleTypeID) {
 | 
				
			||||||
        this.particleTypeID = particleTypeID;
 | 
					        this.particleTypeID = particleTypeID;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * Gets the numerical id used for alternate identification of a tile type
 | 
					 | 
				
			||||||
     * @return <p>The numerical id of the tile type</p>
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    public int getParticleTypeID() {
 | 
					 | 
				
			||||||
        return this.particleTypeID;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Gets a particle type value from its numerical representation
 | 
					     * Gets a particle type value from its numerical representation
 | 
				
			||||||
     * @param particleTypeID <p>The numerical representation of a particle type</p>
 | 
					     *
 | 
				
			||||||
     * @return <p>The enum value representing the particle type, or null if the id is invalid</p>
 | 
					     * @param particleTypeID The numerical representation of a particle type
 | 
				
			||||||
 | 
					     * @return The enum value representing the particle type, or null if the id is invalid
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public static ParticleType getParticleTypeFromID(int particleTypeID) {
 | 
					    public static ParticleType getParticleTypeFromID(int particleTypeID) {
 | 
				
			||||||
        for (ParticleType type : ParticleType.values()) {
 | 
					        for (ParticleType type : ParticleType.values()) {
 | 
				
			||||||
@@ -37,4 +31,13 @@ public enum ParticleType {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
        return null;
 | 
					        return null;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Gets the numerical id used for alternate identification of a tile type
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @return The numerical id of the tile type
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public int getParticleTypeID() {
 | 
				
			||||||
 | 
					        return this.particleTypeID;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -10,6 +10,7 @@ public class Position {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Initializes the position
 | 
					     * Initializes the position
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
     * @param xCoordinate The x coordinate of the position
 | 
					     * @param xCoordinate The x coordinate of the position
 | 
				
			||||||
     * @param yCoordinate The y coordinate of the position
 | 
					     * @param yCoordinate The y coordinate of the position
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
@@ -20,6 +21,7 @@ public class Position {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Gets the x coordinate of the position
 | 
					     * Gets the x coordinate of the position
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
     * @return The x coordinate of the position
 | 
					     * @return The x coordinate of the position
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public int getXCoordinate() {
 | 
					    public int getXCoordinate() {
 | 
				
			||||||
@@ -28,6 +30,7 @@ public class Position {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Gets the y coordinate of the position
 | 
					     * Gets the y coordinate of the position
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
     * @return The y coordinate of the position
 | 
					     * @return The y coordinate of the position
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public int getYCoordinate() {
 | 
					    public int getYCoordinate() {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,37 +4,31 @@ package inf112.fiasko.roborally.elementproperties;
 | 
				
			|||||||
 * This class represents an id for marking specific robots
 | 
					 * This class represents an id for marking specific robots
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
public enum RobotID {
 | 
					public enum RobotID {
 | 
				
			||||||
    ROBOT_1 (1),
 | 
					    ROBOT_1(1),
 | 
				
			||||||
    ROBOT_2 (2),
 | 
					    ROBOT_2(2),
 | 
				
			||||||
    ROBOT_3 (3),
 | 
					    ROBOT_3(3),
 | 
				
			||||||
    ROBOT_4 (4),
 | 
					    ROBOT_4(4),
 | 
				
			||||||
    ROBOT_5 (5),
 | 
					    ROBOT_5(5),
 | 
				
			||||||
    ROBOT_6 (6),
 | 
					    ROBOT_6(6),
 | 
				
			||||||
    ROBOT_7 (7),
 | 
					    ROBOT_7(7),
 | 
				
			||||||
    ROBOT_8 (8);
 | 
					    ROBOT_8(8);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private final int robotID;
 | 
					    private final int robotID;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Constructor to let a robotID be represented by a numerical identifier
 | 
					     * Constructor to let a robotID be represented by a numerical identifier
 | 
				
			||||||
     * @param robotID <p>The numerical identifier assigned to the robot ID</p>
 | 
					     *
 | 
				
			||||||
 | 
					     * @param robotID The numerical identifier assigned to the robot ID
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    RobotID(int robotID) {
 | 
					    RobotID(int robotID) {
 | 
				
			||||||
        this.robotID = robotID;
 | 
					        this.robotID = robotID;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * Gets the numerical id used for identification of a robot id
 | 
					 | 
				
			||||||
     * @return <p>The numerical id of the robot id</p>
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    public int getRobotIDID() {
 | 
					 | 
				
			||||||
        return this.robotID;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Gets a robot ID value from its numerical representation
 | 
					     * Gets a robot ID value from its numerical representation
 | 
				
			||||||
     * @param robotID <p>The numerical representation of a robot id</p>
 | 
					     *
 | 
				
			||||||
     * @return <p>The enum value representing the robot ID, or null if the id is invalid</p>
 | 
					     * @param robotID The numerical representation of a robot id
 | 
				
			||||||
 | 
					     * @return The enum value representing the robot ID, or null if the id is invalid
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public static RobotID getRobotIDFromID(int robotID) {
 | 
					    public static RobotID getRobotIDFromID(int robotID) {
 | 
				
			||||||
        for (RobotID type : RobotID.values()) {
 | 
					        for (RobotID type : RobotID.values()) {
 | 
				
			||||||
@@ -44,4 +38,13 @@ public enum RobotID {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
        return null;
 | 
					        return null;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Gets the numerical id used for identification of a robot id
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @return The numerical id of the robot id
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public int getRobotIDID() {
 | 
				
			||||||
 | 
					        return this.robotID;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,10 +4,10 @@ package inf112.fiasko.roborally.elementproperties;
 | 
				
			|||||||
 * This enum represents all possible tile types
 | 
					 * This enum represents all possible tile types
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
public enum TileType {
 | 
					public enum TileType {
 | 
				
			||||||
    TILE (1),
 | 
					    TILE(1),
 | 
				
			||||||
    HOLE (2),
 | 
					    HOLE(2),
 | 
				
			||||||
    COGWHEEL_RIGHT (3),
 | 
					    COGWHEEL_RIGHT(3),
 | 
				
			||||||
    COGWHEEL_LEFT (4),
 | 
					    COGWHEEL_LEFT(4),
 | 
				
			||||||
    CONVEYOR_BELT_SLOW(5),
 | 
					    CONVEYOR_BELT_SLOW(5),
 | 
				
			||||||
    CONVEYOR_BELT_SLOW_RIGHT(6),
 | 
					    CONVEYOR_BELT_SLOW_RIGHT(6),
 | 
				
			||||||
    CONVEYOR_BELT_SLOW_LEFT(7),
 | 
					    CONVEYOR_BELT_SLOW_LEFT(7),
 | 
				
			||||||
@@ -20,48 +20,42 @@ public enum TileType {
 | 
				
			|||||||
    CONVEYOR_BELT_FAST_SIDE_ENTRANCES(14),
 | 
					    CONVEYOR_BELT_FAST_SIDE_ENTRANCES(14),
 | 
				
			||||||
    CONVEYOR_BELT_FAST_SIDE_ENTRANCE_LEFT(15),
 | 
					    CONVEYOR_BELT_FAST_SIDE_ENTRANCE_LEFT(15),
 | 
				
			||||||
    CONVEYOR_BELT_FAST_SIDE_ENTRANCE_RIGHT(16),
 | 
					    CONVEYOR_BELT_FAST_SIDE_ENTRANCE_RIGHT(16),
 | 
				
			||||||
    FLAG_1 (17),
 | 
					    FLAG_1(17),
 | 
				
			||||||
    FLAG_2 (18),
 | 
					    FLAG_2(18),
 | 
				
			||||||
    FLAG_3 (19),
 | 
					    FLAG_3(19),
 | 
				
			||||||
    FLAG_4 (20),
 | 
					    FLAG_4(20),
 | 
				
			||||||
    WRENCH (21),
 | 
					    WRENCH(21),
 | 
				
			||||||
    WRENCH_AND_HAMMER (22),
 | 
					    WRENCH_AND_HAMMER(22),
 | 
				
			||||||
    ROBOT_SPAWN_1 (23),
 | 
					    ROBOT_SPAWN_1(23),
 | 
				
			||||||
    ROBOT_SPAWN_2 (24),
 | 
					    ROBOT_SPAWN_2(24),
 | 
				
			||||||
    ROBOT_SPAWN_3 (25),
 | 
					    ROBOT_SPAWN_3(25),
 | 
				
			||||||
    ROBOT_SPAWN_4 (26),
 | 
					    ROBOT_SPAWN_4(26),
 | 
				
			||||||
    ROBOT_SPAWN_5 (27),
 | 
					    ROBOT_SPAWN_5(27),
 | 
				
			||||||
    ROBOT_SPAWN_6 (28),
 | 
					    ROBOT_SPAWN_6(28),
 | 
				
			||||||
    ROBOT_SPAWN_7 (29),
 | 
					    ROBOT_SPAWN_7(29),
 | 
				
			||||||
    ROBOT_SPAWN_8 (30),
 | 
					    ROBOT_SPAWN_8(30),
 | 
				
			||||||
    PIT_EMPTY (31),
 | 
					    PIT_EMPTY(31),
 | 
				
			||||||
    PIT_FULL (32),
 | 
					    PIT_FULL(32),
 | 
				
			||||||
    PIT_NORMAL (33),
 | 
					    PIT_NORMAL(33),
 | 
				
			||||||
    PIT_CORNER (34),
 | 
					    PIT_CORNER(34),
 | 
				
			||||||
    PIT_U (35);
 | 
					    PIT_U(35);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private final int tileTypeID;
 | 
					    private final int tileTypeID;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Constructor to let a tile type be represented by a numerical identifier
 | 
					     * Constructor to let a tile type be represented by a numerical identifier
 | 
				
			||||||
     * @param tileTypeID <p>The numerical identifier assigned to the tile type</p>
 | 
					     *
 | 
				
			||||||
 | 
					     * @param tileTypeID The numerical identifier assigned to the tile type
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    TileType(int tileTypeID) {
 | 
					    TileType(int tileTypeID) {
 | 
				
			||||||
        this.tileTypeID = tileTypeID;
 | 
					        this.tileTypeID = tileTypeID;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * Gets the numerical id used for alternate identification of a tile type
 | 
					 | 
				
			||||||
     * @return <p>The numerical id of the tile type</p>
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    public int getTileTypeID() {
 | 
					 | 
				
			||||||
        return this.tileTypeID;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Gets a tile type value from its numerical representation
 | 
					     * Gets a tile type value from its numerical representation
 | 
				
			||||||
     * @param tileTypeID <p>The numerical representation of a tile type</p>
 | 
					     *
 | 
				
			||||||
     * @return <p>The enum value representing the tile type, or null if the id is invalid</p>
 | 
					     * @param tileTypeID The numerical representation of a tile type
 | 
				
			||||||
 | 
					     * @return The enum value representing the tile type, or null if the id is invalid
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public static TileType getTileTypeFromID(int tileTypeID) {
 | 
					    public static TileType getTileTypeFromID(int tileTypeID) {
 | 
				
			||||||
        for (TileType type : TileType.values()) {
 | 
					        for (TileType type : TileType.values()) {
 | 
				
			||||||
@@ -71,4 +65,13 @@ public enum TileType {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
        return null;
 | 
					        return null;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Gets the numerical id used for alternate identification of a tile type
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @return The numerical id of the tile type
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public int getTileTypeID() {
 | 
				
			||||||
 | 
					        return this.tileTypeID;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,33 +4,27 @@ package inf112.fiasko.roborally.elementproperties;
 | 
				
			|||||||
 * This enum represents all possible wall types
 | 
					 * This enum represents all possible wall types
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
public enum WallType {
 | 
					public enum WallType {
 | 
				
			||||||
    WALL_NORMAL (1),
 | 
					    WALL_NORMAL(1),
 | 
				
			||||||
    WALL_CORNER (2),
 | 
					    WALL_CORNER(2),
 | 
				
			||||||
    WALL_LASER_SINGLE (3),
 | 
					    WALL_LASER_SINGLE(3),
 | 
				
			||||||
    WALL_LASER_DOUBLE (4);
 | 
					    WALL_LASER_DOUBLE(4);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private final int wallTypeID;
 | 
					    private final int wallTypeID;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Constructor to let a wall type be represented by a numerical identifier
 | 
					     * Constructor to let a wall type be represented by a numerical identifier
 | 
				
			||||||
     * @param wallTypeID <p>The numerical identifier assigned to the wall type</p>
 | 
					     *
 | 
				
			||||||
 | 
					     * @param wallTypeID The numerical identifier assigned to the wall type
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    WallType(int wallTypeID) {
 | 
					    WallType(int wallTypeID) {
 | 
				
			||||||
        this.wallTypeID = wallTypeID;
 | 
					        this.wallTypeID = wallTypeID;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * Gets the numerical id used for alternate identification of a wall type
 | 
					 | 
				
			||||||
     * @return <p>The numerical id of the wall type</p>
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    public int getWallTypeID() {
 | 
					 | 
				
			||||||
        return this.wallTypeID;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Gets a wall type value from its numerical representation
 | 
					     * Gets a wall type value from its numerical representation
 | 
				
			||||||
     * @param wallTypeID <p>The numerical representation of a wall type</p>
 | 
					     *
 | 
				
			||||||
     * @return <p>The enum value representing the wall type, or null if the id is invalid</p>
 | 
					     * @param wallTypeID The numerical representation of a wall type
 | 
				
			||||||
 | 
					     * @return The enum value representing the wall type, or null if the id is invalid
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public static WallType getWallTypeFromID(int wallTypeID) {
 | 
					    public static WallType getWallTypeFromID(int wallTypeID) {
 | 
				
			||||||
        for (WallType type : WallType.values()) {
 | 
					        for (WallType type : WallType.values()) {
 | 
				
			||||||
@@ -40,4 +34,13 @@ public enum WallType {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
        return null;
 | 
					        return null;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Gets the numerical id used for alternate identification of a wall type
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @return The numerical id of the wall type
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public int getWallTypeID() {
 | 
				
			||||||
 | 
					        return this.wallTypeID;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -23,25 +23,34 @@ public class PositionTest {
 | 
				
			|||||||
        testPosition5 = new Position(1, 4);
 | 
					        testPosition5 = new Position(1, 4);
 | 
				
			||||||
        testPosition6 = new Position(3, 3);
 | 
					        testPosition6 = new Position(3, 3);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Test
 | 
					    @Test
 | 
				
			||||||
    public void testGetXPosition() {
 | 
					    public void testGetXPosition() {
 | 
				
			||||||
        assertEquals(3,testPosition1.getXCoordinate());
 | 
					        assertEquals(3, testPosition1.getXCoordinate());
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Test
 | 
					    @Test
 | 
				
			||||||
    public void testGetYPosition() {
 | 
					    public void testGetYPosition() {
 | 
				
			||||||
        assertEquals(4,testPosition1.getYCoordinate());
 | 
					        assertEquals(4, testPosition1.getYCoordinate());
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Test
 | 
					    @Test
 | 
				
			||||||
    public void testSamePositionsAreEqual() { assertEquals(testPosition1, testPosition3);}
 | 
					    public void testSamePositionsAreEqual() {
 | 
				
			||||||
 | 
					        assertEquals(testPosition1, testPosition3);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Test
 | 
					    @Test
 | 
				
			||||||
    public void testDifferentPositionsAreNotEqual() { assertNotEquals(testPosition2, testPosition4);}
 | 
					    public void testDifferentPositionsAreNotEqual() {
 | 
				
			||||||
 | 
					        assertNotEquals(testPosition2, testPosition4);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Test
 | 
					    @Test
 | 
				
			||||||
    public void equalXandDifferentYIsNotEqual() { assertNotEquals(testPosition1, testPosition6);}
 | 
					    public void equalXandDifferentYIsNotEqual() {
 | 
				
			||||||
 | 
					        assertNotEquals(testPosition1, testPosition6);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Test
 | 
					    @Test
 | 
				
			||||||
    public void equalYandDifferentXIsNotEqual() { assertNotEquals(testPosition1, testPosition5);}
 | 
					    public void equalYandDifferentXIsNotEqual() {
 | 
				
			||||||
 | 
					        assertNotEquals(testPosition1, testPosition5);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -45,7 +45,7 @@ public class WallTypeTest {
 | 
				
			|||||||
        assertNull(TileType.getTileTypeFromID(-1));
 | 
					        assertNull(TileType.getTileTypeFromID(-1));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Test (expected = IllegalArgumentException.class)
 | 
					    @Test(expected = IllegalArgumentException.class)
 | 
				
			||||||
    public void invalidWallDirectionThrowsError() {
 | 
					    public void invalidWallDirectionThrowsError() {
 | 
				
			||||||
        new Wall(WallType.WALL_NORMAL, Direction.NORTH_EAST);
 | 
					        new Wall(WallType.WALL_NORMAL, Direction.NORTH_EAST);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user