コード例 #1
0
        }                                                                                                    //TODO remove


        //TODO make array of nodes bottom to upper at sequence of indexing, this will make iteration over them up or down simpler!!!

        public MaxTree(MaxTreeNode <ElementType> bottom_level_node, int full_element_count, int real_element_count, IComparer <ElementType> element_value_comparer)
        {
            this.element_value_comparer = element_value_comparer;
            this.FullElementCount       = full_element_count; // includes virtual elements
            this.RealElementCount       = real_element_count;

            this.d_elements_to_nodes = new MaxTreeNode <ElementType> [full_element_count];
            foreach (int element in bottom_level_node.GetElementIndexArrayNodeFull()) //!Note unused element in alfa trees
            {
                this.d_elements_to_nodes[element] = bottom_level_node;
            }
            bottom_level_node.ComputePrimitives(this);

            this.node_list_bottom_to_top = bottom_level_node.GetCulmativeChildrenBottomToTopInner();
            for (int node_index = 0; node_index < node_list_bottom_to_top.Count; node_index++)
            {
                MaxTreeNode <ElementType> node = node_list_bottom_to_top[node_index];
                node.NodeIndex = node_index;
                foreach (int element_index in node.GetElementIndexArrayNodeFull())
                {
                    this.d_elements_to_nodes[element_index] = node;
                }
            }
        }