@Override public Expression clone() { return new AsBooleanExpression(condition.clone()); }
@Override public Expression clone() { return new AsBooleanExpression(condition.clone()); }
@Override public Expression clone() { TemplateBuilder tb = new TemplateBuilder(); for (Expression e : parts) { tb.parts.add(e.clone()); } return tb; }
@Override public Expression clone() { TemplateBuilder tb = new TemplateBuilder(); for (Expression e : parts) { tb.parts.add(e.clone()); } return tb; }
@Override public UserFunction clone() { String[] args = null; if (argsNames != null) { args = new String[argsNames.length]; System.arraycopy(argsNames, 0, args, 0, args.length); } if (eh == null) { return new UserFunction(name, exp, args); } else { return new UserFunction(name, eh.clone(), args); } }
@Override public UserFunction clone() { String[] args = null; if (argsNames != null) { args = new String[argsNames.length]; System.arraycopy(argsNames, 0, args, 0, args.length); } if (eh == null) { return new UserFunction(name, exp, args); } else { return new UserFunction(name, eh.clone(), args); } }
@Override public Function clone() { Expression[] args = null; if (this.args != null) { args = new Expression[this.args.length]; for (int i = 0; i < args.length; i++) { args[i] = this.args[i].clone(); } } if (constructor != null) { return new Function(constructor, args); } if (field != null) { return new Function(thatObject, field, safeNavigation); } if (fieldName != null) { return new Function(thatObject, fieldName, safeNavigation); } if (method != null) { return new Function(thatObject.clone(), method, args, safeNavigation); } return new Function(thatObject.clone(), methodName, args, safeNavigation); }
@Override public Function clone() { Expression[] args = null; if (this.args != null) { args = new Expression[this.args.length]; for (int i = 0; i < args.length; i++) { args[i] = this.args[i].clone(); } } if (constructor != null) { return new Function(constructor, args); } if (field != null) { return new Function(thatObject, field, safeNavigation); } if (fieldName != null) { return new Function(thatObject, fieldName, safeNavigation); } if (method != null) { return new Function(thatObject.clone(), method, args, safeNavigation); } return new Function(thatObject.clone(), methodName, args, safeNavigation); }
@Test public void testClone() throws Exception { String exp = "1+\"ololo\".substring(2)"; Expression eh = EvalTools.prepare(exp); Object ob1 = eh.get(null); Object ob2 = eh.get(null); assertTrue(ob1 == ob2); eh = eh.clone(); Object ob3 = eh.get(null); assertTrue(ob1 != ob3); assertTrue(ob1.equals(ob3)); }