package test;

import javax.usb.UsbException;

import usbml4j.DefenseGrid;
import usbml4j.MissileLauncher;

public class TestMissileLauncher {

	public static void main(String[] args) throws UsbException {
		
		// discover all USB missile launchers
		DefenseGrid grid = DefenseGrid.getInstance();
		
		// perform initialization (zeroing) of each missile launcher in parallel
		grid.initializeMissileLaunchers();
		
		// get an array of missile launchers to control
		MissileLauncher[] launchers = grid.getMissileLaunchers();
		
		// test each missile launchers ability to aim up, down, left, right, and fire
		if(launchers.length == 0){
			System.out.println("No USB Missile Launchers could not be found.  Try disconnecting and reconnecting USB devices from port.");
		} else {
			for(int i=0; i<launchers.length; i++){
				MissileLauncher ml = launchers[i];
				int launcherID = i+1;
				System.out.println("[Launcher " + launcherID + "] Vertical Position: " + ml.adjustVerticalPosition(500));
				System.out.println("[Launcher " + launcherID + "] Vertical Position: " + ml.adjustVerticalPosition(-500));
				System.out.println("[Launcher " + launcherID + "] Vertical Position: " + ml.adjustVerticalPosition(0));
				System.out.println("[Launcher " + launcherID + "] Horizontal Position: " + ml.adjustHorizontalPosition(500));
				System.out.println("[Launcher " + launcherID + "] Horizontal Position: " + ml.adjustHorizontalPosition(-500));
				System.out.println("[Launcher " + launcherID + "] Horizontal Position: " + ml.adjustHorizontalPosition(0));
				System.out.println("[Launcher " + launcherID + "] Fired: " + ml.fire());
			}
		}
	}

}

@@ -778,51 +778,55 @@
 %0A%09%09%09
-for(int i=0; i%3Claunchers.length; i++)%7B%0A%09%09%09%09
+int launcherID = 0; // launcher's index%0A%09%09%09for(
 Miss
@@ -840,17 +840,17 @@
 cher ml 
-=
+:
  launche
@@ -855,21 +855,15 @@
 hers
-%5Bi%5D;
+)%7B
 %0A%09%09%09%09
-int 
 laun
@@ -872,14 +872,10 @@
 erID
- = i+1
+++
 ;%0A%09%09

Update TestMissileLauncher.java