public static <T extends RingPosition<T>> boolean isInBounds( T token, Iterable<Bounds<T>> bounds) { assert bounds != null; for (Bounds<T> bound : bounds) { if (bound.contains(token)) { return true; } } return false; }
public boolean intersects(Bounds<T> that) { // We either contains one of the that bounds, or we are fully contained into that. return contains(that.left) || contains(that.right) || that.contains(left); }