package info.spielproject.spiel
package focus

import android.view.accessibility._

case class RichAccessibilityNode(node:AccessibilityNodeInfo) {

  def root = {
    def iterate(v:AccessibilityNodeInfo):AccessibilityNodeInfo = v.getParent match {
      case null => v
      case v2 => iterate(v2)
    }
    iterate(node)
  }

  def parent = node.getParent

  def children =
    (for(i <- 0 to node.getChildCount-1) yield(node.getChild(i))).toList.filterNot(_ == null)

  def siblings = node.parent.children

  def descendants:List[AccessibilityNodeInfo] = children.map { c =>
    List(c)++c.descendants
  }.flatten

}

package info.spielproject.spiel
package focus

import android.view.accessibility._

case class RichAccessibilityNode(node:AccessibilityNodeInfo) {

  def root = {
    def iterate(v:AccessibilityNodeInfo):AccessibilityNodeInfo = v.getParent match {
      case null => v
      case v2 => iterate(v2)
    }
    iterate(node)
  }

  def parent = node.getParent

  def children =
    (for(i <- 0 to node.getChildCount-1) yield(node.getChild(i))).toList.filterNot(_ == null)

  def siblings = parent.children

  def descendants:List[AccessibilityNodeInfo] = children.map { c =>
    List(c)++c.descendants
  }.flatten

}

Remove an unnecessary node reference.
Remove an unnecessary node reference.

--HG--
extra : convert_revision : 2916b7a1721b1c93ab08b02dbce6d296f2982c93
