net.sourceforge.jiu.color.quantization

Class RGBColorComparator

Implemented Interfaces:
ComparatorInterface, RGBIndex

public class RGBColorComparator
extends java.lang.Object
implements ComparatorInterface, RGBIndex

Compares two RGBColor objects.
Author:
Marco Schmidt

Field Summary

private int
sortOrder

Fields inherited from interface net.sourceforge.jiu.data.RGBIndex

INDEX_BLUE, INDEX_GREEN, INDEX_RED

Constructor Summary

RGBColorComparator(int aSortOrder)

Method Summary

int
compare(Object o1, Object o2)
Compares the two argument objects and returns their relation.
void
setSortOrder(int aSortOrder)
Sets the internal sort order (it is sorted by one of the three RGB components) to the parameter.

Field Details

sortOrder

private int sortOrder

Constructor Details

RGBColorComparator

public RGBColorComparator(int aSortOrder)

Method Details

compare

public int compare(Object o1,
                   Object o2)
Compares the two argument objects and returns their relation. Returns
  • a value < 0 if o1 is smaller than o2,
  • 0 if o1 is equal to o2 and
  • a value > 0 if o1 is greater than o2.
Specified by:
compare in interface ComparatorInterface

setSortOrder

public void setSortOrder(int aSortOrder)
Sets the internal sort order (it is sorted by one of the three RGB components) to the parameter.