Skip to content

Commit

Permalink
Rename fireTorpedos to fireTorpedo
Browse files Browse the repository at this point in the history
  • Loading branch information
micskeiz committed Apr 10, 2018
1 parent c01a425 commit 709051b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions src/main/java/hu/bme/mit/spaceship/GT4500.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package hu.bme.mit.spaceship;

/**
* A simple spaceship with two proton torpedos and four lasers
* A simple spaceship with two proton torpedo stores and four lasers
*/
public class GT4500 implements SpaceShip {

Expand All @@ -27,14 +27,14 @@ public boolean fireLaser(FiringMode firingMode) {
* SINGLE: fires only one of the bays.
* - For the first time the primary store is fired.
* - To give some cooling time to the torpedo stores, torpedo stores are fired alternating.
* - But if the store next in line is empty the ship tries to fire the other store.
* - But if the store next in line is empty, the ship tries to fire the other store.
* - If the fired store reports a failure, the ship does not try to fire the other one.
* ALL: tries to fire both of the torpedo stores.
*
* @return whether at least one torpedo was fired successfully
*/
@Override
public boolean fireTorpedos(FiringMode firingMode) {
public boolean fireTorpedo(FiringMode firingMode) {

boolean firingSuccess = false;

Expand Down Expand Up @@ -77,7 +77,7 @@ public boolean fireTorpedos(FiringMode firingMode) {
break;

case ALL:
// try to fire both of the torpedos
// try to fire both of the torpedo stores
//TODO implement feature

break;
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/hu/bme/mit/spaceship/SpaceShip.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ public interface SpaceShip {
public boolean fireLaser(FiringMode firingMode);

/**
* Fires the torpedos of the ship
* Fires the torpedo stores of the ship
*
* @param firingMode how many torpedo bays to fire
* @param firingMode how many torpedo stores to fire
* @return whether the fire command was successful
*/
public boolean fireTorpedos(FiringMode firingMode);
public boolean fireTorpedo(FiringMode firingMode);
}
2 changes: 1 addition & 1 deletion src/main/java/hu/bme/mit/spaceship/TorpedoStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import java.util.Random;

/**
* Class storing and managing the torpedos of a ship
* Class storing and managing the torpedoes of a ship
*/
public class TorpedoStore {

Expand Down
8 changes: 4 additions & 4 deletions src/test/java/hu/bme/mit/spaceship/GT4500Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,22 @@ public void init(){
}

@Test
public void fireTorpedos_Single_Success(){
public void fireTorpedo_Single_Success(){
// Arrange

// Act
boolean result = ship.fireTorpedos(FiringMode.SINGLE);
boolean result = ship.fireTorpedo(FiringMode.SINGLE);

// Assert
assertEquals(true, result);
}

@Test
public void fireTorpedos_All_Success(){
public void fireTorpedo_All_Success(){
// Arrange

// Act
boolean result = ship.fireTorpedos(FiringMode.ALL);
boolean result = ship.fireTorpedo(FiringMode.ALL);

// Assert
assertEquals(true, result);
Expand Down

0 comments on commit 709051b

Please sign in to comment.