Class Cluster<A extends Activity>

java.lang.Object
impl.com.flexganttfx.skin.util.Cluster<A>
Type Parameters:
A - the type of the activities

public final class Cluster<A extends Activity>
extends Object
A cluster is a group of activities placed on multiple columns. The activities can overlap each other within the cluster, but not within a single column.
See Also:
Resolver.resolve(List, Predicate)
  • Constructor Details

    • Cluster

      public Cluster()
  • Method Details

    • getColumnCount

      public int getColumnCount()
      Returns the number of columns that are needed by the cluster in order to display all activities without any overlaps. This value is only valid after the resolve(Predicate) method has been called.
      Returns:
      the number of columns inside the cluster
    • add

      public void add​(A activity)
      Adds an activity to the cluster.
      Parameters:
      activity - the activity
    • getActivities

      public List<A> getActivities()
      Returns all activities within the cluster.
      Returns:
      the cluster activities
    • intersects

      public boolean intersects​(A activity)
      Determines if the given activity intersects with the current time bounds of the cluster. The first activity always intersects with the cluster so that the cluster gets initialized.
      Parameters:
      activity - the activity to check
      Returns:
      true if the time bounds of the activity intersect with the time bounds of the cluster
    • resolve

      public Map<A,​Placement<A>> resolve​(Predicate<A> filter)
      Resolves the conflicts within this cluster by placing the activites in different columns. The filter allows the application to ignore some activities when resolving the conflicts.
      Parameters:
      filter - a filter used to ignore some of the activities
      Returns:
      a map structure containing the placement for each activity within the cluster
    • getColumns

      public List<Column<A>> getColumns()
      Returns the list of columns. This list is only valid after the method resolve(Predicate) has been called.
      Returns:
      the list of columns