// effects: returns a copy of the tree below node internal CellTreeNode MakeCopy() { DefaultCellTreeVisitor <bool> visitor = new DefaultCellTreeVisitor <bool>(); CellTreeNode result = Accept <bool, CellTreeNode>(visitor, true); return(result); }
// effects: Inserts child at "index" while ensuring the constants // and attributes of the child are propagated into this private void Insert(int index, CellTreeNode child) { m_attrs.Unite(child.Attributes); m_children.Insert(index, child); // reset fragmentQuery so it's recomputed when property FragmentQuery is accessed m_leftFragmentQuery = null; m_rightFragmentQuery = null; }
internal override void ToCompactString(StringBuilder stringBuilder) { // Debug.Assert(m_children.Count > 1, "Tree not flattened?"); stringBuilder.Append("("); for (int i = 0; i < m_children.Count; i++) { CellTreeNode child = m_children[i]; child.ToCompactString(stringBuilder); if (i != m_children.Count - 1) { StringUtil.FormatStringBuilder(stringBuilder, " {0} ", OpType); } } stringBuilder.Append(")"); }
// effects: Add child at the beginning of the current children list // while ensuring the constants and attributes of the child are // propagated into this (i.e., unioned) internal void AddFirst(CellTreeNode child) { Insert(0, child); }
// effects: Add child to the end of the current children list // while ensuring the constants and attributes of the child are // propagated into this (i.e., unioned) internal void Add(CellTreeNode child) { Insert(m_children.Count, child); }
internal static IEnumerable <LeafCellTreeNode> GetLeaves(CellTreeNode node) { LeafVisitor visitor = new LeafVisitor(); return(node.Accept <bool, IEnumerable <LeafCellTreeNode> >(visitor, true)); }