Java 类com.facebook.presto.spi.predicate.Marker 实例源码

项目:presto-ethereum    文件:EthereumBlockRange.java   
public static EthereumBlockRange fromMarkers(Marker low, Marker high) {
    long startBlock;
    long endBlock;
    if (low.isLowerUnbounded()) {
        startBlock = 1L;
    } else if (low.getBound() == Marker.Bound.EXACTLY) {
        startBlock = (long) low.getValue();
    } else if (low.getBound() == Marker.Bound.ABOVE) {
        startBlock = (long) low.getValue() + 1L;
    } else {
        throw new IllegalArgumentException("Low bound cannot be BELOW");
    }

    if (high.isUpperUnbounded()) {
        endBlock = -1L;
    } else if (high.getBound() == Marker.Bound.EXACTLY) {
        endBlock = (long) high.getValue();
    } else if (high.getBound() == Marker.Bound.BELOW) {
        endBlock = (long) high.getValue() - 1L;
    } else {
        throw new IllegalArgumentException("High bound cannot be ABOVE");
    }

    if (startBlock > endBlock && endBlock != -1L) {
        throw new IllegalArgumentException("Low bound is greater than high bound");
    }

    return new EthereumBlockRange(startBlock, endBlock);
}
项目:presto    文件:DomainTranslator.java   
private static boolean isBetween(Range range)
{
    return !range.getLow().isLowerUnbounded() && range.getLow().getBound() == Marker.Bound.EXACTLY
            && !range.getHigh().isUpperUnbounded() && range.getHigh().getBound() == Marker.Bound.EXACTLY;
}