/* * find the new appeared neighbors by comparing the current neighbor with the history */ public static Vector findNewNeighbor(int pos) { Vector result = new Vector(); Vector cur = (Vector) neighborCurrent.get(pos); Vector his = (Vector) neighborHistory.get(pos); if (his == null || his.size() == 0) return cur; for (int i = 0; i < cur.size(); i++) { if (!his.contains(cur.get(i))) { result.add(cur.get(i)); } } return result; }
/* * deep copy from current neighbors to history neighbors */ public static void currentToHistory() { // neighborHistory = neighborCurrent; for (int i = 0; i < size; i++) { Vector currN = (Vector) neighborCurrent.get(i); Vector histN = new Vector(); for (int j = 0; j < currN.size(); j++) { int temp = (Integer) currN.get(j); histN.add(temp); } neighborHistory.set(i, histN); } }