mirror of
https://github.com/sethm/symon.git
synced 2025-01-20 22:32:53 +00:00
allow for selecting the emulated machien type with the "-machine" parameter. The default is the Symon machine model, the Multicomp machine can be selected with "-machine multicomp".
This commit is contained in:
parent
a49c0d40d8
commit
bd2337ae65
@ -39,6 +39,8 @@ import javax.swing.border.EmptyBorder;
|
|||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.event.*;
|
import java.awt.event.*;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
@ -123,8 +125,8 @@ public class Simulator {
|
|||||||
*/
|
*/
|
||||||
private static final String[] STEPS = {"1", "5", "10", "20", "50", "100"};
|
private static final String[] STEPS = {"1", "5", "10", "20", "50", "100"};
|
||||||
|
|
||||||
public Simulator() throws Exception {
|
public Simulator(Class machineClass) throws Exception {
|
||||||
this.machine = new MulticompMachine();
|
this.machine = (Machine) machineClass.getConstructors()[0].newInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -383,12 +385,25 @@ public class Simulator {
|
|||||||
* @param args
|
* @param args
|
||||||
*/
|
*/
|
||||||
public static void main(String args[]) {
|
public static void main(String args[]) {
|
||||||
|
|
||||||
|
Class machineClass = SymonMachine.class;
|
||||||
|
for(int i = 0; i < args.length; ++i) {
|
||||||
|
String arg = args[i].toLowerCase(Locale.ENGLISH);
|
||||||
|
if(arg.equals("-machine") && (i+1) < args.length) {
|
||||||
|
String machine = args[i+1].trim().toLowerCase(Locale.ENGLISH);
|
||||||
|
if(machine.equals("multicomp")) {
|
||||||
|
machineClass = MulticompMachine.class;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
final Class mClass = machineClass;
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
||||||
// Create the main UI window
|
// Create the main UI window
|
||||||
Simulator simulator = new Simulator();
|
Simulator simulator = new Simulator(mClass);
|
||||||
simulator.createAndShowUi();
|
simulator.createAndShowUi();
|
||||||
// Reset the simulator.
|
// Reset the simulator.
|
||||||
simulator.handleReset();
|
simulator.handleReset();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user