Class BitwardsSchedule.Rule

java.lang.Object
fi.bitwards.service.BitwardsSchedule.Rule
Enclosing class:
BitwardsSchedule

public static final class BitwardsSchedule.Rule extends Object
Represent a single rule specifying access times on weekday basis.

Example schedule: Monday to Friday from 8:00 to 16:30, Saturday from 9:00 to 15:00, and Sunday from 10:00 to 12:00 would translate to three following rules:

Rule 1: Monday to Friday from 8:00 to 16:30

  • startingWeekday: Calendar.MONDAY
  • endingWeekday: Calendar.FRIDAY
  • startingTime: 480, inclusive (minutes since midnight, i.e., 8:00)
  • endingTime: 990, exclusive (minutes since midnight, i.e., 16:30)

Rule 2: Saturday from 9:00 to 15:00

  • startingWeekday: Calendar.SATURDAY
  • endingWeekday: Calendar.SATURDAY
  • startingTime: 540, inclusive (minutes since midnight, i.e., 9:00)
  • endingTime: 900, exclusive (minutes since midnight, i.e., 15:00)

Rule 3: Sunday from 10:00 to 12:00

  • startingWeekday: Calendar.SUNDAY
  • endingWeekday: Calendar.SUNDAY
  • startingTime: 600, inclusive (minutes since midnight, i.e., 10:00)
  • endingTime: 720, exclusive (minutes since midnight, i.e., 12:00)

Note: An exception day always overrule regular rules.

  • Method Details

    • getName

      public String getName()
      Get the name of the rule.
      Returns:
      the rule name; null is returned if rule has no name.
    • getStartingWeekday

      public int getStartingWeekday()
      Get starting weekday, inclusive (first day of week is Monday).
      Returns:
      the ending weekday in Calendar format (possible values Calendar.MONDAY to Calendar.SUNDAY)
    • getEndingWeekday

      public int getEndingWeekday()
      Get ending weekday, inclusive (first day of week is Monday).
      Returns:
      the ending weekday in Calendar format (possible values Calendar.MONDAY to Calendar.SUNDAY)
    • getStartingTime

      public int getStartingTime()
      Get starting time of day when access is granted, inclusive.
      Returns:
      the start time as minutes since midnight
    • getEndingTime

      public int getEndingTime()
      Get ending time of day when access is granted, exclusive.
      Returns:
      the ending time as minutes since midnight