001 package railo.runtime.interpreter.ref.op; 002 003 import railo.runtime.PageContext; 004 import railo.runtime.exp.PageException; 005 import railo.runtime.functions.decision.IsDefined; 006 import railo.runtime.interpreter.ref.Ref; 007 import railo.runtime.interpreter.ref.RefSupport; 008 import railo.runtime.interpreter.ref.literal.LFunctionValue; 009 import railo.runtime.interpreter.ref.var.Variable; 010 011 public class Elvis extends RefSupport implements Ref{ 012 013 private Variable left; 014 private Ref right; 015 016 public Elvis(Variable left, Ref right) { 017 this.left=left; 018 this.right=right; 019 } 020 021 022 @Override 023 public Object getValue(PageContext pc) throws PageException { 024 String[] arr = LFunctionValue.toStringArray(pc, left); 025 return railo.runtime.op.Elvis.operate(pc, arr)?left.getValue(pc):right.getValue(pc); 026 } 027 028 @Override 029 public String getTypeName() { 030 return "operation"; 031 } 032 }