private static void insert(final int mapY, final int mustBePlain, final int... emptyOrPlain) {
   final short patchId = PartitionPatch.getPatchIdFromMapCoord(1, mapY);
   BorderHelper.BORDER_PATCHES.put(mustBePlain, patchId);
   for (final int optional : emptyOrPlain) {
     insert(mapY, mustBePlain | optional, new int[0]);
     insert(mapY, mustBePlain | optional, allExcept(emptyOrPlain, optional));
   }
 }
 private static boolean isEmptyPatchOrEntryBorder(
     final short[][] patches, final int x, final int y) {
   return isEmptyPatch(patches, x, y)
       || PartitionPatch.getMapCoordFromPatchId(patches[x][y]).getX() == 2;
 }
 public static short getPatchIdForMask(final int mask) {
   if (!BorderHelper.BORDER_PATCHES.contains(mask)) {
     return PartitionPatch.getPatchIdFromMapCoord(1, 0);
   }
   return BorderHelper.BORDER_PATCHES.get(mask);
 }