//(used for detecting installed machines in plugin.core)
public class Am2900MachineDefinition implements MachineDefinition
{
+ public static final String AM2900_MACHINE_ID = "Am2900";
+
+ @Override
+ public String getId()
+ {
+ return AM2900_MACHINE_ID;
+ }
+
@Override
public Am2900Machine createNew()
{
{
return Am2900MicroInstructionMemoryDefinition.instance;
}
+
}
public interface MachineDefinition
{
+ /**
+ * This returns the MachineDefinitions ID. This must be consistent and coherent with the id in the extension point (Eclipse plugin xml)
+ * providing the definition.
+ *
+ * @return a human readable, unique id representing the specified machine.
+ * @author Christian Femers
+ */
+ String getId();
/**
* Creates a new instance of the machine
if (o instanceof MachineDefinition)
{
System.out.println("Found " + id);
- installedMachines.put(id, (MachineDefinition) o);
+ MachineDefinition md = (MachineDefinition) o;
+ if (Objects.equals(id, md.getId()))
+ installedMachines.put(id, md);
+ else
+ System.err.println("Machine definition ids to not match: " + id + " and " + md.getId());
} else
{
System.err.println("Invalid machine definition: " + o + "(id=" + id + "");