/** * @return XML for all macros; if there are none, XML header+footer are * returned */ public String getMacroXML() { ArrayList<Macro> macros = kernel.getAllMacros(); return getXMLio().getFullMacroXML(macros); }
/** * Remove macros from command dictionary */ public void removeMacroCommands() { if ((commandDict == null) || (kernel == null) || !kernel.hasMacros()) { return; } ArrayList<Macro> macros = kernel.getAllMacros(); for (int i = 0; i < macros.size(); i++) { String cmdName = macros.get(i).getCommandName(); commandDict.removeEntry(cmdName); } }
/** * @return false if there are no Macros or any change to the standard * behavior has been made with the ExerciseBuilder <br /> * true if there are Macros which can be used for checking * */ private boolean isStandardExercise() { boolean res = true; if (assignments.size() > 0) { res = false; } for (int i = 0; i < assignments.size() && res; i++) { if (assignments.get(i) instanceof GeoAssignment) { res = ((GeoAssignment) assignments.get(i)).getTool() .equals(app.getKernel().getAllMacros().get(i)) && !(assignments.get(i).hasHint() || assignments.get(i).hasFraction() || !((GeoAssignment) assignments.get(i)) .getCheckOperation() .equals("AreEqual")); } else { res = false; } } return res; }
/** * Adds macro commands to the dictionary */ protected void addMacroCommands() { if ((commandDict == null) || (kernel == null) || !kernel.hasMacros()) { return; } ArrayList<Macro> macros = kernel.getAllMacros(); for (int i = 0; i < macros.size(); i++) { String cmdName = macros.get(i).getCommandName(); if (!commandDict.containsValue(cmdName)) { commandDict.addEntry(cmdName); } } }
ArrayList<Macro> macros = kernel.getAllMacros();
/** * @return XML for or macros and/or Exercise or empty string if there are * none */ public String getMacroXMLorEmpty() { if (!kernel.hasMacros() && kernel.getExercise().isEmpty()) { return ""; } ArrayList<Macro> macros = kernel.getAllMacros(); return getXMLio().getFullMacroXML(macros); }
/** * Resets the Exercise and adds all user defined tools to the Exercise. */ public void initStandardExercise() { reset(); GeoElement correct = app.getKernel().lookupLabel("correct"); if (correct instanceof GeoBoolean) { addAssignment((GeoBoolean) correct); } else if (app.getKernel().hasMacros()) { ArrayList<Macro> macros = app.getKernel().getAllMacros(); for (Macro macro : macros) { addAssignment(macro); } } }