@Override
 public Set<Rect> getRectsForNodeHighlight() {
   Set<Rect> rects = new HashSet<>();
   for (OptionScanNode child : mChildren) {
     rects.addAll(child.getRectsForNodeHighlight());
   }
   return Collections.unmodifiableSet(rects);
 }
Exemple #2
0
 /**
  * Print a tree to a specified stream. This method is intended for debugging.
  *
  * @param tree The tree to print
  * @param printStream The stream to which to print
  * @param prefix Any prefix that should be prepended to each line.
  */
 @SuppressWarnings("unused")
 public static void printTree(OptionScanNode tree, PrintStream printStream, String prefix) {
   String treeClassName = tree.getClass().getSimpleName();
   if (tree instanceof AccessibilityNodeActionNode) {
     Iterator<Rect> rects = tree.getRectsForNodeHighlight().iterator();
     if (rects.hasNext()) {
       Rect rect = rects.next();
       printStream.println(prefix + treeClassName + " with rect: " + rect.toString());
     }
     return;
   }
   printStream.println(prefix + treeClassName);
   if (tree instanceof OptionScanSelectionNode) {
     OptionScanSelectionNode selectionNode = (OptionScanSelectionNode) tree;
     for (int i = 0; i < selectionNode.getChildCount(); ++i) {
       printTree(selectionNode.getChild(i), printStream, prefix + "-");
     }
   }
 }