Package com.atlassian.bamboo.utils
Class Comparators
java.lang.Object
com.atlassian.bamboo.utils.Comparators
-
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull Comparator<String>
static @NotNull com.google.common.collect.Ordering<BambooIdProvider>
static @NotNull com.google.common.collect.Ordering<ImmutablePlan>
Comparator for sorting by enabled/disabled then updated then created dates of branchesstatic @NotNull Comparator<ResultsSummary>
static @NotNull com.google.common.collect.Ordering<ResultStatisticsProvider>
static @NotNull com.google.common.collect.Ordering<DescriptionProvider>
static @NotNull Comparator<LabelCount>
static @NotNull Comparator<LabelCount>
static @NotNull com.google.common.collect.Ordering<com.atlassian.plugin.ModuleDescriptor<?>>
static @NotNull Comparator<NameProvider>
Do not use this for plans unless you know the plans you are sorting are within the same parent (e.g.static @NotNull com.google.common.collect.Ordering<NameProvider>
Not that this order is case sensitive.static @NotNull com.google.common.collect.Ordering<ImmutablePlan>
This method will be slower thangetTopLevelPlanNameProviderCaseInsensitiveOrdering()
so consider using that instead.static @NotNull com.google.common.collect.Ordering<ResultsSummary>
static @NotNull com.google.common.collect.Ordering<PlanResultKey>
static <T extends NameProvider & ProjectIdProvider>
Function<Map<Long,ProjectIdentifier>, Comparator<T>> static @NotNull com.google.common.collect.Ordering<ResultsSummary>
static @NotNull com.google.common.collect.Ordering<ResultsSummary>
static <T extends ImmutableChain>
@NotNull com.google.common.collect.Ordering<T>static @NotNull com.google.common.collect.Ordering<VariableDefinitionContext>
static @NotNull com.google.common.collect.Ordering<VariableDefinition>
static <T extends Comparable<T>>
booleanisGreater
(T o1, T o2) static <T> boolean
isGreater
(T o1, T o2, @NotNull Comparator<T> comparator) static <T> boolean
isGreaterOrEqual
(T o1, T o2, @NotNull Comparator<T> comparator) static <T> boolean
isLesser
(T o1, T o2, @NotNull Comparator<T> comparator) static <T> boolean
isLesserOrEqual
(T o1, T o2, @NotNull Comparator<T> comparator) static int
static <T> @NotNull Comparator<T>
stringPropertyCaseInsensitiveComparator
(@NotNull Class<T> beanClass, @NotNull String propertyName) static <T> @NotNull Comparator<T>
stringPropertyComparator
(@NotNull Class<T> beanClass, @NotNull String propertyName)
-
Method Details
-
getProjectAwareRepositoryComparator
public static <T extends NameProvider & ProjectIdProvider> Function<Map<Long,ProjectIdentifier>, getProjectAwareRepositoryComparator()Comparator<T>> -
getBuildCompletedDateComparator
-
getBuildDateOrdering
@NotNull public static @NotNull com.google.common.collect.Ordering<ResultStatisticsProvider> getBuildDateOrdering() -
getBranchUpdatedDateOrdering
@NotNull public static @NotNull com.google.common.collect.Ordering<ImmutablePlan> getBranchUpdatedDateOrdering()Comparator for sorting by enabled/disabled then updated then created dates of branches -
getDescriptionProviderOrdering
@NotNull public static @NotNull com.google.common.collect.Ordering<DescriptionProvider> getDescriptionProviderOrdering() -
getLabelCountAlphabeticComparator
-
getLabelCountRankComparator
-
getNameProviderOrdering
@NotNull public static @NotNull com.google.common.collect.Ordering<NameProvider> getNameProviderOrdering()Not that this order is case sensitive. If using for UI usegetNameProviderCaseInsensitiveOrdering()
instead -
getTopLevelPlanNameProviderCaseInsensitiveOrdering
@NotNull public static <T extends ImmutableChain> @NotNull com.google.common.collect.Ordering<T> getTopLevelPlanNameProviderCaseInsensitiveOrdering() -
getPlanNameProviderCaseInsensitiveOrdering
@NotNull public static @NotNull com.google.common.collect.Ordering<ImmutablePlan> getPlanNameProviderCaseInsensitiveOrdering()This method will be slower thangetTopLevelPlanNameProviderCaseInsensitiveOrdering()
so consider using that instead.- Returns:
Ordering
object
-
getNameProviderCaseInsensitiveOrdering
Do not use this for plans unless you know the plans you are sorting are within the same parent (e.g. same project, or same chain.) UsegetTopLevelPlanNameProviderCaseInsensitiveOrdering()
orgetPlanNameProviderCaseInsensitiveOrdering()
instead -
stringPropertyComparator
@NotNull public static <T> @NotNull Comparator<T> stringPropertyComparator(@NotNull @NotNull Class<T> beanClass, @NotNull @NotNull String propertyName) -
stringPropertyCaseInsensitiveComparator
@NotNull public static <T> @NotNull Comparator<T> stringPropertyCaseInsensitiveComparator(@NotNull @NotNull Class<T> beanClass, @NotNull @NotNull String propertyName) -
getResultsSummaryNumberOrdering
@NotNull public static @NotNull com.google.common.collect.Ordering<ResultsSummary> getResultsSummaryNumberOrdering() -
getResultsSummaryNameAndNumberComparator
@NotNull public static @NotNull com.google.common.collect.Ordering<ResultsSummary> getResultsSummaryNameAndNumberComparator() -
jobStagePlanNameCaseInsensitiveCompare
-
getApplicationBuildNumberComparator
-
getPlanNameResultOrdering
@NotNull public static @NotNull com.google.common.collect.Ordering<ResultsSummary> getPlanNameResultOrdering() -
getVariableDefinitionContextOrdering
@NotNull public static @NotNull com.google.common.collect.Ordering<VariableDefinitionContext> getVariableDefinitionContextOrdering() -
getVariableDefinitionOrdering
@NotNull public static @NotNull com.google.common.collect.Ordering<VariableDefinition> getVariableDefinitionOrdering() -
getModuleDescriptorNameOrdering
@NotNull public static @NotNull com.google.common.collect.Ordering<com.atlassian.plugin.ModuleDescriptor<?>> getModuleDescriptorNameOrdering() -
getPlanResultKeyOrdering
@NotNull public static @NotNull com.google.common.collect.Ordering<PlanResultKey> getPlanResultKeyOrdering() -
getBambooIdProviderOrdering
@NotNull public static @NotNull com.google.common.collect.Ordering<BambooIdProvider> getBambooIdProviderOrdering() -
isGreater
- Returns:
- true if o1 is greater than o2 according to natural compare order
-
isGreater
public static <T> boolean isGreater(@NotNull T o1, @NotNull T o2, @NotNull @NotNull Comparator<T> comparator) - Returns:
- true if o1 is greater than o2 according to comparator
-
isGreaterOrEqual
public static <T> boolean isGreaterOrEqual(@NotNull T o1, @NotNull T o2, @NotNull @NotNull Comparator<T> comparator) - Returns:
- true if o1 is greater or equal to o2 according to comparator
-
isLesser
public static <T> boolean isLesser(@NotNull T o1, @NotNull T o2, @NotNull @NotNull Comparator<T> comparator) - Returns:
- true if o1 is less than o2 according to comparator
-
isLesserOrEqual
public static <T> boolean isLesserOrEqual(@NotNull T o1, @NotNull T o2, @NotNull @NotNull Comparator<T> comparator) - Returns:
- true if o1 is less or equal to o2 according to comparator
-