Exemplo n.º 1
0
        /// <summary>
        /// Use treeName to find the vector of BoostInfoTree in subtrees_.
        /// </summary>
        ///
        /// <param name="value"></param>
        /// <returns>A list of BoostInfoTree, or null if not found.</returns>
        private ArrayList find(String treeName)
        {
            for (int i = 0; i < subtrees_.Count; ++i)
            {
                BoostInfoTree.TreeEntry entry = subtrees_[i];
                if (entry.treeName_.equals(treeName))
                {
                    return(entry.subtreeList_);
                }
            }

            return(null);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Insert a BoostInfoTree as a sub-tree with the given name.
        /// </summary>
        ///
        /// <param name="treeName">The name of the new sub-tree.</param>
        /// <param name="newTree">The sub-tree to add.</param>
        public void addSubtree(String treeName, BoostInfoTree newTree)
        {
            ArrayList subtreeList = find(treeName);

            if (subtreeList != null)
            {
                ILOG.J2CsMapping.Collections.Collections.Add(subtreeList, newTree);
            }
            else
            {
                BoostInfoTree.TreeEntry entry = new BoostInfoTree.TreeEntry(treeName);
                ILOG.J2CsMapping.Collections.Collections.Add(subtrees_, entry);
                ILOG.J2CsMapping.Collections.Collections.Add(entry.subtreeList_, newTree);
            }

            newTree.parent_ = this;
            lastChild_      = newTree;
        }
Exemplo n.º 3
0
        public String prettyPrint(int indentLevel)
        {
            // Set prefix to indentLevel spaces.
            String prefix = ILOG.J2CsMapping.Util.StringUtil.NewString(new char[indentLevel]).replace("\0", " ");
            String s      = "";

            if (parent_ != null)
            {
                if (value_.Length > 0)
                {
                    s += "\"" + value_ + "\"";
                }
                s += "\n";
            }

            if (subtrees_.Count > 0)
            {
                if (parent_ != null)
                {
                    s += prefix + "{\n";
                }
                String nextLevel = ILOG.J2CsMapping.Util.StringUtil.NewString(new char[indentLevel + 2]).replace(
                    "\0", " ");
                for (int i = 0; i < subtrees_.Count; ++i)
                {
                    BoostInfoTree.TreeEntry entry = subtrees_[i];
                    for (int iSubTree = 0; iSubTree < entry.subtreeList_.Count; ++iSubTree)
                    {
                        s += nextLevel
                             + entry.treeName_
                             + " "
                             + ((BoostInfoTree)entry.subtreeList_[iSubTree])
                             .prettyPrint(indentLevel + 2);
                    }
                }

                if (parent_ != null)
                {
                    s += prefix + "}\n";
                }
            }

            return(s);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Insert a BoostInfoTree as a sub-tree with the given name.
        /// </summary>
        ///
        /// <param name="treeName">The name of the new sub-tree.</param>
        /// <param name="newTree">The sub-tree to add.</param>
        public void addSubtree(String treeName, BoostInfoTree newTree)
        {
            ArrayList subtreeList = find(treeName);
            if (subtreeList != null)
                ILOG.J2CsMapping.Collections.Collections.Add(subtreeList,newTree);
            else {
                BoostInfoTree.TreeEntry  entry = new BoostInfoTree.TreeEntry (treeName);
                ILOG.J2CsMapping.Collections.Collections.Add(subtrees_,entry);
                ILOG.J2CsMapping.Collections.Collections.Add(entry.subtreeList_,newTree);
            }

            newTree.parent_ = this;
            lastChild_ = newTree;
        }