public Tuple rdp(Tuple template) { for (int i = 0; i < ts.size(); i++) { Tuple tuple = (Tuple) ts.get(i); if (template.matches(tuple)) return tuple; } return null; }
public Tuple[] rdgp(Tuple template) { Vector matchingTuples = new Vector(); for (int i = 0; i < ts.size(); i++) { Tuple tuple = (Tuple) ts.get(i); if (template.matches(tuple)) matchingTuples.add(tuple); } if (matchingTuples.size() == 0) return null; return (Tuple[]) matchingTuples.toArray(new Tuple[0]); }
public Tuple inp(Tuple template) { for (int i = 0; i < ts.size(); i++) { Tuple tuple = (Tuple) ts.get(i); log("INP: Comparing:\n" + template + "\nwith:\n" + tuple); if (template.matches(tuple)) { log("INP: Match!"); ts.remove(i); return tuple; } } return null; }