documents reformatted
This commit is contained in:
@@ -25,7 +25,7 @@ import ModelFiles.XPlaneConnect;
|
||||
public class Main {
|
||||
|
||||
public static void main(String[] args) {
|
||||
//Encapsulation (or lack thereof) Test
|
||||
// Encapsulation (or lack thereof) Test
|
||||
Model m = new Model();
|
||||
MindQueue q = m.getQueue();
|
||||
Action a = new Vision();
|
||||
@@ -34,46 +34,43 @@ public class Main {
|
||||
MindQueue q2 = m.getQueue();
|
||||
System.out.println(q2.pop());
|
||||
|
||||
//Using actions
|
||||
try(XPlaneConnect xpc = new XPlaneConnect()) {
|
||||
Action b = new Vision(10,"sim/cockpit2/gauges/indicators/airspeed_kts_pilot");
|
||||
Action d = new Delay(20);
|
||||
// Using actions
|
||||
try (XPlaneConnect xpc = new XPlaneConnect()) {
|
||||
Action b = new Vision(10, "sim/cockpit2/gauges/indicators/airspeed_kts_pilot");
|
||||
Action d = new Delay(20);
|
||||
// Ensure connection established.
|
||||
m = new Model(xpc);
|
||||
m.activateModel();
|
||||
m.createAction(ActionType.VISION, null, 0, "sim/cockpit2/gauges/indicators/airspeed_kts_pilot");
|
||||
m.createAction(ActionType.MOTOR, MotorType.PITCHUP, 0, null);
|
||||
// m.push(b);
|
||||
// m.push(d);
|
||||
m.printModelQueue();
|
||||
// m.deactivateModel();
|
||||
while(m.isActive() && !m.isEmpty()) {
|
||||
m = new Model(xpc);
|
||||
m.activateModel();
|
||||
m.createAction(ActionType.VISION, null, 0, "sim/cockpit2/gauges/indicators/airspeed_kts_pilot");
|
||||
m.createAction(ActionType.MOTOR, MotorType.PITCHUP, 0, null);
|
||||
// m.push(b);
|
||||
// m.push(d);
|
||||
m.printModelQueue();
|
||||
// m.deactivateModel();
|
||||
while (m.isActive() && !m.isEmpty()) {
|
||||
float[] array = m.next();
|
||||
if(array != null) {
|
||||
if (array != null) {
|
||||
// System.out.println(array[0]);
|
||||
// if(array[0] > 80.0f) {
|
||||
// m.push(d);
|
||||
// m.push(d);
|
||||
// }
|
||||
} else {
|
||||
// System.out.println("no dice");
|
||||
// System.out.println(xpc.getDREF(null)");
|
||||
}
|
||||
if(m.getModelQueueLength() < 5){
|
||||
if (m.getModelQueueLength() < 5) {
|
||||
m.createAction(ActionType.VISION, null, 0, "sim/cockpit2/gauges/indicators/airspeed_kts_pilot");
|
||||
m.createAction(ActionType.MOTOR, MotorType.PITCHUP, 0, null);
|
||||
m.createAction(ActionType.MOTOR, MotorType.PITCHDOWN, 0, null);
|
||||
}
|
||||
|
||||
|
||||
// m.printModelQueue();
|
||||
}
|
||||
}
|
||||
catch (SocketException ex)
|
||||
{
|
||||
} catch (SocketException ex) {
|
||||
System.out.println("Unable to set up the connection. (Error message was '" + ex.getMessage() + "'.)");
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
System.out.println("Something went wrong with one of the commands. (Error message was '" + ex.getMessage() + "'.)");
|
||||
} catch (IOException ex) {
|
||||
System.out.println(
|
||||
"Something went wrong with one of the commands. (Error message was '" + ex.getMessage() + "'.)");
|
||||
}
|
||||
System.out.println("Exiting");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user