// Path: src/com/thoughtworks/calabash/android/CalabashLogger.java
// public static void error(Object message) {
//     if (shouldLog && isNotEmpty(message))
//         log.error(message);
// }
// 
// Path: src/com/thoughtworks/calabash/android/CalabashLogger.java
// public static void info(Object message) {
//     if (shouldLog && isNotEmpty(message)) {
//         log.info(message);
//     }
// }


import org.codehaus.jackson.JsonNode;
import org.codehaus.jackson.map.ObjectMapper;
import org.jruby.RubyArray;
import org.jruby.RubyHash;
import java.io.IOException;
import java.net.MalformedURLException;
import java.util.*;
import static com.thoughtworks.calabash.android.CalabashLogger.error;
import static com.thoughtworks.calabash.android.CalabashLogger.info;
            }
        }
        return startNode;
    }

    private int matchWith(List<TreeNode> elements, UIElement elementToMatch) {
        for (int i = 0; i < elements.size(); i++) {
            if (elements.get(i).getData().equals(elementToMatch))
                return i;

        }
        return -1;
    }

    public List<TreeNode> createTree() {
        List<TreeNode> treeNodes = null;
        try {
            info("Fetching view hierarchy");
            treeNodes = new ArrayList<TreeNode>();
            final JsonNode jsonNode = mapper.readTree(calabashHttpClient.getViewDump());
            final JsonNode childNodes = jsonNode.get("children");
            if (childNodes == null) {
                return treeNodes;
            }
            JsonNode rootJsonNode = childNodes.get(0);
            final TreeNode rootTreeNode = treeNodeBuilder.buildFrom(rootJsonNode, "* index:0");
            addChildren(rootTreeNode, rootJsonNode);
            treeNodes.add(rootTreeNode);

        } catch (MalformedURLException e) {
// Path: src/com/thoughtworks/calabash/android/CalabashLogger.java
// public static void error(Object message) {
//     if (shouldLog && isNotEmpty(message))
//         log.error(message);
// }
// 
// Path: src/com/thoughtworks/calabash/android/CalabashLogger.java
// public static void info(Object message) {
//     if (shouldLog && isNotEmpty(message)) {
//         log.info(message);
//     }
// }


// Path: src/com/thoughtworks/calabash/android/TreeBuilder.java
import org.codehaus.jackson.JsonNode;
import org.codehaus.jackson.map.ObjectMapper;
import org.jruby.RubyArray;
import org.jruby.RubyHash;
import java.io.IOException;
import java.net.MalformedURLException;
import java.util.*;
import static com.thoughtworks.calabash.android.CalabashLogger.error;
import static com.thoughtworks.calabash.android.CalabashLogger.info;

            }
        }
        return startNode;
    }

    private int matchWith(List<TreeNode> elements, UIElement elementToMatch) {
        for (int i = 0; i < elements.size(); i++) {
            if (elements.get(i).getData().equals(elementToMatch))
                return i;

        }
        return -1;
    }

    public List<TreeNode> createTree() {
        List<TreeNode> treeNodes = null;
        try {
            info("Fetching view hierarchy");
            treeNodes = new ArrayList<TreeNode>();
            final JsonNode jsonNode = mapper.readTree(calabashHttpClient.getViewDump());
            final JsonNode childNodes = jsonNode.get("children");
            if (childNodes == null) {
                return treeNodes;
            }
            JsonNode rootJsonNode = childNodes.get(0);
            final TreeNode rootTreeNode = treeNodeBuilder.buildFrom(rootJsonNode, "* index:0");
            addChildren(rootTreeNode, rootJsonNode);
            treeNodes.add(rootTreeNode);

        } catch (MalformedURLException e) {
            error("malformed url", e);