// Path: src/main/java/com/wjyup/coolq/exception/PredicateException.java
// public class PredicateException extends RuntimeException{
//     private static final long serialVersionUID = 1L;
// 
//     public PredicateException(String message) {
//         super(message);
//     }
// }
// 
// Path: src/main/java/com/wjyup/coolq/exception/UnexpectedException.java
// public class UnexpectedException extends RuntimeException {
//     private static final long serialVersionUID = 1L;
// 
//     public UnexpectedException(String message) {
//         super(message);
//     }
// 
//     public UnexpectedException(String message, Throwable cause) {
//         super(message, cause);
//     }
// 
//     public UnexpectedException(Throwable cause) {
//         super(cause);
//     }
// }


import com.google.common.base.Strings;
import com.google.common.base.Supplier;
import com.google.common.collect.Iterables;
import com.wjyup.coolq.exception.PredicateException;
import com.wjyup.coolq.exception.UnexpectedException;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Collection;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
        ensureIn(value, predicates, msg.get());
    }

    private static int compare(Number x, Number y) {
        if(isSpecial(x) || isSpecial(y)) {
            return Double.compare(x.doubleValue(), y.doubleValue());
        } else {
            return toBigDecimal(x).compareTo(toBigDecimal(y));
        }
    }

    private static boolean isSpecial(Number x) {
        boolean specialDouble = x instanceof Double && (Double.isNaN((Double) x) || Double.isInfinite((Double) x));
        boolean specialFloat = x instanceof Float && (Float.isNaN((Float)x) || Float.isInfinite((Float)x));
        return specialDouble || specialFloat;
    }

    private static BigDecimal toBigDecimal(Number number) {
        if(number instanceof BigDecimal) {
            return (BigDecimal) number;
        } else if(number instanceof BigInteger) {
            return new BigDecimal((BigInteger) number);
        } else if(number instanceof Byte || number instanceof Short || number instanceof Integer || number instanceof Long) {
            return new BigDecimal(number.longValue());
        } else if(number instanceof Float || number instanceof Double) {
            return new BigDecimal(number.doubleValue());
        } else {
            try {
                return new BigDecimal(number.toString());
            } catch(final NumberFormatException e) {
// Path: src/main/java/com/wjyup/coolq/exception/PredicateException.java
// public class PredicateException extends RuntimeException{
//     private static final long serialVersionUID = 1L;
// 
//     public PredicateException(String message) {
//         super(message);
//     }
// }
// 
// Path: src/main/java/com/wjyup/coolq/exception/UnexpectedException.java
// public class UnexpectedException extends RuntimeException {
//     private static final long serialVersionUID = 1L;
// 
//     public UnexpectedException(String message) {
//         super(message);
//     }
// 
//     public UnexpectedException(String message, Throwable cause) {
//         super(message, cause);
//     }
// 
//     public UnexpectedException(Throwable cause) {
//         super(cause);
//     }
// }


// Path: src/main/java/com/wjyup/coolq/util/Predicates.java
import com.google.common.base.Strings;
import com.google.common.base.Supplier;
import com.google.common.collect.Iterables;
import com.wjyup.coolq.exception.PredicateException;
import com.wjyup.coolq.exception.UnexpectedException;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Collection;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

        ensureIn(value, predicates, msg.get());
    }

    private static int compare(Number x, Number y) {
        if(isSpecial(x) || isSpecial(y)) {
            return Double.compare(x.doubleValue(), y.doubleValue());
        } else {
            return toBigDecimal(x).compareTo(toBigDecimal(y));
        }
    }

    private static boolean isSpecial(Number x) {
        boolean specialDouble = x instanceof Double && (Double.isNaN((Double) x) || Double.isInfinite((Double) x));
        boolean specialFloat = x instanceof Float && (Float.isNaN((Float)x) || Float.isInfinite((Float)x));
        return specialDouble || specialFloat;
    }

    private static BigDecimal toBigDecimal(Number number) {
        if(number instanceof BigDecimal) {
            return (BigDecimal) number;
        } else if(number instanceof BigInteger) {
            return new BigDecimal((BigInteger) number);
        } else if(number instanceof Byte || number instanceof Short || number instanceof Integer || number instanceof Long) {
            return new BigDecimal(number.longValue());
        } else if(number instanceof Float || number instanceof Double) {
            return new BigDecimal(number.doubleValue());
        } else {
            try {
                return new BigDecimal(number.toString());
            } catch(final NumberFormatException e) {
                throw new UnexpectedException(String.format("数值%s(类型%s)无法转换为合法的字符串", number.toString(), number.getClass().getName()), e);