Package com.storedobject.chart
Class ActivityList
java.lang.Object
com.storedobject.chart.AbstractProject
com.storedobject.chart.ActivityList
Class to represent a list of activities (instances of
ActivityList.Activity).
ActivityChart uses data from this class.
An ActivityList consists of instances of ActivityList.Activity and each ActivityList.Activity belongs to
an ActivityList.ActivityGroup. Instances of ActivityList.Activity can be created via
createActivity(ActivityGroup, String, LocalDateTime, int) or
createActivity(ActivityGroup, String, LocalDateTime, LocalDateTime).
Alternatively, a ActivityList.Activity can be created under an ActivityList.ActivityGroup via
ActivityList.ActivityGroup.createActivity(String, LocalDateTime, int) or
createActivity(ActivityGroup, String, LocalDateTime, LocalDateTime).
- Author:
- Syam
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassRepresents an activity in aActivityList.classRepresents a group ofActivityList.Activitys.classAn abstract base class for the representation of an Activity or Activity Group. -
Constructor Summary
ConstructorsConstructorDescriptionConstructor for a date-based event list.ActivityList(ChronoUnit durationType) Constructor. -
Method Summary
Modifier and TypeMethodDescriptioncreateActivity(ActivityList.ActivityGroup activityGroup, String activityName, LocalDateTime start, int duration) Create and add aActivityList.Activityto theActivityList.createActivity(ActivityList.ActivityGroup activityGroup, String activityName, LocalDateTime start, LocalDateTime end) Create and add aActivityList.Activityto theActivityList.createActivityGroup(String name) Create and add aActivityList.ActivityGroupto theActivityList.voiddelete(ActivityList.Activity... activities) DeleteActivityList.Activitys from theActivityList.voiddelete(ActivityList.ActivityGroup... activityGroups) DeleteActivityList.ActivityGroups from theActivityList.final LocalDateTimegetEnd()Get the project end.getEventGroup(int groupIndex) Get theActivityList.ActivityGroupof thisActivityList.protected final StringgetExtraAxisLabel(AbstractTask activity) Get the extra axis label for the task/activity.protected StringgetExtraAxisLabel(ActivityList.ActivityGroup activityGroup) final intGet the number ofActivityList.Activitybelonging to this group.final intfinal LocalDateTimegetStart()Get the project start.booleanisEmpty()<T> Iterator<T> iterator(BiFunction<AbstractTask, Integer, T> function, Predicate<AbstractTask> activityFilter) Get an iterator of some type derived from each task/activity and its index.final voidsetStart(LocalDateTime start) Set the start of the project.streamActivities(ActivityList.ActivityGroup activityGroup) Get all activities in the given activity group.Get all activity groups of thisActivityList.Methods inherited from class com.storedobject.chart.AbstractProject
encode, getActivityFontSize, getAxisLabel, getDurationType, getExtraFontSize, getGroupFontSize, getLabel, getName, getTaskFontSize, getToday, getTooltipLabel, iterable, max, setActivityFontSize, setExtraFontSize, setGroupFontSize, setName, setStart, setStart, setTaskBandColors, setTaskFontSize, setTimeNow, setTimeNowColor, setToday, setTodayColor, setTodayFormat, setTooltipTimeFormat, stream, trim, trim
-
Constructor Details
-
ActivityList
public ActivityList()Constructor for a date-based event list. -
ActivityList
Constructor.- Parameters:
durationType- Type of duration to be used for thisActivityList. (Note:ChronoUnit.ERASandChronoUnit.FOREVERare not supported and if used, will be considered asChronoUnit.MILLIS).
-
-
Method Details
-
isEmpty
public boolean isEmpty() -
createActivityGroup
Create and add aActivityList.ActivityGroupto theActivityList.- Parameters:
name- Name of the activity group.- Returns:
- Activity group created.
-
createActivity
public ActivityList.Activity createActivity(ActivityList.ActivityGroup activityGroup, String activityName, LocalDateTime start, int duration) Create and add aActivityList.Activityto theActivityList.- Parameters:
activityGroup- Group to which theActivityList.Activityto be added.activityName- Name of theActivityList.Activity.start- Start.duration- Duration of theActivityList.Activity. (Should be grater than 0).- Returns:
- Activity created. (Returns
nullif theActivityList.ActivityGrouppassed doesn't belong to this).
-
createActivity
public ActivityList.Activity createActivity(ActivityList.ActivityGroup activityGroup, String activityName, LocalDateTime start, LocalDateTime end) Create and add aActivityList.Activityto theActivityList.- Parameters:
activityGroup- Group to which theActivityList.Activityto be added.activityName- Name of theActivityList.Activity.start- Start.end- End.- Returns:
- Activity created. (Returns
nullif theActivityList.ActivityGrouppassed doesn't belong to this).
-
delete
DeleteActivityList.ActivityGroups from theActivityList. (AllActivityList.Activitys and dependencies related to these groups will be dropped).- Parameters:
activityGroups-ActivityList.ActivityGroups to delete.
-
delete
DeleteActivityList.Activitys from theActivityList. (All dependencies related to these activities will be dropped).- Parameters:
activities-ActivityList.Activitys to delete.
-
setStart
Description copied from class:AbstractProjectSet the start of the project. Depending on the duration type, one of the "setStart" methods can be used. However, the start value will be appropriately trimmed if you try to set a higher resolution value.- Overrides:
setStartin classAbstractProject- Parameters:
start- Start of the project.
-
getStart
Description copied from class:AbstractProjectGet the project start.- Overrides:
getStartin classAbstractProject- Returns:
- Start date/time.
-
getEnd
Description copied from class:AbstractProjectGet the project end.- Specified by:
getEndin classAbstractProject- Returns:
- End date/time.
-
getRowCount
public final int getRowCount() -
getEventGroup
Get theActivityList.ActivityGroupof thisActivityList.- Parameters:
groupIndex- Index of the activity group to be retrieved.- Returns:
ActivityList.ActivityGroup.
-
getGroupCount
public final int getGroupCount()Get the number ofActivityList.Activitybelonging to this group.- Returns:
- Activity count.
-
streamGroups
Get all activity groups of thisActivityList.Note: Null will be returned if the
ActivityListcontains inconsistencies.- Returns:
- Stream of activity groups.
-
streamActivities
Get all activities in the given activity group.Note: Null will be returned if the
ActivityListcontains inconsistencies.- Parameters:
activityGroup- Activity group.- Returns:
- Stream of
ActivityList.Activitys.
-
iterator
public <T> Iterator<T> iterator(BiFunction<AbstractTask, Integer, T> function, Predicate<AbstractTask> activityFilter) Description copied from class:AbstractProjectGet an iterator of some type derived from each task/activity and its index.- Specified by:
iteratorin classAbstractProject- Type Parameters:
T- Element type of the returning iterator.- Parameters:
function- Function to create desired output instance. (A function that takes the task/activity and the index as the input).activityFilter- Filter to apply while selecting the task/activity. This could be null.- Returns:
- Iterator of the derived instances.
-
getExtraAxisLabel
Description copied from class:AbstractProjectGet the extra axis label for the task/activity. (Will be used for displaying the 2nd line of the axis label).- Specified by:
getExtraAxisLabelin classAbstractProject- Parameters:
activity- Task.- Returns:
- Label.
-
getExtraAxisLabel
-