Class ActivityBase<T>

    • Field Detail

      • DEFAULT_DURATION

        public static final Duration DEFAULT_DURATION
      • userObject

        protected T userObject
      • startTime

        protected Instant startTime
      • endTime

        protected Instant endTime
    • Constructor Detail

      • ActivityBase

        public ActivityBase()
        Constructs a new activity. The initial start time will be set to Instant.now() and the end time will be equal to Instant.now() plus the value of DEFAULT_DURATION.
        Since:
        1.0
      • ActivityBase

        public ActivityBase​(String name)
        Constructs a new activity with the given name. The initial start time will be set to Instant.now() and the end time will be equal to Instant.now() plus the value of DEFAULT_DURATION.
        Parameters:
        name - the name of the activity
        Since:
        1.0
      • ActivityBase

        public ActivityBase​(Instant startTime,
                            Instant endTime)
        Constructs a new activity with the start time and end time.
        Parameters:
        startTime - the start time of the activity
        endTime - the end time of the activity
        Since:
        1.0
      • ActivityBase

        public ActivityBase​(String name,
                            Instant startTime,
                            Instant endTime)
        Constructs a new activity with the given name, start time, and end time.
        Parameters:
        name - the name of the activity
        startTime - the start time of the activity
        endTime - the end time of the activity
        Since:
        1.0
    • Method Detail

      • getName

        public String getName()
        Description copied from interface: Activity
        The name of the activity, for example "Flight 3441".
        Specified by:
        getName in interface Activity
        Returns:
        the name of the activity
      • getId

        public String getId()
        Description copied from interface: Activity
        The unique id of the activity.
        Specified by:
        getId in interface Activity
        Returns:
        the unique activity ID
      • setUserObject

        public void setUserObject​(T userObject)
      • getUserObject

        public T getUserObject()
      • getStartTime

        public Instant getStartTime()
        Description copied from interface: Activity
        The start time of the activity.
        Specified by:
        getStartTime in interface Activity
        Returns:
        the activity start time
      • getEndTime

        public Instant getEndTime()
        Description copied from interface: Activity
        The end time of the activity.
        Specified by:
        getEndTime in interface Activity
        Returns:
        the activity end time