src/main/java/tinyrtpl/Data.java
public Object toNumber() {
        if (this.type > 4 || this.type < 1) return 0;
        switch (this.type) {
            case 1:
                return (this.vboolean ? 1 : 0); // int
            case 2:
                return this.vint; // int
            case 3:
                return this.vfloat; // double
            case 4:
                try {
                    int vi = Integer.parseInt(this.vstring);
                    return vi;
                } catch (NumberFormatException ex) {
                    try {
                        double vd = Double.parseDouble(this.vstring);
                        return vd;
                    } catch (NumberFormatException ex1) {
                        try {
                            float vf = Float.parseFloat(this.vstring);
                            return new BigDecimal(String.valueOf(vf)).doubleValue();
                        } catch (NumberFormatException ex2) {
                            return 0;
                        }
                    }
                }
        }
        return 0;
    }
/**
     * Return the number value of this instance.
     * @return number value in the Object
     */
Return the number value of this instance.
@return number value in the Object
Return the number value of this instance . @return number value in the Object
public Object toNumber() {
        if (this.type > 4 || this.type < 1) return 0;
        switch (this.type) {
            case 1:
                return (this.vboolean ? 1 : 0); 
            case 2:
                return this.vint; 
            case 3:
                return this.vfloat; 
            case 4:
                try {
                    int vi = Integer.parseInt(this.vstring);
                    return vi;
                } catch (NumberFormatException ex) {
                    try {
                        double vd = Double.parseDouble(this.vstring);
                        return vd;
                    } catch (NumberFormatException ex1) {
                        try {
                            float vf = Float.parseFloat(this.vstring);
                            return new BigDecimal(String.valueOf(vf)).doubleValue();
                        } catch (NumberFormatException ex2) {
                            return 0;
                        }
                    }
                }
        }
        return 0;
    }
public Object toNumber ( ) { if ( this . type > 4 || this . type < 1 ) return 0 ; switch ( this . type ) { case 1 : return ( this . vboolean ? 1 : 0 ) ; case 2 : return this . vint ; case 3 : return this . vfloat ; case 4 : try { int vi = Integer . parseInt ( this . vstring ) ; return vi ; } catch ( NumberFormatException ex ) { try { double vd = Double . parseDouble ( this . vstring ) ; return vd ; } catch ( NumberFormatException ex1 ) { try { float vf = Float . parseFloat ( this . vstring ) ; return new BigDecimal ( String . valueOf ( vf ) ) . doubleValue ( ) ; } catch ( NumberFormatException ex2 ) { return 0 ; } } } } return 0 ; }
Return the number value of this instance.
Return the number value of this instance .
// int // int // double