Class GanttBlockCluster<T>
java.lang.Object
overit.geocallapp.utilities.ux.ui.container.gantt.data.GanttBlockCluster<T>
- All Implemented Interfaces:
Iterable<GanttBlock<T>>
This class will be used to cluster overlapped
GanttBlocks.
The main idea is to have and object with a
temporal range that grows when a new block is added
to it.
So this object will store the GanttBlocks that
are overlapped (totally or partially) and be able to
say the whole covered time interval.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanadd(GanttBlock<T> block) Method to add a block to the cluster.protected voidexpandToInclude(GanttBlock<T> block) Expand the cluster begin and end dates to include the given blockgetBegin()getEnd()getId()intgetSize()protected booleaniterator()Iteratorto iterate over the clusteredGanttBlocksvoidMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
GanttBlockCluster
public GanttBlockCluster()
-
-
Method Details
-
setId
- Parameters:
id- the id of this cluster
-
getId
- Returns:
- the id of this cluster
-
add
Method to add a block to the cluster. Remember that if the block is not overlapped to the already in blocks, the block will be discarded.- Parameters:
block- theGanttBlockto add- Returns:
- true if the block was added, false if the block was discarded.
-
getBegin
- Returns:
- the begin date of this cluster, calculated as the minimum begin date between the clustered blocks
-
getEnd
- Returns:
- the end date of this cluster, calculated as the maximum end date between the clustered blocks
-
getMiddle
- Returns:
- the
Datein the middle between begin and end of this cluster
-
getBlocks
- Returns:
- an unmodifiable
Collectionwith the blocks clustered in this cluster
-
getSize
public int getSize()- Returns:
- the number of
GanttBlockin this cluster
-
iterator
Iteratorto iterate over the clusteredGanttBlocks -
isBetween
- Parameters:
date- a date to test- Returns:
- true if the given date is between the cluster range dates
-
expandToInclude
Expand the cluster begin and end dates to include the given block- Parameters:
block- theGanttBlockto include
-