/** Inserts the location to the argument; if already exists, overwrite. */ public boolean putLoc(PBLoc pbLoc) { for (PBLoc loc : pb_locs) { if (loc.contains(pbLoc)) { loc.type = pbLoc.type; return true; } else if (pbLoc.contains(loc)) { loc.copy(pbLoc); return true; } } return pb_locs.add(pbLoc); }
/** Removes all occurrences of <code>pbLoc</code> (the location) from this argument. */ public boolean removeLocs(PBLoc pbLoc) { HashSet<PBLoc> set = new HashSet<>(); for (PBLoc loc : pb_locs) { if (pbLoc.contains(loc)) { set.add(loc); } } return pb_locs.removeAll(set); }