From 0d4900b66e3664b8ffaee0f5ca380da93437b0ae Mon Sep 17 00:00:00 2001 From: Meryem Esa Date: Sat, 13 Feb 2016 11:02:13 -0800 Subject: [PATCH] change switch statements in AlignToScore to an if else chain --- .../frc/team3501/robot/commands/AlignToScore.java | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/org/usfirst/frc/team3501/robot/commands/AlignToScore.java b/src/org/usfirst/frc/team3501/robot/commands/AlignToScore.java index a7774a14..bb3c3cb8 100755 --- a/src/org/usfirst/frc/team3501/robot/commands/AlignToScore.java +++ b/src/org/usfirst/frc/team3501/robot/commands/AlignToScore.java @@ -62,24 +62,22 @@ public class AlignToScore extends CommandGroup { public AlignToScore(int position) { - switch (position) { + if (position == 1) { - // position 1 is always the low bar - case 1: + // position 1 is always the low bar addSequential(new DriveForDistance(POS1_DIST1, DEFAULT_SPEED)); addSequential(new TurnForAngle(POS1_TURN1)); addSequential(new DriveForDistance(POS1_DIST2, DEFAULT_SPEED)); horizontalDistToGoal = 0; - - case 2: + } else if (position == 2) { addSequential(new DriveForDistance(POS2_DIST1, DEFAULT_SPEED)); addSequential(new TurnForAngle(POS2_TURN1)); addSequential(new DriveForDistance(POS2_DIST2, DEFAULT_SPEED)); horizontalDistToGoal = 0; - case 3: + } else if (position == 3) { addSequential(new DriveForDistance(POS3_DIST1, DEFAULT_SPEED)); addSequential(new TurnForAngle(POS3_TURN1)); @@ -88,7 +86,7 @@ public class AlignToScore extends CommandGroup { addSequential(new DriveForDistance(POS3_DIST3, DEFAULT_SPEED)); horizontalDistToGoal = 0; - case 4: + } else if (position == 4) { addSequential(new DriveForDistance(POS4_DIST1, DEFAULT_SPEED)); addSequential(new TurnForAngle(POS4_TURN1)); @@ -97,7 +95,7 @@ public class AlignToScore extends CommandGroup { addSequential(new DriveForDistance(POS4_DIST3, DEFAULT_SPEED)); horizontalDistToGoal = 0; - case 5: + } else if (position == 5) { addSequential(new DriveForDistance(POS5_DIST1, DEFAULT_SPEED)); addSequential(new TurnForAngle(POS5_TURN1)); -- 2.30.2