public NodeWrapper getChild(String name) {
    ArrayList<NodeWrapper> children = getChildren();

    for (NodeWrapper child : children) {
      if (child.getName().equals(name)) return child;
    }
    return null;
  }
  public boolean hasChild(NodeWrapper node) {
    long id = node.getId();

    for (NodeWrapper child : getChildren()) {
      if (child.getId() == id) return true;
    }

    return false;
  }
  public NodeWrapper getSibling(String name) {
    if (getParent() == null) return null;

    ArrayList<NodeWrapper> children = getParent().getChildren();

    for (NodeWrapper child : children) {
      if (child.getName().equals(name)) return child;
    }
    return null;
  }
  public ArrayList<String> getSiblings() {
    ArrayList<String> result = new ArrayList<String>();

    if (cursor == null) return result;

    NodeWrapper parent = getParent();

    if (parent != null) result = parent.getChildrenStringArray();
    else result = db.cursorToArrayList(db.getFileCursor());

    return result;
  }
  public String constructOlpId() {
    if (cursor == null) return "";

    StringBuilder result = new StringBuilder();
    result.insert(0, getName());

    long parentId = getParentId();

    while (parentId > 0) {
      NodeWrapper node = new NodeWrapper(db.getNode(parentId), db);
      parentId = node.getParentId();

      if (parentId > 0) result.insert(0, node.getOlpName() + "/");
      else { // Get file nodes real name
        String filename = db.getFilenameFromNodeId(node.getId());
        result.insert(0, filename + ":");
      }
    }

    result.insert(0, "olp:");
    return result.toString();
  }
  public ArrayList<String> getChildrenStringArray() {
    ArrayList<String> result = new ArrayList<String>();
    for (NodeWrapper wrapper : getChildren()) result.add(wrapper.getName());

    return result;
  }
  public void setParent(NodeWrapper newParent) {
    if (cursor == null) return;

    setParent(newParent.getId());
    setFileId(newParent.getFileId());
  }