Collection parents = blackboard.query (new UnaryPredicate () { public boolean execute (Object obj) { if (obj instanceof Task) { return (((Task) obj).getUID().equals (child.getParentTaskUID())); } else return false; } });  if (parents.isEmpty()) return null; parent = (Task) parents.iterator().next(); childToParent.put (child, parent);
if (parent == null) { logger.warn ("huh? no task with " + child.getParentTaskUID () + " in uid->task map."); }
  protected Task getParentTask (final Task child) {    Task parent = (Task) childToParent.get(child); // use a cache since query is expensive    if (parent != null)      return parent;    Collection parents = blackboard.query (new UnaryPredicate () {        public boolean execute (Object obj) {          if (obj instanceof Task) {            return (((Task) obj).getUID().equals (child.getParentTaskUID()));          }          else return false;        }      });    if (parents.isEmpty())       return null;    parent = (Task) parents.iterator().next(); // only one parent - not an MPTask    childToParent.put (child, parent);    return parent;  }