/** * Finds and returns the preference node directly * below the top at the given path. * * @param path the path * @param top top at the given path * @return the node, or <code>null</code> if none * * @since 3.1 */ protected IPreferenceNode find(String path,IPreferenceNode top){ Assert.isNotNull(path); StringTokenizer stok = new StringTokenizer(path, separator); IPreferenceNode node = top; while (stok.hasMoreTokens()) { String id = stok.nextToken(); node = node.findSubNode(id); if (node == null) { return null; } } if (node == top) { return null; } return node; }
/** * Finds and returns the preference node directly * below the top at the given path. * * @param path the path * @param top top at the given path * @return the node, or <code>null</code> if none * * @since 3.1 */ protected IPreferenceNode find(String path,IPreferenceNode top){ Assert.isNotNull(path); StringTokenizer stok = new StringTokenizer(path, separator); IPreferenceNode node = top; while (stok.hasMoreTokens()) { String id = stok.nextToken(); node = node.findSubNode(id); if (node == null) { return null; } } if (node == top) { return null; } return node; }
/** * Finds and returns the preference node directly * below the top at the given path. * * @param path the path * @param top top at the given path * @return the node, or <code>null</code> if none * * @since 1.0 */ protected IPreferenceNode find(String path,IPreferenceNode top){ Assert.isNotNull(path); StringTokenizer stok = new StringTokenizer(path, separator); IPreferenceNode node = top; while (stok.hasMoreTokens()) { String id = stok.nextToken(); node = node.findSubNode(id); if (node == null) { return null; } } if (node == top) { return null; } return node; }
/** * Find the parent of the provided node. Will search recursivly through the * preference tree. * * @param parent the possible parent node. * @param target the target child node. * @return the parent node of the child node. */ private IPreferenceNode findParent(IPreferenceNode parent, IPreferenceNode target) { if (parent.getId().equals(target.getId())) { return null; } IPreferenceNode found = parent.findSubNode(target.getId()); if (found != null) { return parent; } IPreferenceNode[] children = parent.getSubNodes(); for (int i = 0; i < children.length; i++) { found = findParent(children[i], target); if (found != null) { return found; } } return null; }
/** * Find the parent of the provided node. Will search recursivly through the * preference tree. * * @param parent the possible parent node. * @param target the target child node. * @return the parent node of the child node. */ private IPreferenceNode findParent(IPreferenceNode parent, IPreferenceNode target) { if (parent.getId().equals(target.getId())) { return null; } IPreferenceNode found = parent.findSubNode(target.getId()); if (found != null) { return parent; } IPreferenceNode[] children = parent.getSubNodes(); for (IPreferenceNode element : children) { found = findParent(element, target); if (found != null) { return found; } } return null; }
/** * Find the parent of the provided node. Will search recursivly through the * preference tree. * * @param parent the possible parent node. * @param target the target child node. * @return the parent node of the child node. */ private IPreferenceNode findParent(IPreferenceNode parent, IPreferenceNode target) { if (parent.getId().equals(target.getId())) { return null; } IPreferenceNode found = parent.findSubNode(target.getId()); if (found != null) { return parent; } IPreferenceNode[] children = parent.getSubNodes(); for (int i = 0; i < children.length; i++) { found = findParent(children[i], target); if (found != null) { return found; } } return null; }