change switch statements in AlignToScore to an if else chain
authorMeryem Esa <meresa14@gmail.com>
Sat, 13 Feb 2016 19:02:13 +0000 (11:02 -0800)
committerKevin Zhang <icestormf1@gmail.com>
Tue, 16 Feb 2016 19:37:02 +0000 (11:37 -0800)
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));