Examples of SimpleNumber


Examples of freemarker.template.SimpleNumber

            if (o instanceof NumberModel) {
                NumberModel s = (NumberModel) o;
                return Double.valueOf(s.getAsNumber().doubleValue());
            }
            if (o instanceof SimpleNumber) {
                SimpleNumber s = (SimpleNumber) o;
                return Double.valueOf(s.getAsNumber().doubleValue());
            }
            if (o instanceof SimpleScalar) {
                SimpleScalar s = (SimpleScalar) o;
                return Double.valueOf(s.getAsString());
            }
            return Double.valueOf(o.toString());
        }
        return Double.valueOf(0.00);
    }
View Full Code Here

Examples of freemarker.template.SimpleNumber

            if (o instanceof NumberModel) {
                NumberModel s = (NumberModel) o;
                return s.getAsNumber().intValue();
            }
            if (o instanceof SimpleNumber) {
                SimpleNumber s = (SimpleNumber) o;
                return s.getAsNumber().intValue();
            }
            if (o instanceof SimpleScalar) {
                SimpleScalar s = (SimpleScalar) o;
                return Integer.valueOf(s.getAsString());
            }
            return Integer.valueOf(o.toString());
        }
        return null;
    }
View Full Code Here

Examples of freemarker.template.SimpleNumber

            if (o instanceof NumberModel) {
                NumberModel s = (NumberModel) o;
                return new Double( s.getAsNumber().doubleValue() );
            }
            if (o instanceof SimpleNumber) {
                SimpleNumber s = (SimpleNumber) o;
                return new Double( s.getAsNumber().doubleValue() );
            }
            if (o instanceof SimpleScalar) {
                SimpleScalar s = (SimpleScalar) o;
                return new Double( s.getAsString() );
            }
            return new Double( o.toString() );
        }
        return new Double(0.00);
    }
View Full Code Here

Examples of freemarker.template.SimpleNumber

            if (o instanceof NumberModel) {
                NumberModel s = (NumberModel) o;
                return s.getAsNumber().doubleValue();
            }
            if (o instanceof SimpleNumber) {
                SimpleNumber s = (SimpleNumber) o;
                return s.getAsNumber().doubleValue();
            }
            if (o instanceof SimpleScalar) {
                SimpleScalar s = (SimpleScalar) o;
                return new Double( s.getAsString() );
            }
            return new Double( o.toString() );
        }
        return 0.00;
    }
View Full Code Here

Examples of freemarker.template.SimpleNumber

            if (o instanceof NumberModel) {
                NumberModel s = (NumberModel) o;
                return s.getAsNumber().intValue();
            }
            if (o instanceof SimpleNumber) {
                SimpleNumber s = (SimpleNumber) o;
                return s.getAsNumber().intValue();
            }
            if (o instanceof SimpleScalar) {
                SimpleScalar s = (SimpleScalar) o;
                return new Integer( s.getAsString() );
            }
            return new Integer(o.toString());
        }
        return 0;
    }
View Full Code Here

Examples of freemarker.template.SimpleNumber

            env != null
                ? env.getArithmeticEngine()
                : getTemplate().getArithmeticEngine();
        switch (operator) {
            case TYPE_SUBSTRACTION :
                return new SimpleNumber(ae.subtract(lhoNumber, rhoNumber));
            case TYPE_MULTIPLICATION :
                return new SimpleNumber(ae.multiply(lhoNumber, rhoNumber));
            case TYPE_DIVISION :
                return new SimpleNumber(ae.divide(lhoNumber, rhoNumber));
            case TYPE_MODULO :
                return new SimpleNumber(ae.modulus(lhoNumber, rhoNumber));
            default:
                throw new _MiscTemplateException(this, new Object[] {
                        "Unknown operation: ", new Integer(operator) });
        }
    }
View Full Code Here

Examples of freemarker.template.SimpleNumber

    public NumberLiteral(Number value) {
        this.value = value;
    }
   
    TemplateModel _eval(Environment env) {
        return new SimpleNumber(value);
    }
View Full Code Here

Examples of freemarker.template.SimpleNumber

    }
   
    public TemplateModel get(int index) throws TemplateModelException
    {
        return (TemplateModel) exec(Collections.singletonList(
                new SimpleNumber(new Integer(index))));
    }
View Full Code Here

Examples of freemarker.template.SimpleNumber

    }

    public TemplateModel get(int index) throws TemplateModelException
    {
        return (TemplateModel) exec(Collections.singletonList(
                new SimpleNumber(new Integer(index))));
    }
View Full Code Here

Examples of freemarker.template.SimpleNumber

            }
            if (xresult instanceof XString) {
                return new SimpleScalar(xresult.toString());
            }
            if (xresult instanceof XNumber) {
                return new SimpleNumber(new Double(((XNumber) xresult).num()));
            }
            throw new TemplateModelException("Cannot deal with type: " + xresult.getClass().getName());
        } catch (TransformerException te) {
            throw new TemplateModelException(te);
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.