private static FileTreeNode getChildNode(FileTreeNode parentNode, String name) {
if (!parentNode.isDirectory()) {
return null;
}
DirInfoImpl asDirInfo = parentNode.cast();
JsonArray<DirInfo> childDirs = asDirInfo.getSubDirectories();
for (int i = 0, n = childDirs.size(); i < n; i++) {
if (childDirs.get(i).getName().equals(name)) {
return (FileTreeNode) childDirs.get(i);
}
}
JsonArray<FileInfo> childFiles = asDirInfo.getFiles();
for (int i = 0, n = childFiles.size(); i < n; i++) {
if (childFiles.get(i).getName().equals(name)) {
return (FileTreeNode) childFiles.get(i);
}
}