class TemporalFunction {

    public static int getDayFromRange(ShardRange range)
    {
        Tuple min = range.getMinTuple();
        Tuple max = range.getMaxTuple();
        checkArgument(getOnlyElement(min.getTypes()).equals(getOnlyElement(max.getTypes())), "type of min and max is not same");

        Type type = getOnlyElement(min.getTypes());
        if (type.equals(DATE)) {
            return (int) getOnlyElement(min.getValues());
        }

        if (type.equals(TIMESTAMP_MILLIS)) {
            long minValue = (long) getOnlyElement(min.getValues());
            long maxValue = (long) getOnlyElement(max.getValues());
            return determineDay(minValue, maxValue);
        }

        throw new IllegalArgumentException("Wrong type for shard range: " + type);
    }

    private  TemporalFunction();

}