Class NumericFacetComparator
- java.lang.Object
-
- de.hybris.platform.commerceservices.util.AbstractComparator<FacetValue>
-
- de.hybris.platform.acceleratorservices.search.comparators.NumericFacetComparator
-
- All Implemented Interfaces:
java.util.Comparator<FacetValue>
public class NumericFacetComparator extends AbstractComparator<FacetValue>
Compares toFacetValueas numbers Ifpatternis provided then regular expression is used against facet strings to find number to compare.
-
-
Field Summary
-
Fields inherited from class de.hybris.platform.commerceservices.util.AbstractComparator
AFTER, BEFORE, EQUAL
-
-
Constructor Summary
Constructors Constructor Description NumericFacetComparator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected intcompareInstances(FacetValue facet1, FacetValue facet2)Implement method to perform the comparison.protected doublegetNumber(java.lang.String text)protected java.lang.StringgetPattern()protected java.util.regex.PatterngetRegexPattern()protected doubleparseDouble(java.lang.String text)voidsetPattern(java.lang.String numericPattern)-
Methods inherited from class de.hybris.platform.commerceservices.util.AbstractComparator
compare, compareValues, compareValues, compareValues, compareValues, compareValues, instanceEquals
-
-
-
-
Method Detail
-
compareInstances
protected int compareInstances(FacetValue facet1, FacetValue facet2)
Description copied from class:AbstractComparatorImplement method to perform the comparison. The instances passed are different and neither is null.- Specified by:
compareInstancesin classAbstractComparator<FacetValue>- Parameters:
facet1- first instancefacet2- second instance- Returns:
- return one of
AbstractComparator.BEFORE,AbstractComparator.EQUAL, orAbstractComparator.AFTER.
-
getNumber
protected double getNumber(java.lang.String text)
-
parseDouble
protected double parseDouble(java.lang.String text)
-
getPattern
protected java.lang.String getPattern()
-
setPattern
public void setPattern(java.lang.String numericPattern)
-
getRegexPattern
protected java.util.regex.Pattern getRegexPattern()
-
-