获取直接相连的子节点

@param parent   父节点
@param siblings （子）兄弟节点
@return 兄弟节点个数
341370
private int fetch(Node parent, List<Node> siblings)
    {
        if (error_ < 0)
            return 0;

        int prev = 0;

        for (int i = parent.left; i < parent.right; i++)
        {
            if ((length != null ? length[i] : key.get(i).length()) < parent.depth)
                continue;

            String tmp = key.get(i);

            int cur = 0;
            if ((length != null ? length[i] : tmp.length()) != parent.depth)
                cur = (int) tmp.charAt(parent.depth) + 1;

            if (prev > cur)
            {
                error_ = -3;
                return 0;
            }

            if (cur != prev || siblings.size() == 0)
            {
                Node tmp_node = new Node();
                tmp_node.depth = parent.depth + 1;
                tmp_node.code = cur;
                tmp_node.left = i;
                if (siblings.size() != 0)
                    siblings.get(siblings.size() - 1).right = i;

                siblings.add(tmp_node);
            }

            prev = cur;
        }

        if (siblings.size() != 0)
            siblings.get(siblings.size() - 1).right = parent.right;

        return siblings.size();
    }
1264017
private void buildNode(Node parent, List<String>[] sequence, int from, List<Node> leaf){
        //递归退出条件：二维数组遍历完毕
        if(from >= sequence.length){
            //记住叶子节点
            leaf.add(parent);
            return;
        }
        for(String item : sequence[from]){
            Node child = new Node(item, parent);
            buildNode(child, sequence, from+item.length(), leaf);
        }
    }
1259314
function (parent, siblings, index) {
                this.parent = parent;
                this.siblings = siblings.slice(0);

                // If source node is in the target nodes
                var i = this.siblings.indexOf(this.source);
                if (i > -1) {
                  this.siblings.splice(i, 1);
                  if (this.source.index() < index) {
                    index--;
                  }
                }

                this.siblings.splice(index, 0, this.source);
                this.index = index;
              }
795382
def get_siblings(self):
        
        if self.lft == 1:
            return self.get_root_nodes()
        return self.get_parent(True).get_children()
243263
def previous_sibling()
      if siblings = parent.children
        siblings.each_with_index do |node, i|
          return siblings[i - 1] if node.equal?(self)
        end
      end
      nil
    end
40649
function siblings(node) {
  if (node && node.parentNode) {
    var n = node.parentNode.firstChild;
    var matched = [];

    for (; n; n = n.nextSibling) {
      if (n.nodeType === 1 && n !== node) {
        matched.push(n);
      }
    }

    return matched;
  }

  return [];
}
19876
public synchronized List<ChainData> getRunningChains(ChannelDataImpl parent) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(tc, "getRunningChains");
        }
        ChannelContainer channelContainer = null;
        List<ChainData> chainDataList = new ArrayList<ChainData>();

        // Iterate the children - they are in the runtime.
        Iterator<ChildChannelDataImpl> children = parent.children();
        while (children.hasNext()) {
            // Get the runtime channel container for this child.
            channelContainer = this.channelRunningMap.get(children.next().getName());
            for (Chain chain : channelContainer.getChainMap().values()) {
                chainDataList.add(chain.getChainData());
            }
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(tc, "getRunningChains: " + chainDataList.size());
        }
        return chainDataList;
    }
1030765
public static List<Element> getChildren(Element parent, String childName) {
		ArrayList<Element> children = new ArrayList<Element>();
		NodeList nodes = parent.getChildNodes();
		for (int i = 0; i < nodes.getLength(); ++i) {
			Node node = nodes.item(i);
			if ((node instanceof Element) && node.getNodeName().equals(childName))
				children.add((Element)node);
		}
		return children;
	}
933569
public List<V> getAll(final K parent) {
        final List<V> all = this.getMultiples(parent);
        this.getSingle(parent).peek(all::add);
        return all;
    }
387941
private List<Entry> getChildNodes(DirectoryEntry parent)
   {
      List<Entry> result = new ArrayList<Entry>();
      Iterator<Entry> entries = parent.getEntries();
      while (entries.hasNext())
      {
         result.add(entries.next());
      }
      return result;
   }
670549
def siblings(self):
        
        impl_nodelist = self.adapter.get_node_children(self.parent.impl_node)
        return self._convert_nodelist(
            [n for n in impl_nodelist if n != self.impl_node])
236546
public static Node getChild(Node parent, int type) {
        Node n = parent.getFirstChild();
        while (n != null && type != n.getNodeType()) {
            n = n.getNextSibling();
        }
        if (n == null) return null;
        return n;
    }
571898
def get_siblings_treepos(self, treepos):
        """"""
        parent_pos = self.get_parent_treepos(treepos)
        siblings_treepos = []

        if parent_pos is not None:
            for child_treepos in self.get_children_treepos(parent_pos):
                if child_treepos != treepos:
                    siblings_treepos.append(child_treepos)
        return siblings_treepos
848423
def get_siblings(self):
        
        if self.parent:
            return get_result_class(self.__class__).objects.filter(
                parent=self.parent)
        return self.__class__.get_root_nodes()
418136
private TreeNode getParentTreeNode(TreeNode child) {
        TreeNode parentTreeNode = parentIndex.get(child);

        if (parentTreeNode == null)
            return null;

        // Makes sure the parent node is still present in the tree
        else if (contains(parentTreeNode.getQueryNode()))
            return parentTreeNode;
        else
            throw new RuntimeException("Internal error: points to a parent that is not (anymore) in the tree");
    }
241317
public boolean hasChild(String child)
    {
        final NodeList list = root.getChildNodes();
        for (int i = 0; i < list.getLength(); i++)
        {
            final Node node = list.item(i);
            if (node.getNodeName().equals(child))
            {
                return true;
            }
        }
        return false;
    }
1364386
public Set<Category> getSiblings() {
        Set<Category> siblings = new HashSet<Category>();

        // add siblings
        for (Category parent : this.getParents()) {
            siblings.addAll(parent.getChildren());
        }

        // remove this category from list
        siblings.remove(this);

        return siblings;
    }