public Marker greaterAdjacent() { if (!valueBlock.isPresent()) { throw new IllegalStateException("No marker adjacent to unbounded"); } switch (bound) { case BELOW: return new Marker(type, valueBlock, Bound.EXACTLY); case EXACTLY: return new Marker(type, valueBlock, Bound.ABOVE); case ABOVE: throw new IllegalStateException("No greater marker adjacent to an ABOVE bound"); default: throw new AssertionError("Unsupported type: " + bound); } }
public Marker lesserAdjacent() { if (!valueBlock.isPresent()) { throw new IllegalStateException("No marker adjacent to unbounded"); } switch (bound) { case BELOW: throw new IllegalStateException("No lesser marker adjacent to a BELOW bound"); case EXACTLY: return new Marker(type, valueBlock, Bound.BELOW); case ABOVE: return new Marker(type, valueBlock, Bound.EXACTLY); default: throw new AssertionError("Unsupported type: " + bound); } }
private static Marker create(Type type, Optional<Object> value, Bound bound) { return new Marker(type, value.map(object -> Utils.nativeValueToBlock(type, object)), bound); }