289 for (PolicyNodeImpl node : mChildren) {
290 node.copyTree(newNode);
291 }
292
293 return newNode;
294 }
295
296 /**
297 * Returns all nodes at the specified depth in the tree.
298 *
299 * @param depth an int representing the depth of the desired nodes
300 * @return a <code>Set</code> of all nodes at the specified depth
301 */
302 Set<PolicyNodeImpl> getPolicyNodes(int depth) {
303 Set<PolicyNodeImpl> set = new HashSet<>();
304 getPolicyNodes(depth, set);
305 return set;
306 }
307
308 /**
309 * Add all nodes at depth depth to set and return the Set.
310 * Internal recursion helper.
311 */
312 private void getPolicyNodes(int depth, Set<PolicyNodeImpl> set) {
313 // if we've reached the desired depth, then return ourself
314 if (mDepth == depth) {
315 set.add(this);
316 } else {
317 for (PolicyNodeImpl node : mChildren) {
318 node.getPolicyNodes(depth, set);
319 }
320 }
321 }
322
323 /**
324 * Finds all nodes at the specified depth whose expected_policy_set
325 * contains the specified expected OID (if matchAny is false)
326 * or the special OID "any value" (if matchAny is true).
327 *
328 * @param depth an int representing the desired depth
329 * @param expectedOID a String encoding the valid OID to match
|
289 for (PolicyNodeImpl node : mChildren) {
290 node.copyTree(newNode);
291 }
292
293 return newNode;
294 }
295
296 /**
297 * Returns all nodes at the specified depth in the tree.
298 *
299 * @param depth an int representing the depth of the desired nodes
300 * @return a <code>Set</code> of all nodes at the specified depth
301 */
302 Set<PolicyNodeImpl> getPolicyNodes(int depth) {
303 Set<PolicyNodeImpl> set = new HashSet<>();
304 getPolicyNodes(depth, set);
305 return set;
306 }
307
308 /**
309 * Add all nodes at depth to set and return the Set.
310 * Internal recursion helper.
311 */
312 private void getPolicyNodes(int depth, Set<PolicyNodeImpl> set) {
313 // if we've reached the desired depth, then return ourself
314 if (mDepth == depth) {
315 set.add(this);
316 } else {
317 for (PolicyNodeImpl node : mChildren) {
318 node.getPolicyNodes(depth, set);
319 }
320 }
321 }
322
323 /**
324 * Finds all nodes at the specified depth whose expected_policy_set
325 * contains the specified expected OID (if matchAny is false)
326 * or the special OID "any value" (if matchAny is true).
327 *
328 * @param depth an int representing the desired depth
329 * @param expectedOID a String encoding the valid OID to match
|