Mercurial > hg > Members > shoshi > AADS
view src/tree/BTreeMap.java @ 0:a9cb12a7f995
hg init
author | misaka |
---|---|
date | Wed, 06 Jul 2011 15:19:52 +0900 |
parents | |
children |
line wrap: on
line source
package tree; import java.util.ArrayList; import java.util.Iterator; public class BTreeMap<K extends Comparable<K>,V> implements Map<K,V> { private final int order; public BTreeMap(int order) { this.order = order; } @Override public void put(K _key, V _value) { } @Override public V get(K _key) { return null; } public V remove(K _key) { return null; } private static abstract class Node<K extends Comparable<K>,V> { @Override public abstract String toString(); } private class Link<K extends Comparable<K>,V> { public K key; public Node<K,V> node; public Link(K key,Node<K,V> node) { this.key = key; this.node = node; } } private class Bucket<K extends Comparable<K>,V> extends Node<K,V> { private final int order; private ArrayList<Link<K,V>> children; public Bucket(int order) { this.order = order; children = new ArrayList<Link<K,V>>(this.order+2); } @Override public String toString() { return "bucket"; } } private class Leaf<K extends Comparable<K>,V> extends Node<K,V> { public K key; public V value; public Leaf(K key,V value) { this.key = key; this.value = value; } @Override public String toString() { return String.format("key = %s , value = %s",key,value); } } }