Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b634ca8f authored by Jungshik Jang's avatar Jungshik Jang
Browse files

Fix several bugs on timer recoder code.

Change-Id: I331d5c61fa11513584c926fdeea55a5d7adbbad9
parent ae441287
Loading
Loading
Loading
Loading
+11 −11
Original line number Original line Diff line number Diff line
@@ -142,34 +142,34 @@ public class HdmiTimerRecordSources {
    /**
    /**
     * Create {@link Duration} for time value.
     * Create {@link Duration} for time value.
     *
     *
     * @param hour hour in range of [0, 24]
     * @param hour hour in range of [0, 23]
     * @param minute minute in range of [0, 60]
     * @param minute minute in range of [0, 60]
     * @return {@link Duration}
     * @return {@link Duration}
     * @throws IllegalArgumentException if hour or minute is out of range
     * @throws IllegalArgumentException if hour or minute is out of range
     */
     */
    public static Time ofTime(int hour, int minute) {
    public static Time timeOf(int hour, int minute) {
        checkTimeValue(hour, minute);
        checkTimeValue(hour, minute);
        return new Time(hour, minute);
        return new Time(hour, minute);
    }
    }


    private static void checkTimeValue(int hour, int minute) {
    private static void checkTimeValue(int hour, int minute) {
        if (hour < 0 || hour > 24) {
        if (hour < 0 || hour > 23) {
            throw new IllegalArgumentException("Hour should be in rage of [0, 24]:" + hour);
            throw new IllegalArgumentException("Hour should be in rage of [0, 23]:" + hour);
        }
        }
        if (minute < 0 || minute > 60) {
        if (minute < 0 || minute > 59) {
            throw new IllegalArgumentException("Minute should be in rage of [0, 60]:" + minute);
            throw new IllegalArgumentException("Minute should be in rage of [0, 59]:" + minute);
        }
        }
    }
    }


    /**
    /**
     * Create {@link Duration} for duration value.
     * Create {@link Duration} for duration value.
     *
     *
     * @param hour hour in range of [0, 90]
     * @param hour hour in range of [0, 99]
     * @param minute minute in range of [0, 60]
     * @param minute minute in range of [0, 59]
     * @return {@link Duration}
     * @return {@link Duration}
     * @throws IllegalArgumentException if hour or minute is out of range
     * @throws IllegalArgumentException if hour or minute is out of range
     */
     */
    public static Duration ofDuration(int hour, int minute) {
    public static Duration durationOf(int hour, int minute) {
        checkDurationValue(hour, minute);
        checkDurationValue(hour, minute);
        return new Duration(hour, minute);
        return new Duration(hour, minute);
    }
    }
@@ -178,8 +178,8 @@ public class HdmiTimerRecordSources {
        if (hour < 0 || hour > 99) {
        if (hour < 0 || hour > 99) {
            throw new IllegalArgumentException("Hour should be in rage of [0, 99]:" + hour);
            throw new IllegalArgumentException("Hour should be in rage of [0, 99]:" + hour);
        }
        }
        if (minute < 0 || minute > 60) {
        if (minute < 0 || minute > 59) {
            throw new IllegalArgumentException("minute should be in rage of [0, 60]:" + minute);
            throw new IllegalArgumentException("minute should be in rage of [0, 59]:" + minute);
        }
        }
    }
    }