/** * Returns the set of neighbors shared by this and the given Neighbors. Also known as an * <b>intersection</b>. */ public Neighbors shared(Neighbors neighbors) { return Neighbors.values()[ordinal() & neighbors.ordinal()]; }
/** * Returns a set of neighbors that contains all those held by this set, less those held by the * given set. */ public Neighbors remove(Neighbors neighbors) { return Neighbors.values()[ordinal() & ~neighbors.ordinal()]; }
/** * Returns the set of neighbors held by either this or the given Neighbors. Also known as a * <b>union</b>. */ public Neighbors add(Neighbors neighbors) { return Neighbors.values()[ordinal() | neighbors.ordinal()]; }