code: <T extends INode> T addChild(final T node, boolean inheritPermission,
                                                boolean propagateModTime,
                                                int childIndex) {
      if (inheritPermission) {
        FsPermission p = getFsPermission();
        //make sure the  permission has wx for the user
        if (!p.getUserAction().implies(FsAction.WRITE_EXECUTE)) {
          p = new FsPermission(p.getUserAction().or(FsAction.WRITE_EXECUTE),
              p.getGroupAction(), p.getOtherAction());
        }
        node.setPermission(p);
      }
  
      if (children == null) {
        children = new ArrayList<INode>(DEFAULT_FILES_PER_DIRECTORY);
      }
      int index;  
      if (childIndex >= 0) {
        index = childIndex; 
      } else {
        int low = Collections.binarySearch(children, node.name);
        if(low >= 0)
          return null;
        index = -low - 1;
      }
      node.parent = this;
      children.add(index, node);
      if (propagateModTime) {
        // update modification time of the parent directory
        setModificationTime(node.getModificationTime());      
      }
      if (childIndex < 0) {
        // if child Index is provided (>=0), this is a result of 
        // loading the image, and the group name is set, no need
        // to check
        if (node.getGroupName() == null) {
          node.setGroup(getGroupName());
        }
      } 
      return node;
    }
docs: Add a child inode to the directory.
  
  @param node INode to insert
  @param inheritPermission inherit permission from parent?
  @param propagateModTime set parent's mod time to that of a child?
  @param childIndex index of the inserted child if known
  @return  null if the child with this name already exists;
  node, otherwise