// Path: vaadin-grid-util/src/main/java/org/vaadin/gridutil/cell/filter/BetweenFilter.java
// public class BetweenFilter<T extends Comparable<? super T>> implements SerializablePredicate<Comparable<T>> {
//     private final T startValue;
//     private final T endValue;
// 
//     public BetweenFilter(T startValue, T endValue) {
//         this.startValue = startValue;
//         this.endValue = endValue;
//     }
// 
//     @Override
//     public boolean test(Comparable<T> value) {
//         if (value == null) {
//             return startValue == null && endValue == null;
//         }
//         return isAfterStart(value) && isBeforeEnd(value);
//     }
// 
//     private boolean isAfterStart(final Comparable<T> value) {
//         return startValue == null || value.compareTo(startValue) >= 0;
//     }
// 
//     private boolean isBeforeEnd(final Comparable<T> value) {
//         return endValue == null || value.compareTo(endValue) <= 0;
//     }
// 
// }
// 
// Path: vaadin-grid-util/src/main/java/org/vaadin/gridutil/cell/filter/EqualFilter.java
// public class EqualFilter<T> implements SerializablePredicate<T> {
// 
//     final T toCompare;
// 
//     public EqualFilter(T toCompare) {
//         this.toCompare = toCompare;
//     }
// 
//     @Override
//     public boolean test(T value) {
//         if (value == null && toCompare == null) {
//             return true;
//         }
//         if (value == null || toCompare == null) {
//             return false;
//         }
//         return value.equals(toCompare);
//     }
// }


import com.vaadin.data.Converter;
import com.vaadin.server.SerializablePredicate;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.TextField;
import org.vaadin.gridutil.cell.filter.BetweenFilter;
import org.vaadin.gridutil.cell.filter.EqualFilter;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
                    return FieldFactory.genNumberField(getBinder(), propertyId, converter, inputPrompt);
                }

                @Override
                public HorizontalLayout layoutComponent() {
                    getHLayout().addComponent(getSmallestField());
                    getHLayout().addComponent(getBiggestField());
                    getHLayout().setExpandRatio(getSmallestField(), 1);
                    getHLayout().setExpandRatio(getBiggestField(), 1);

                    initBinderValueChangeHandler();

                    return getHLayout();
                }

                private void initBinderValueChangeHandler() {
                    getBinder().addValueChangeListener(e -> {
                        final T smallest = getBinder().getBean()
                                .getSmallest();
                        final T biggest = getBinder().getBean()
                                .getBiggest();
                        if (smallest != null || biggest != null) {
                            //final T smallestValue = checkObject(smallest);
                            //final T biggestValue = checkObject(biggest);
                            if (smallest != null && biggest != null && smallest.equals(biggest)) {
                                filterReplaceConsumer.accept(
                                        new EqualFilter(smallest),
                                        propertyId);
                            } else {
                                filterReplaceConsumer.accept(
// Path: vaadin-grid-util/src/main/java/org/vaadin/gridutil/cell/filter/BetweenFilter.java
// public class BetweenFilter<T extends Comparable<? super T>> implements SerializablePredicate<Comparable<T>> {
//     private final T startValue;
//     private final T endValue;
// 
//     public BetweenFilter(T startValue, T endValue) {
//         this.startValue = startValue;
//         this.endValue = endValue;
//     }
// 
//     @Override
//     public boolean test(Comparable<T> value) {
//         if (value == null) {
//             return startValue == null && endValue == null;
//         }
//         return isAfterStart(value) && isBeforeEnd(value);
//     }
// 
//     private boolean isAfterStart(final Comparable<T> value) {
//         return startValue == null || value.compareTo(startValue) >= 0;
//     }
// 
//     private boolean isBeforeEnd(final Comparable<T> value) {
//         return endValue == null || value.compareTo(endValue) <= 0;
//     }
// 
// }
// 
// Path: vaadin-grid-util/src/main/java/org/vaadin/gridutil/cell/filter/EqualFilter.java
// public class EqualFilter<T> implements SerializablePredicate<T> {
// 
//     final T toCompare;
// 
//     public EqualFilter(T toCompare) {
//         this.toCompare = toCompare;
//     }
// 
//     @Override
//     public boolean test(T value) {
//         if (value == null && toCompare == null) {
//             return true;
//         }
//         if (value == null || toCompare == null) {
//             return false;
//         }
//         return value.equals(toCompare);
//     }
// }


// Path: vaadin-grid-util/src/main/java/org/vaadin/gridutil/cell/RangeCellFilterComponentFactory.java
import com.vaadin.data.Converter;
import com.vaadin.server.SerializablePredicate;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.TextField;
import org.vaadin.gridutil.cell.filter.BetweenFilter;
import org.vaadin.gridutil.cell.filter.EqualFilter;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.function.BiConsumer;
import java.util.function.Consumer;

                    return FieldFactory.genNumberField(getBinder(), propertyId, converter, inputPrompt);
                }

                @Override
                public HorizontalLayout layoutComponent() {
                    getHLayout().addComponent(getSmallestField());
                    getHLayout().addComponent(getBiggestField());
                    getHLayout().setExpandRatio(getSmallestField(), 1);
                    getHLayout().setExpandRatio(getBiggestField(), 1);

                    initBinderValueChangeHandler();

                    return getHLayout();
                }

                private void initBinderValueChangeHandler() {
                    getBinder().addValueChangeListener(e -> {
                        final T smallest = getBinder().getBean()
                                .getSmallest();
                        final T biggest = getBinder().getBean()
                                .getBiggest();
                        if (smallest != null || biggest != null) {
                            //final T smallestValue = checkObject(smallest);
                            //final T biggestValue = checkObject(biggest);
                            if (smallest != null && biggest != null && smallest.equals(biggest)) {
                                filterReplaceConsumer.accept(
                                        new EqualFilter(smallest),
                                        propertyId);
                            } else {
                                filterReplaceConsumer.accept(
                                        new BetweenFilter(