示例#1
0
文件: Context.java 项目: xwiz/kaa
 public static Direction getDirection(Cell source, Cell neighbor) {
   if (source.getX() < neighbor.getX()) {
     return Direction.EAST;
   } else if (source.getX() > neighbor.getX()) {
     return Direction.WEST;
   } else if (source.getY() < neighbor.getY()) {
     return Direction.SOUTH;
   } else {
     return Direction.NORTH;
   }
 }
示例#2
0
文件: Context.java 项目: xwiz/kaa
 public static boolean isNeighbors(Cell c1, Cell c2) {
   return (Math.abs(c1.getX() - c2.getX()) + Math.abs(c1.getY() - c2.getY())) == 1;
 }