public static <ObjectType> boolean dominates(
      final ITreeNode<ObjectType> node,
      final ITreeNode<ObjectType> target,
      final ITreeNode<ObjectType> source) {
    if (node.getObject() == source) {
      return false;
    } else if (node.getObject() == target) {
      return true;
    } else {
      for (final ITreeNode<ObjectType> child : node.getChildren()) {
        if (!dominates(child, target, source)) {
          return false;
        }
      }

      return true;
    }
  }
Tests whether a node dominates another node.

@param node The node of the dominator tree where the search starts.
@param target The dominator node.
@param source The dominated node.
@return True, if the dominator node dominates the dominated node. False, otherwise.
java/zylib/src/main/java/com/google/security/zynamics/zylib/types/trees/TreeAlgorithms.java