From 20cb908e91d74af9b322a79c34457332c9a474b3 Mon Sep 17 00:00:00 2001 From: Meryem Esa Date: Sat, 13 Feb 2016 11:15:38 -0800 Subject: [PATCH] change switch statements in DefaultAutonStrategy to an if else chain --- .../commands/auton/DefaultAutonStrategy.java | 34 ++++++------------- 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/src/org/usfirst/frc/team3501/robot/commands/auton/DefaultAutonStrategy.java b/src/org/usfirst/frc/team3501/robot/commands/auton/DefaultAutonStrategy.java index 4146977d..5b6453dd 100755 --- a/src/org/usfirst/frc/team3501/robot/commands/auton/DefaultAutonStrategy.java +++ b/src/org/usfirst/frc/team3501/robot/commands/auton/DefaultAutonStrategy.java @@ -1,5 +1,6 @@ package org.usfirst.frc.team3501.robot.commands.auton; +import org.usfirst.frc.team3501.robot.Constants; import org.usfirst.frc.team3501.robot.Constants.Defense; import org.usfirst.frc.team3501.robot.commands.shooter.Shoot; @@ -14,48 +15,33 @@ public class DefaultAutonStrategy extends CommandGroup { public DefaultAutonStrategy(int position, Defense defense) { - switch (defense) { - - case PORTCULLIS: - + if (defense == Constants.Defense.PORTCULLIS) addSequential(new LiftPortcullis()); - case SALLY_PORT: - + else if (defense == Constants.Defense.SALLY_PORT) addSequential(new PassSallyPort()); - case ROUGH_TERRAIN: - + else if (defense == Constants.Defense.ROUGH_TERRAIN) addSequential(new PassRoughTerrain()); - case LOW_BAR: - + else if (defense == Constants.Defense.LOW_BAR) addSequential(new PassLowBar()); - case CHEVAL_DE_FRISE: - + else if (defense == Constants.Defense.CHEVAL_DE_FRISE) addSequential(new PassChevalDeFrise()); - case DRAWBRIDGE: - + else if (defense == Constants.Defense.DRAWBRIDGE) addSequential(new PassDrawBridge()); - case MOAT: - + else if (defense == Constants.Defense.MOAT) addSequential(new PassMoat()); - case ROCK_WALL: - + else if (defense == Constants.Defense.ROCK_WALL) addSequential(new PassRockWall()); - case RAMPART: - + else if (defense == Constants.Defense.RAMPART) addSequential(new PassRampart()); - default: - break; - } - addSequential(new AimAndAlign()); addSequential(new Shoot()); -- 2.30.2