Class: Containers::CSplayTreeMap

### Home Classes Methods

### In Files

- ext/containers/bst/bst.c

### Parent

Object

### Methods

- ::new
- #[]
- #[]=
- #clear
- #delete
- #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::CSplayTreeMap

### Public Class Methods

new() click to toggle source

    static VALUE splaytree_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
clear() click to toggle source

    static VALUE splaytree_clear(VALUE self) {
            splaytree *tree = get_tree_from_self(self);
            recursively_free_nodes(tree->root);
            tree->root = NULL;
            return Qnil;
    }

delete(p1) click to toggle source

    static VALUE splaytree_delete(VALUE self, VALUE key) {
            VALUE deleted = Qnil;
            splaytree *tree = get_tree_from_self(self);
            if(!tree->root)
                    return Qnil;

            tree->root = delete(tree, tree->root, key, &deleted);
            return deleted;
    }

each() click to toggle source

    static VALUE splaytree_each(VALUE self) {
            splaytree *tree = get_tree_from_self(self);
            splay_each(tree, &splaytree_each_helper, NULL);
            return self;
    }

empty?() click to toggle source

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

get(p1) click to toggle source

    static VALUE splaytree_get(VALUE self, VALUE key) {
            splaytree *tree = get_tree_from_self(self);
            return get(tree, key);
    }

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

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

            return Qtrue;
    }

height() click to toggle source

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

max_key() click to toggle source

    static VALUE splaytree_max_key(VALUE self) {
            splaytree *tree = get_tree_from_self(self);
            splaytree_node *node;

            if(!tree->root)
                    return Qnil;

            node = tree->root;
            while (node->right)
                    node = node->right;

            return node->key;
    }

min_key() click to toggle source

    static VALUE splaytree_min_key(VALUE self) {
            splaytree *tree = get_tree_from_self(self);
            splaytree_node *node;

            if(!tree->root)
                    return Qnil;

            node = tree->root;
            while (node->left)
                    node = node->left;

            return node->key;
    }

push(p1, p2) click to toggle source

    static VALUE splaytree_push(VALUE self, VALUE key, VALUE value) {
            splaytree *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 splaytree_size(VALUE self) {
            splaytree *tree = get_tree_from_self(self);
            if(!tree->root) { return INT2NUM(0); }
            return INT2NUM(tree->root->size);
    }

[Validate]

Generated with the Darkfish Rdoc Generator 2.