Class ActivityBase<T>

java.lang.Object
com.flexganttfx.model.activity.ActivityBase<T>
Type Parameters:
T - the type of an optional user object
All Implemented Interfaces:
Activity
Direct Known Subclasses:
CalendarActivityBase, ChartActivityBase, CompletableActivityBase, HighLowChartActivityBase, MutableActivityBase

public class ActivityBase<T>
extends Object
implements Activity
The base implementation of the Activity interface.
Since:
1.0
  • Field Details

    • DEFAULT_DURATION

      public static final Duration DEFAULT_DURATION
    • name

      protected String name
    • id

      protected String id
    • userObject

      protected T userObject
    • startTime

      protected Instant startTime
    • endTime

      protected Instant endTime
  • Constructor Details

    • 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 Details

    • 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
    • toString

      public String toString()
      Overrides:
      toString in class Object