if (args.length > 0) { <--- args instead of line System.out.println("Processing string " + args[0]); calc = new Expressions(new Scanner(args[0])); } else { System.out.print("Enter the Expression(% to break): "); calc = new Expressions(new Scanner(console.nextLine())); //System.in }
if (line.length > 0) { System.out.println("Processing string " + args[0]); calc = new Expressions(new Scanner(args[0])); } else { System.out.print("Enter the Expression(% to break): "); calc = new Expressions(new Scanner(console.nextLine())); //System.in }
while (!line.isEmpty()) { if (line.equals("%")) { break; } calc = new Expressions(new Scanner(line)); System.out.println("\nInput as prefix expression:"); calc.showPreFix(); System.out.println("Result: " + calc.evaluate()); System.out.println("infix expression:"); calc.showInFix(); System.out.println("..................................................."); System.out.print("Enter the Expression(% to break): "); line = console.nextLine(); }
//if line contains anything other than `%` it causes an infinite loop while (!line.isEmpty()) { if (line.equals("%")) { break; } else { if (args.length > 0) { System.out.println("Processing string " + args[0]); calc = new Expressions(new Scanner(args[0])); } else { System.out.print("Enter the Expression(% to break): "); calc = new Expressions(new Scanner(console.nextLine())); //System.in } System.out.println("\nInput as prefix expression:"); calc.showPreFix(); System.out.println("Result: " + calc.evaluate()); System.out.println("infix expression:"); calc.showInFix(); System.out.println("..................................................."); } }
/** * A convenience method for registering the restrictions from Strings. This * method is primarily intended to be used from Java, not to expose a bean * property for component configuration. Use setRestrictions() for the later. */ public void setRestrictionExpressionStrings(List<String> expressionStrings) { Expressions expressions = new Expressions(); List<ValueExpression> restrictionVEs = new ArrayList<ValueExpression>(expressionStrings.size()); for (String expressionString : expressionStrings) { restrictionVEs.add(expressions.createValueExpression(expressionString)); } setRestrictions(restrictionVEs); }
public static Expressions instance() { if (!Contexts.isApplicationContextActive()) { return new Expressions(); } else { return (Expressions) Component.getInstance(Expressions.class, ScopeType.APPLICATION); } }
protected void initDefaultMessages() { Expressions expressions = new Expressions(); if (createdMessage == null) { createdMessage = expressions.createValueExpression("Successfully created"); } if (updatedMessage == null) { updatedMessage = expressions.createValueExpression("Successfully updated"); } if (deletedMessage == null) { deletedMessage = expressions.createValueExpression("Successfully deleted"); } }