Class: Containers::CRBTreeMap

### Home Classes Methods

### In Files

- ext/containers/bst/bst.c

### Parent

Object

### Methods

- ::new
- #[]
- #[]=
- #delete
- #delete_max
- #delete_min
- #each
- #empty?
- #get
- #has_key?
- #height
- #max_key
- #min_key
- #push
- #size

### Files

- Makefile
- Makefile
- Makefile
- Makefile
- Makefile

### Class/Module Index

Quicksearch

- Containers
- Containers::CBst
- Containers::CDeque
- Containers::CRBTreeMap
- Containers::CSplayTreeMap
- Containers::Heap
- Containers::KDTree
- Containers::MaxHeap
- Containers::MinHeap
- Containers::PriorityQueue
- Containers::Queue
- Containers::RubyDeque
- Containers::RubyDeque
- Containers::RubyRBTreeMap
- Containers::RubyRBTreeMap
- Containers::RubySplayTreeMap
- Containers::RubySplayTreeMap
- Containers::Stack
- Containers::SuffixArray
- Containers::Trie
- Object
- Object::Deque
- Object::RBTreeMap
- Object::SplayTreeMap
- Algorithms
- Algorithms::Search
- Algorithms::String

No matching classes.

# Containers::CRBTreeMap

### Public Class Methods

new() click to toggle source

    static VALUE rbtree_init(VALUE self)
    {
            return self;
    }

### Public Instance Methods

[](p1) click to toggle source
Alias for: get
[]=(p1, p2) click to toggle source
Alias for: push
delete(p1) click to toggle source

    static VALUE rbtree_delete(VALUE self, VALUE key) {
            VALUE deleted_value;
            rbtree *tree = get_tree_from_self(self);
            if(!tree->root)
                    return Qnil;

            tree->root = delete(tree, tree->root, key, &deleted_value);
            if(tree->root)
                    tree->root->color = BLACK;

            if(deleted_value) {
                    return deleted_value;
            }

            return Qnil;
    }

delete_max() click to toggle source

    static VALUE rbtree_delete_max(VALUE self) {
            VALUE deleted_value;
            rbtree *tree = get_tree_from_self(self);
            if(!tree->root)
                    return Qnil;

            tree->root = delete_max(tree->root, &deleted_value);
            if(tree->root)
                    tree->root->color = BLACK;

            if(deleted_value) {
                    return deleted_value;
            }

            return Qnil;
    }

delete_min() click to toggle source

    static VALUE rbtree_delete_min(VALUE self) {
            VALUE deleted_value;
            rbtree *tree = get_tree_from_self(self);
            if(!tree->root)
                    return Qnil;

            tree->root = delete_min(tree->root, &deleted_value);
            if(tree->root)
                    tree->root->color = BLACK;

            if(deleted_value) {
                    return deleted_value;
            }

            return Qnil;
    }

each() click to toggle source

    static VALUE rbtree_each(VALUE self) {
            rbtree *tree = get_tree_from_self(self);
            rbt_each(tree, &rbtree_each_helper, NULL);
            return self;
    }

empty?() click to toggle source

    static VALUE rbtree_is_empty(VALUE self) {
            rbtree *tree = get_tree_from_self(self);
            return (tree->root ? Qfalse : Qtrue);
    }

get(p1) click to toggle source

    static VALUE rbtree_get(VALUE self, VALUE key) {
            rbtree *tree = get_tree_from_self(self);
            return get(tree, tree->root, key);
    }

Also aliased as: []
has_key?(p1) click to toggle source

    static VALUE rbtree_has_key(VALUE self, VALUE key) {
            rbtree *tree = get_tree_from_self(self);
            if(!tree->root) { return Qfalse; }
            if(get(tree, tree->root, key) == Qnil)
                    return Qfalse;

            return Qtrue;
    }

height() click to toggle source

    static VALUE rbtree_height(VALUE self) {
            rbtree *tree = get_tree_from_self(self);
            return INT2NUM(height(tree->root));
    }

max_key() click to toggle source

    static VALUE rbtree_max_key(VALUE self) {
            rbtree *tree = get_tree_from_self(self);
            if(!tree->root)
                    return Qnil;

            return max_key(tree->root);
    }

min_key() click to toggle source

    static VALUE rbtree_min_key(VALUE self) {
            rbtree *tree = get_tree_from_self(self);
            if(!tree->root)
                    return Qnil;

            return min_key(tree->root);
    }

push(p1, p2) click to toggle source

    static VALUE rbtree_push(VALUE self, VALUE key, VALUE value) {
            rbtree *tree = get_tree_from_self(self);
            tree->root = insert(tree, tree->root, key, value);
            return value;
    }

Also aliased as: []=
size() click to toggle source

    static VALUE rbtree_size(VALUE self) {
            rbtree *tree = get_tree_from_self(self);
            return INT2NUM(size(tree->root));
    }

[Validate]

Generated with the Darkfish Rdoc Generator 2.