Class ColorCountComparator
- java.lang.Object
-
- org.apache.commons.imaging.palette.ColorCountComparator
-
- All Implemented Interfaces:
java.util.Comparator<ColorCount>
public class ColorCountComparator extends java.lang.Object implements java.util.Comparator<ColorCount>
A comparator for {#link ColorCount} elements.It uses a given {#link ColorComponent} to choose what channel must be used for the comparison.
For example, if the comparator is created for the
ColorComponent.REDchannel, then it will compare the value of red of eachColorCountobject in the array of elements.- Since:
- 1.0-alpha2
-
-
Field Summary
Fields Modifier and Type Field Description private ColorComponentcolorComponentColor component used during the comparison.
-
Constructor Summary
Constructors Constructor Description ColorCountComparator(ColorComponent colorComponent)Constructs a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompare(ColorCount c1, ColorCount c2)
-
-
-
Field Detail
-
colorComponent
private final ColorComponent colorComponent
Color component used during the comparison.
-
-
Constructor Detail
-
ColorCountComparator
public ColorCountComparator(ColorComponent colorComponent)
Constructs a new instance.- Parameters:
colorComponent- Color component to wrap.
-
-
Method Detail
-
compare
public int compare(ColorCount c1, ColorCount c2)
- Specified by:
comparein interfacejava.util.Comparator<ColorCount>
-
-