001    package railo.runtime.interpreter.ref.literal;
002    
003    import java.math.BigDecimal;
004    
005    import railo.runtime.exp.PageException;
006    import railo.runtime.interpreter.ref.Ref;
007    import railo.runtime.interpreter.ref.util.RefUtil;
008    
009    /**
010     * Literal Number
011     */
012    public final class LBigDecimal implements Ref {
013    
014        public static final LBigDecimal ZERO = new LBigDecimal(BigDecimal.ZERO);
015        public static final LBigDecimal ONE = new LBigDecimal(BigDecimal.ONE);
016        
017        
018        
019            private BigDecimal literal;
020    
021        /**
022         * constructor of the class
023         * @param literal
024         */
025        public LBigDecimal(BigDecimal literal) {
026            this.literal=literal;
027        }
028    
029        /**
030         * constructor of the class
031         * @param literal
032         * @throws PageException 
033         */
034        public LBigDecimal(String literal) throws PageException {
035            this.literal=new BigDecimal(literal);
036        }
037        
038        public BigDecimal getBigDecimal() {
039            return literal;
040        }
041        
042        /**
043         * @see railo.runtime.interpreter.ref.Ref#getValue()
044         */
045        public Object getValue() {
046            return literal;
047        }
048        
049        /**
050         * @see railo.runtime.interpreter.ref.Ref#getCollection()
051         */
052        public Object getCollection() {
053            return getValue();
054        }
055    
056        /**
057         * @see railo.runtime.interpreter.ref.Ref#getTypeName()
058         */
059        public String getTypeName() {
060            return "number";
061        }
062        
063    
064        /**
065         * @see railo.runtime.interpreter.ref.Ref#touchValue()
066         */
067        public Object touchValue() {
068            return getValue();
069        }
070    
071        /**
072         * @see java.lang.Object#toString()
073         */
074        public String toString() {
075            return literal.toString();
076        }
077    
078            /**
079             * @see railo.runtime.interpreter.ref.Ref#eeq(railo.runtime.interpreter.ref.Ref)
080             */
081            public boolean eeq(Ref other) throws PageException {
082                    return RefUtil.eeq(this,other);
083            }
084    }