001    package railo.runtime.interpreter.ref.op;
002    
003    import railo.runtime.exp.PageException;
004    import railo.runtime.interpreter.ref.Ref;
005    import railo.runtime.interpreter.ref.RefSupport;
006    import railo.runtime.op.Caster;
007    
008    
009    /**
010     * Plus operation
011     */
012    public final class Negate extends RefSupport implements Ref {
013    
014        private Ref ref;
015    
016        /**
017         * constructor of the class
018         * @param ref
019         */
020        public Negate(Ref ref) {
021            this.ref=ref;
022        }
023    
024        /**
025         * @see railo.runtime.interpreter.ref.Ref#getValue()
026         */
027        public Object getValue() throws PageException {
028            return new Double(-Caster.toDoubleValue(ref.getValue()));
029        }
030    
031        /**
032         * @see railo.runtime.interpreter.ref.Ref#getTypeName()
033         */
034        public String getTypeName() {
035            return "operation";
036        }
037    
038    }