Class AbstractVisualSetContainer<VS extends IAbstractChartVisualSet>

java.lang.Object
com.amalgamasimulation.charts.visualsets.containers.AbstractVisualSetContainer<VS>
Direct Known Subclasses:
BarVisualSetContainer, GanttVisualSetContainer, HeatmapVisualSetContainer, LineVisualSetContainer

public abstract class AbstractVisualSetContainer<VS extends IAbstractChartVisualSet> extends Object
Class that represents the container for VisualSets used in the Chart.
Author:
Aleksey Kirillov
  • Field Details

  • Constructor Details

    • AbstractVisualSetContainer

      public AbstractVisualSetContainer()
  • Method Details

    • addVisualSetInternal

      protected abstract void addVisualSetInternal(VS visualSet)
    • onBeforeRemoveVisualSetInternal

      protected abstract void onBeforeRemoveVisualSetInternal(VS visualSet)
    • onAfterRemoveVisualSetInternal

      protected abstract void onAfterRemoveVisualSetInternal(VS visualSet)
    • invalidateDependencies

      protected abstract void invalidateDependencies()
    • onVisualSetsChange

      protected abstract void onVisualSetsChange()
    • onVisualSetsClear

      protected abstract void onVisualSetsClear()
    • newInstance

      public abstract AbstractVisualSetContainer<VS> newInstance()
      Creates a new instance of AbstractVisualSetContainer corresponding to the current container type.
      Returns:
      a new instance of AbstractVisualSetContainer corresponding to the current container type
    • getInternalVisualSetsComparator

      public abstract Comparator<VS> getInternalVisualSetsComparator()
      Returns the internal visualSets comparator i.e. the function that determines the sorting order of visualSets. The internal comparator is applied as last comparator, after all other sorting operations.
      Returns:
      the internal visualSets comparator
    • setDefaultUpdatePolicy

      public void setDefaultUpdatePolicy(VisualSet.UpdatePolicy defaultUpdatePolicy)
      Sets the default VisualSet.UpdatePolicy i.e. a policy of how the visual set is updated. This policy is assigned to all visualSets that do not have their own VisualSet.UpdatePolicy explicitly set.
      Parameters:
      defaultUpdatePolicy - new default VisualSet.UpdatePolicy
    • getDefaultUpdatePolicy

      public VisualSet.UpdatePolicy getDefaultUpdatePolicy()
      Returns the default VisualSet.UpdatePolicy i.e. a policy of how the visual set is updated.
      Returns:
      the default VisualSet.UpdatePolicy i.e. a policy of how the visual set is updated
    • getWindowSizeDescriptor

      public WindowSizeDescriptor getWindowSizeDescriptor(VS visualSet)
      Returns the displayed range settings required to determine the visibility of given VisualSet.
      Parameters:
      visualSet - VisualSet for which the displayed range settings are being checked
      Returns:
      the displayed range settings required to determine the visibility of given VisualSet
      See Also:
    • addVisualSet

      public void addVisualSet(VS visualSet)
      Adds a new VisualSet to the container.
      Parameters:
      visualSet - new VisualSet
    • addVisualSet

      public void addVisualSet(VS visualSet, ChronoUnit chronoUnit, double minWindowSize, double maxWindowSize)
      Adds a new VisualSet with conditional visibility to the container. Used in charts with time-relative X-axis.
      Parameters:
      visualSet - new VisualSet
      chronoUnit - displayed range time units
      minWindowSize - minimum displayed range size at which the given visualSet is visible
      maxWindowSize - maximum displayed range size at which the given visualSet is visible
      See Also:
    • addVisualSet

      public void addVisualSet(VS visualSet, double minWindowSize, double maxWindowSize)
      Adds a new VisualSet with conditional visibility to the container. Used in charts with numeric X-axis.
      Parameters:
      visualSet - new VisualSet
      minWindowSize - minimum displayed range size at which the given visualSet is visible
      maxWindowSize - maximum displayed range size at which the given visualSet is visible
      See Also:
    • addVisualSets

      public <V extends VS> void addVisualSets(List<V> visualSets)
      Adds a new list of VisualSet to this container.
      Parameters:
      visualSets - new list of VisualSet
    • removeVisualSet

      public void removeVisualSet(VS visualSet)
      Removes a VisualSet from this container.
      Parameters:
      visualSet - removed VisualSet
    • clear

      public void clear()
      Clear all VisualSet from this container.
    • reset

      public <V extends VS> void reset(Stream<V> visualSetsStream)
      Clear the container and adds the specified list of new visualSets.
      Parameters:
      visualSetsStream - the specified list of new visualSets
      See Also:
    • reset

      public <V extends VS> void reset(List<V> visualSets)
      Clear the container and adds the specified list of new visualSets.
      Parameters:
      visualSets - the specified list of new visualSets
      See Also:
    • containsVisualSet

      public boolean containsVisualSet(VS visualSet)
      Checks if this container contains given visualSet.
      Parameters:
      visualSet - VisualSet for which the contains is being checked
      Returns:
      true if this container contains given visualSet, false otherwise
    • getVisualSets

      public List<VS> getVisualSets()
      Returns an unmodifiable list of current visualSets, containing in this container.
      Returns:
      an unmodifiable list of current visualSets, containing in this container
    • getVisualSetsInjectionIndex

      public <V extends VS> int getVisualSetsInjectionIndex(List<V> visualSets, V visualSet)
      Returns the injection index of the given visualSet within the given visualSets list. If the list does not contain the given visualSet, returns -1.
      Parameters:
      visualSets - VisualSet's list for which the injection index is being checked
      visualSet - VisualSet for which the injection index is being checked
      Returns:
      the injection index of the given visualSet within the given visualSets list
    • setVisualSetsComparator

      public void setVisualSetsComparator(Comparator<VS> visualSetsComparator)
      Sets the comparator for VisualSet's containing in this container. The comparator determines the sorting order in which the visualSets are located. Affects the Z-order for drawing visuals, the order in which legend objects are placed, and so on.
      Parameters:
      visualSetsComparator - new comparator for VisualSet's
    • getVisualSetsComparator

      public Comparator<VS> getVisualSetsComparator()
      Return the comparator for VisualSet's containing in this container.
      Returns:
      the comparator for VisualSet's containing in this container.
    • addVisualSetContainerChangeHandler

      public void addVisualSetContainerChangeHandler(IVisualSetContainerListener<VS> handler)
      Adds the action to be executed every time the structure of the visualSetContainer is changed. Changing the structure is considered adding or removing visualSets changing their order etc.
      Parameters:
      handler - new container structure change action
    • removeVisualSetContainerChangeHandler

      public void removeVisualSetContainerChangeHandler(IVisualSetContainerListener<VS> handler)
      Removes the action to be executed every time the structure of the visualSetContainer is changed. Changing the structure is considered adding or removing visualSets changing their order etc.
      Parameters:
      handler - removed container structure change action