change switch statements in AlignToScore to an if else chain
[3501/stronghold-2016] / src / org / usfirst / frc / team3501 / robot / commands / AlignToScore.java
index a7774a14ae3b57c93afdf62841227e47ce0c1262..bb3c3cb8c734edbf0c492effc43b7c1274536d62 100755 (executable)
@@ -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));