class DataTypeUtilities {

    public static double toDouble(Object o)
    {
        double value;
        if (o instanceof Number)
        {
            value = ((Number)o).doubleValue();
        }
        else if (o instanceof Date)
        {
            value = ((Date)o).getTime();
        }
        else if (o instanceof TimeSpan)
        {
            value = ((TimeSpan)o).getStart();
        }
        else if (o instanceof String)
        {
            value = Double.parseDouble((String)o);
        }
        else
        {
            throw new IllegalArgumentException(o + " can't be converted to a double");
        }
        return value;
    }

    private  DataTypeUtilities();

}