/** * Returns an XML represenation of the given macros in this kernel. * * @param macros * macros * * @return macro construction XML */ public String getMacroXML(ArrayList<Macro> macros) { if (hasMacros()) { return MacroManager.getMacroXML(macros); } return ""; }
/** * 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); } }
/** * 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); } } }
if (kernel.hasMacros()) {
/** * @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); } } }