/*
 * Copyright 2013 Rackspace
 *
 *    Licensed under the Apache License, Version 2.0 (the "License");
 *    you may not use this file except in compliance with the License.
 *    You may obtain a copy of the License at
 *
 *        http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS,
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *    See the License for the specific language governing permissions and
 *    limitations under the License.
 */

package com.rackspacecloud.blueflood.types;

public class SimpleNumber implements Rollup {
    private int intValue;
    private double doubleValue;
    private long longValue;
    private Type type;

    enum Type {
        INTEGER("I"),
        LONG("L"),
        DOUBLE("D");

        private Type(String rep) {
            typeVal = rep;
        }

        private final String typeVal;
    }

    public SimpleNumber(Object value) {
        if (value instanceof Integer) {
            this.intValue = (Integer) value;
            this.type = Type.INTEGER;
        } else if (value instanceof Long) {
            this.longValue = (Long) value;
            this.type = Type.LONG;
        } else if (value instanceof Double) {
            this.doubleValue = (Double) value;
            this.type = Type.DOUBLE;
        } else {
            throw new IllegalArgumentException("Unexpected argument type " + value.getClass() + ", expected number.");
        }
    }

    public boolean isFloatingPoint() {
        return this.type.equals(Type.DOUBLE);
    }

    public Object getValue() {
        if (type.equals(Type.LONG)) {
            return longValue;
        } else if (type.equals(Type.INTEGER)) {
            return intValue;
        } else {
            return doubleValue;
        }
    }

    public String toString() {
        return getValue().toString();
    }
}

@@ -1957,25 +1957,335 @@
     
-return getValue()
+switch (type) %7B%0A            case INTEGER:%0A                return String.format(%22%25d (int)%22, intValue);%0A            case LONG:%0A                return String.format(%22%25d (long)%22, longValue);%0A            case DOUBLE:%0A                return String.format(%22%25s (double)%22, doubleValue);%0A            default:%0A                return super
 .toS
@@ -2293,16 +2293,26 @@
 ring();%0A
+        %7D%0A
     %7D%0A%7D%0A

fix merge conflict in SimpleNumber