Class AbstractVisualSetContainer<VS extends IAbstractChartVisualSet>
java.lang.Object
com.amalgamasimulation.charts.visualsets.containers.AbstractVisualSetContainer<VS>
- Direct Known Subclasses:
BarVisualSetContainer,GanttVisualSetContainer,HeatmapVisualSetContainer,LineVisualSetContainer
Class that represents the container for VisualSets used in the
Chart.- Author:
- Aleksey Kirillov
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected VisualSet.UpdatePolicyprotected List<IVisualSetContainerListener<VS>> protected Comparator<VS> protected Map<VS, WindowSizeDescriptor> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddVisualSet(VS visualSet) Adds a newVisualSetto the container.voidaddVisualSet(VS visualSet, double minWindowSize, double maxWindowSize) Adds a newVisualSetwith conditional visibility to the container.voidaddVisualSet(VS visualSet, ChronoUnit chronoUnit, double minWindowSize, double maxWindowSize) Adds a newVisualSetwith conditional visibility to the container.voidAdds the action to be executed every time the structure of the visualSetContainer is changed.protected abstract voidaddVisualSetInternal(VS visualSet) <V extends VS>
voidaddVisualSets(List<V> visualSets) Adds a new list ofVisualSetto this container.voidclear()Clear allVisualSetfrom this container.booleancontainsVisualSet(VS visualSet) Checks if this container contains given visualSet.Returns the defaultVisualSet.UpdatePolicyi.e.abstract Comparator<VS> Returns the internalvisualSetscomparator i.e.Returns an unmodifiable list of current visualSets, containing in this container.Return the comparator forVisualSet's containing in this container.<V extends VS>
intgetVisualSetsInjectionIndex(List<V> visualSets, V visualSet) Returns the injection index of the given visualSet within the given visualSets list.getWindowSizeDescriptor(VS visualSet) Returns the displayed range settings required to determine the visibility of given VisualSet.protected abstract voidabstract AbstractVisualSetContainer<VS> Creates a new instance ofAbstractVisualSetContainercorresponding to the current container type.protected abstract voidonAfterRemoveVisualSetInternal(VS visualSet) protected abstract voidonBeforeRemoveVisualSetInternal(VS visualSet) protected abstract voidprotected abstract voidvoidremoveVisualSet(VS visualSet) Removes aVisualSetfrom this container.voidRemoves the action to be executed every time the structure of the visualSetContainer is changed.<V extends VS>
voidClear the container and adds the specified list of newvisualSets.<V extends VS>
voidClear the container and adds the specified list of newvisualSets.voidsetDefaultUpdatePolicy(VisualSet.UpdatePolicy defaultUpdatePolicy) Sets the defaultVisualSet.UpdatePolicyi.e.voidsetVisualSetsComparator(Comparator<VS> visualSetsComparator) Sets the comparator forVisualSet's containing in this container.
-
Field Details
-
listeners
-
visualSets
-
sortedVisualSets
-
defaultUpdatePolicy
-
visualSetWindowSizeDescriptorsMap
protected Map<VS extends IAbstractChartVisualSet,WindowSizeDescriptor> visualSetWindowSizeDescriptorsMap -
visualSetsComparator
-
-
Constructor Details
-
AbstractVisualSetContainer
public AbstractVisualSetContainer()
-
-
Method Details
-
addVisualSetInternal
-
onBeforeRemoveVisualSetInternal
-
onAfterRemoveVisualSetInternal
-
invalidateDependencies
protected abstract void invalidateDependencies() -
onVisualSetsChange
protected abstract void onVisualSetsChange() -
onVisualSetsClear
protected abstract void onVisualSetsClear() -
newInstance
Creates a new instance ofAbstractVisualSetContainercorresponding to the current container type.- Returns:
- a new instance of
AbstractVisualSetContainercorresponding to the current container type
-
getInternalVisualSetsComparator
Returns the internalvisualSetscomparator i.e. the function that determines the sorting order ofvisualSets. The internal comparator is applied as last comparator, after all other sorting operations.- Returns:
- the internal
visualSetscomparator
-
setDefaultUpdatePolicy
Sets the defaultVisualSet.UpdatePolicyi.e. a policy of how the visual set is updated. This policy is assigned to all visualSets that do not have their ownVisualSet.UpdatePolicyexplicitly set.- Parameters:
defaultUpdatePolicy- new defaultVisualSet.UpdatePolicy
-
getDefaultUpdatePolicy
Returns the defaultVisualSet.UpdatePolicyi.e. a policy of how the visual set is updated.- Returns:
- the default
VisualSet.UpdatePolicyi.e. a policy of how the visual set is updated
-
getWindowSizeDescriptor
Returns the displayed range settings required to determine the visibility of given VisualSet.- Parameters:
visualSet-VisualSetfor which the displayed range settings are being checked- Returns:
- the displayed range settings required to determine the visibility of given VisualSet
- See Also:
-
addVisualSet
Adds a newVisualSetto the container.- Parameters:
visualSet- newVisualSet
-
addVisualSet
public void addVisualSet(VS visualSet, ChronoUnit chronoUnit, double minWindowSize, double maxWindowSize) Adds a newVisualSetwith conditional visibility to the container. Used in charts with time-relative X-axis.- Parameters:
visualSet- newVisualSetchronoUnit- displayed range time unitsminWindowSize- minimum displayed range size at which the given visualSet is visiblemaxWindowSize- maximum displayed range size at which the given visualSet is visible- See Also:
-
addVisualSet
Adds a newVisualSetwith conditional visibility to the container. Used in charts with numeric X-axis.- Parameters:
visualSet- newVisualSetminWindowSize- minimum displayed range size at which the given visualSet is visiblemaxWindowSize- maximum displayed range size at which the given visualSet is visible- See Also:
-
addVisualSets
Adds a new list ofVisualSetto this container.- Parameters:
visualSets- new list ofVisualSet
-
removeVisualSet
Removes aVisualSetfrom this container.- Parameters:
visualSet- removedVisualSet
-
clear
public void clear()Clear allVisualSetfrom this container. -
reset
Clear the container and adds the specified list of newvisualSets.- Parameters:
visualSetsStream- the specified list of newvisualSets- See Also:
-
reset
Clear the container and adds the specified list of newvisualSets.- Parameters:
visualSets- the specified list of newvisualSets- See Also:
-
containsVisualSet
Checks if this container contains given visualSet.- Parameters:
visualSet-VisualSetfor which the contains is being checked- Returns:
trueif this container contains given visualSet,falseotherwise
-
getVisualSets
Returns an unmodifiable list of current visualSets, containing in this container.- Returns:
- an unmodifiable list of current visualSets, containing in this container
-
getVisualSetsInjectionIndex
Returns the injection index of the given visualSet within the given visualSets list. If the list does not contain the given visualSet, returns -1. -
setVisualSetsComparator
Sets the comparator forVisualSet's containing in this container. The comparator determines the sorting order in which thevisualSetsare located. Affects the Z-order for drawing visuals, the order in which legend objects are placed, and so on.- Parameters:
visualSetsComparator- new comparator forVisualSet's
-
getVisualSetsComparator
Return the comparator forVisualSet's containing in this container.- Returns:
- the comparator for
VisualSet's containing in this container.
-
addVisualSetContainerChangeHandler
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
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
-