public boolean canHaveAsChild(Thing thing) { if (null == thing || null == al_children) return false; for (final TemplateThing tt : al_children) { if (tt.type.equals(thing.getType())) { return true; } } return false; }
/** * Determine whether this instance is nested inside the tree of an instance of the same type (for * example, a neurite_branch inside another neurite_branch) */ public boolean isNested() { Thing p = this.parent; while (null != p) { if (this.type.equals(p.getType())) { return true; // nested! } p = p.getParent(); } return false; }