Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.lang.reflect.Constructor;

import java.lang.reflect.Method;

public class Main {
    private static Class epdControllerClass;
    private static Class epdControllerRegionClass;
    private static Class epdControllerRegionParamsClass;
    private static Class epdControllerWaveClass;
    private static Object[] waveEnums;
    private static Object[] regionEnums;

    public static void enterA2Mode() {
        System.err.println("Orion::enterA2Mode");
        try {

            Constructor RegionParamsConstructor = epdControllerRegionParamsClass.getConstructor(new Class[] {
                    Integer.TYPE, Integer.TYPE, Integer.TYPE, Integer.TYPE, epdControllerWaveClass, Integer.TYPE });

            Object localRegionParams = RegionParamsConstructor
                    .newInstance(new Object[] { 0, 0, 600, 800, waveEnums[2], 16 }); // Wave = DU

            Method epdControllerSetRegionMethod = epdControllerClass.getMethod("setRegion",
                    new Class[] { String.class, epdControllerRegionClass, epdControllerRegionParamsClass });
            epdControllerSetRegionMethod.invoke(null, new Object[] { "Orion", regionEnums[2], localRegionParams });

            Thread.sleep(100L);
            localRegionParams = RegionParamsConstructor
                    .newInstance(new Object[] { 0, 0, 600, 800, waveEnums[3], 14 }); // Wave = A2
            epdControllerSetRegionMethod.invoke(null, new Object[] { "Orion", regionEnums[2], localRegionParams });
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
}