code: public void addChildTaskBefore(Task child, Task previousSibling)
     {
        int index = m_children.indexOf(previousSibling);
        if (index == -1)
        {
           m_children.add(child);
        }
        else
        {
           m_children.add(index, child);
        }
  
        child.m_parent = this;
        setSummary(true);
  
        if (getParentFile().getProjectConfig().getAutoOutlineLevel() == true)
        {
           child.setOutlineLevel(Integer.valueOf(NumberHelper.getInt(getOutlineLevel()) + 1));
        }
     }
docs: Inserts a child task prior to a given sibling task.
  
  @param child new child task
  @param previousSibling sibling task