List of usage examples for com.google.common.collect Ranges atLeast
public static <C extends Comparable<?>> Range<C> atLeast(C paramC)
From source file:pl.porannajava.javnysejm.DeputyCommittee.java
protected DeputyCommittee(Map<String, String> properties) { this.committeeId = StringConverter.getInteger(properties.get("komisja_id")); LocalDate fromDate = StringConverter.getDate(properties.get("od")); LocalDate toDate = null;/* www . j a va 2 s.c om*/ try { toDate = StringConverter.getDate(properties.get("do")); } catch (IllegalFieldValueException e) { // nothing to do. // trying to catch "0000-00-00" date } if (toDate != null) { this.interval = Ranges.closed(fromDate, toDate); } else { this.interval = Ranges.atLeast(fromDate); } this.function = StringConverter.getUnescapedString(properties.get("funkcja")); }
From source file:com.sk89q.worldguard.blacklist.target.TargetMatcherParser.java
private Predicate<Short> parseRange(String input) throws TargetMatcherParseException { input = input.trim();//ww w. ja v a 2s . c o m Matcher matcher; matcher = LESS_THAN_PATTERN.matcher(input); if (matcher.matches()) { return Ranges.atMost(Short.parseShort(matcher.group(1))); } matcher = GREATER_THAN_PATTERN.matcher(input); if (matcher.matches()) { return Ranges.atLeast(Short.parseShort(matcher.group(1))); } matcher = RANGE_PATTERN.matcher(input); if (matcher.matches()) { return Ranges.closed(Short.parseShort(matcher.group(1)), Short.parseShort(matcher.group(2))); } try { short s = Short.parseShort(input); return Ranges.closed(s, s); } catch (NumberFormatException e) { throw new TargetMatcherParseException("Unknown data value range: " + input); } }