public void handleSlider(Variable var, String label, double min, double max, double step, double init) { Slider slider = new Slider(var, label, min, max, step, init); graph.addInputVariable(var); graph.addSlider(slider); }
/** * Updates the variable-sets in a graph * @param graph The graph */ public static void updateVariableSets(ControlFlowGraph graph) { UpdateLocalVariableSet visitor = new UpdateLocalVariableSet(); graph.accept(visitor); LinkedList<Variable> iVar = new LinkedList<Variable>(graph.getInputVariables()); LinkedList<Variable> lVar = new LinkedList<Variable>(graph.getLocalVariables()); //clear for (Variable inputVar: iVar) graph.removeInputVariable(inputVar); for (Variable defVar: lVar) graph.removeLocalVariable(defVar); //add for (String inputVar: visitor.inputVariables) graph.addInputVariable(new Variable(inputVar)); for (String defVar: visitor.defined) graph.addLocalVariable(new Variable(defVar)); }
/** * Searches the expression for variable references. If an undeclared reference is found, it is added to the input variables of * the graph. * * @param expression The expression to search in. */ private void findUndeclaredVariables(Expression expression) { UsedVariablesVisitor visitor = new UsedVariablesVisitor(); expression.accept(visitor); for (Variable usedVariable : visitor.getVariables()) { if (!graph.getLocalVariables().contains(usedVariable)) { // in case we have pragmas giving ranges for the variable, add them if (graph.getPragmaMinValue().containsKey(usedVariable.getName())) { usedVariable.setMinValue(graph.getPragmaMinValue().get(usedVariable.getName())); } if (graph.getPragmaMaxValue().containsKey(usedVariable.getName())) { usedVariable.setMaxValue(graph.getPragmaMaxValue().get(usedVariable.getName())); } graph.addInputVariable(usedVariable); } } }
/** * Searches the expression for variable references. If an undeclared reference is found, it is added to the * input variables of the graph. * * @param expression The expression to search in. * @param inMacro */ private void findUndeclaredVariables(Expression expression) { UsedVariablesVisitor visitor = new UsedVariablesVisitor(); expression.accept(visitor); for (Variable usedVariable : visitor.getVariables()) { checkIllegalVariable(usedVariable); if (!graph.getLocalVariables().contains(usedVariable)) { // in case we have pragmas giving ranges for the variable, add them if (graph.getPragmaMinValue().containsKey(usedVariable.getName())) { usedVariable.setMinValue(graph.getPragmaMinValue().get(usedVariable.getName())); } if (graph.getPragmaMaxValue().containsKey(usedVariable.getName())) { usedVariable.setMaxValue(graph.getPragmaMaxValue().get(usedVariable.getName())); } graph.addInputVariable(usedVariable); } } }
/** * Searches the expression for variable references. If an undeclared reference is found, it is added to the * input variables of the graph. * * @param expression The expression to search in. * @param inMacro */ private void findUndeclaredVariables(Expression expression) { UsedVariablesVisitor visitor = new UsedVariablesVisitor(); expression.accept(visitor); for (Variable usedVariable : visitor.getVariables()) { checkIllegalVariable(usedVariable); if (!graph.getLocalVariables().contains(usedVariable)) { // in case we have pragmas giving ranges for the variable, add them if (graph.getPragmaMinValue().containsKey(usedVariable.getName())) { usedVariable.setMinValue(graph.getPragmaMinValue().get(usedVariable.getName())); } if (graph.getPragmaMaxValue().containsKey(usedVariable.getName())) { usedVariable.setMaxValue(graph.getPragmaMaxValue().get(usedVariable.getName())); } graph.addInputVariable(usedVariable); } } }
args.add(new Variable(prefix + "Y")); args.add(new Variable(prefix + "Z")); graph.addInputVariable(new Variable(prefix + "X")); graph.addInputVariable(new Variable(prefix + "Y")); graph.addInputVariable(new Variable(prefix + "Z"));