void setInputParameter(Rule r) { VarTuple vars = (VarTuple) r.getAttrContext().getVariables(); for (int i = 0; i < vars.getNumberOfEntries(); i++) { VarMember var = (VarMember) vars.getMemberAt(i); if (var.isInputParameter()) System.out.println(var.getName() + " is already input parameter of rule: " + r.getName()); else { // this var should be an input parameter var.setInputParameter(true); System.out.println(var.getName() + " is now input parameter of rule: " + r.getName()); } } }
void setPars(Rule r) throws IOException { System.out.println("\n TAKING INPUTS to APPLY Rule: " + r.getName() + "\n"); List<String> list = r.getInputParameterNames(); System.out.println("The parameters for " + r.getName() + " are: " + list); // System.out.println("The parameters values for " + r.getName() + " are: " + // r.getInputParameters()); System.out.println("The parameters values:"); for (int i = 0; i < list.size(); i++) { String pname = list.get(i); VarMember var = (VarMember) ((VarTuple) r.getAttrContext().getVariables()).getMemberAt(pname); if (var.isSet()) System.out.println(pname + " is set to value: " + var.getExprAsText()); else System.out.println(pname + " is not set"); } VarTuple vars = (VarTuple) r.getAttrContext().getVariables(); for (int i = 0; i < vars.getNumberOfEntries(); i++) { VarMember var = (VarMember) vars.getMemberAt(i); if (var.isInputParameter()) { // olga: if (!var.isSet()) { System.out.println( var.getName() + " is already input parameter of rule: " + r.getName()); System.out.println( "\n \n Please Enter the value for input parameter for rule -- " + r.getName() + " --, parameter name -- " + var.getName() + " --: "); Scanner scan = new Scanner(System.in); String value = scan.nextLine(); System.out.println("The given input was: " + value); var.setInputParameter(true); var.setExprAsText(value); // in1.close(); System.out.println(var.getName() + " is now input parameter of rule: " + r.getName()); } else { System.out.println( var.getExprAsText() + " is value of the INPUT parameter: " + var.getName() + " of rule: " + r.getName()); } } } // in.close(); }