Exemple #1
0
 def __init__(self):
     self.next_suffix = 0
     self.holes = RBTree()
Exemple #2
0
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# See the COPYING file for license information.
#
# Copyright (c) 2008 Guillaume Chazarain <*****@*****.**>

from polysh.rb_tree import RBTree

# {'prefix': <display_name_prefix object>}
PREFIXES = {}

# Red/black tree with key:len(display_name) value:nr of enabled shells with a
# display_name of such a length
NR_ENABLED_DISPLAY_NAMES_BY_LENGTH = RBTree()

# Cache the right most element in the NR_ENABLED_DISPLAY_NAMES_BY_LENGTH tree
max_display_name_length = 0


class display_name_prefix(object):
    def __init__(self):
        self.next_suffix = 0
        self.holes = RBTree()

    def new_suffix(self):
        if len(self.holes) == 0:
            suffix = self.next_suffix
            self.next_suffix += 1
        else: