/** @return true if this argument contains <code>pbLoc</code>. */ public boolean containsLoc(PBLoc pbLoc) { for (PBLoc loc : pb_locs) { if (loc.equals(pbLoc)) { return true; } } return false; }
/** @return true if this argument contains <code>terminalId:height</code>. */ public boolean containsLoc(int terminalId, int height) { for (PBLoc loc : pb_locs) { if (loc.equals(terminalId, height)) { return true; } } return false; }
/** @return true if this argument has overlap with <code>pbArg</code>. */ public boolean overlapsLocs(PBArg pbArg) { for (PBLoc cLoc : pb_locs) { for (PBLoc pLoc : pbArg.getLocs()) { if (cLoc.equals(pLoc)) { return true; } } } return false; }
/** @return string representation of the argument. */ @Override public String toString() { StringBuilder buff = new StringBuilder(); for (PBLoc loc : pb_locs) { buff.append(loc.toString()); } buff.append(PBLib.PROP_LABEL_DELIM); buff.append(label); return buff.toString(); }
/** 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); }