/** * Adds a "path" with specified semantics to this prefetch node. All yet * non-existent nodes in the created path will be marked as phantom. * * @return the last segment in the created path. */ public PrefetchTreeNode addPath(String path) { if (Util.isEmptyString(path)) { throw new IllegalArgumentException("Empty path: " + path); } PrefetchTreeNode node = this; StringTokenizer toks = new StringTokenizer(path, Entity.PATH_SEPARATOR); while (toks.hasMoreTokens()) { String segment = toks.nextToken(); PrefetchTreeNode child = node.getChild(segment); if (child == null) { child = new PrefetchTreeNode(node, segment); node.addChild(child); } node = child; } return node; }
/** * Adds a "path" with specified semantics to this prefetch node. All yet non-existent * nodes in the created path will be marked as phantom. * * @return the last segment in the created path. */ public PrefetchTreeNode addPath(String path) { if (Util.isEmptyString(path)) { throw new IllegalArgumentException("Empty path: " + path); } PrefetchTreeNode node = this; StringTokenizer toks = new StringTokenizer(path, Entity.PATH_SEPARATOR); while (toks.hasMoreTokens()) { String segment = toks.nextToken(); PrefetchTreeNode child = node.getChild(segment); if (child == null) { child = new PrefetchTreeNode(node, segment); node.addChild(child); } node = child; } return node; }
private PrefetchTreeNode cloneJointSubtree(PrefetchTreeNode parent) { PrefetchTreeNode cloned = new PrefetchTreeNode(parent, getName()); if (parent != null) { cloned.setSemantics(getSemantics()); cloned.setPhantom(isPhantom()); } if (children != null) { for (PrefetchTreeNode child : children) { if (child.isJointPrefetch()) { cloned.addChild(child.cloneJointSubtree(cloned)); } } } return cloned; }
private PrefetchTreeNode deepClone(PrefetchTreeNode source, PrefetchTreeNode targetParent) { PrefetchTreeNode target = new PrefetchTreeNode(targetParent, source.getName()); target.setEjbqlPathEntityId(source.getEjbqlPathEntityId()); target.setEntityName(source.getEntityName()); target.setPhantom(source.isPhantom()); target.setSemantics(source.getSemantics()); for (PrefetchTreeNode child : source.getChildren()) { target.addChild(deepClone(child, target)); } return target; }