|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectjava.util.AbstractMap<K,V>
org.h2.dev.store.btree.MVMap<K,V>
K - the key classV - the value classpublic class MVMap<K,V>
A stored map.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class java.util.AbstractMap |
|---|
java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V> |
| Nested classes/interfaces inherited from interface java.util.Map |
|---|
java.util.Map.Entry<K,V> |
| Field Summary | |
|---|---|
protected Page |
root
The root page (may not be null). |
protected MVStore |
store
The store. |
| Constructor Summary | |
|---|---|
protected |
MVMap(MVStore store,
int id,
java.lang.String name,
DataType keyType,
DataType valueType,
long createVersion)
|
| Method Summary | |
|---|---|
protected java.lang.Object |
binarySearch(Page p,
java.lang.Object key)
Get the value for the given key, or null if not found. |
protected Page |
binarySearchPage(Page p,
java.lang.Object key)
Get the value for the given key, or null if not found. |
java.util.Iterator<K> |
changeIterator(long minVersion)
Iterate over all keys in changed pages. |
protected void |
checkOpen()
Check whether the map is open. |
protected void |
checkWrite()
Check whether writing is allowed. |
void |
clear()
Remove all entries. |
void |
close()
Close the map, making it read only and release the memory. |
boolean |
containsKey(java.lang.Object key)
|
java.util.Set<java.util.Map.Entry<K,V>> |
entrySet()
|
boolean |
equals(java.lang.Object o)
|
V |
get(java.lang.Object key)
Get a value. |
protected Page |
getPage(K key)
Get the page for the given value. |
Page |
getRoot()
Get the root page. |
long |
getSize()
|
int |
hashCode()
|
boolean |
hasUnsavedChanges()
Check whether this map has any unsaved changes. |
boolean |
isClosed()
|
boolean |
isReadOnly()
|
java.util.Iterator<K> |
keyIterator(K from)
Iterate over all keys. |
java.util.Set<K> |
keySet()
|
protected CursorPos |
min(Page p,
Cursor<K,V> cursor,
java.lang.Object key)
Go to the first element for the given key. |
protected java.lang.Object |
nextKey(CursorPos p,
Cursor<K,V> cursor)
Get the next key. |
MVMap<K,V> |
openVersion(long version)
Open an old version for the given map. |
V |
put(K key,
V value)
Add or replace a key-value pair. |
protected java.lang.Object |
put(Page p,
long writeVersion,
java.lang.Object key,
java.lang.Object value)
Add or update a key-value pair. |
V |
remove(java.lang.Object key)
Remove a key-value pair, if the key exists. |
protected java.lang.Object |
remove(Page p,
long writeVersion,
java.lang.Object key)
Remove a key-value pair. |
void |
removeMap()
Remove all entries, and close the map. |
protected void |
removePage(Page p)
Remove the given page (make the space available). |
void |
setReadOnly(boolean readOnly)
|
protected void |
setRoot(Page newRoot)
|
int |
size()
|
java.lang.String |
toString()
|
| Methods inherited from class java.util.AbstractMap |
|---|
clone, containsValue, isEmpty, putAll, values |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected final MVStore store
protected Page root
| Constructor Detail |
|---|
protected MVMap(MVStore store,
int id,
java.lang.String name,
DataType keyType,
DataType valueType,
long createVersion)
| Method Detail |
|---|
public V put(K key,
V value)
put in interface java.util.Map<K,V>put in class java.util.AbstractMap<K,V>key - the key (may not be null)value - the value (may not be null)
protected java.lang.Object put(Page p,
long writeVersion,
java.lang.Object key,
java.lang.Object value)
p - the pagewriteVersion - the write versionkey - the key (may not be null)value - the value (may not be null)
public V get(java.lang.Object key)
get in interface java.util.Map<K,V>get in class java.util.AbstractMap<K,V>key - the key
protected CursorPos min(Page p,
Cursor<K,V> cursor,
java.lang.Object key)
p - the current pagecursor - the cursorkey - the key
protected java.lang.Object nextKey(CursorPos p,
Cursor<K,V> cursor)
p - the cursor positioncursor - the cursor
protected java.lang.Object binarySearch(Page p,
java.lang.Object key)
p - the pagekey - the key
public boolean containsKey(java.lang.Object key)
containsKey in interface java.util.Map<K,V>containsKey in class java.util.AbstractMap<K,V>protected Page getPage(K key)
key - the key
protected Page binarySearchPage(Page p,
java.lang.Object key)
p - the parent pagekey - the key
public void clear()
clear in interface java.util.Map<K,V>clear in class java.util.AbstractMap<K,V>public void removeMap()
public void close()
public boolean isClosed()
public V remove(java.lang.Object key)
remove in interface java.util.Map<K,V>remove in class java.util.AbstractMap<K,V>key - the key (may not be null)
protected java.lang.Object remove(Page p,
long writeVersion,
java.lang.Object key)
p - the page (may not be null)writeVersion - the write versionkey - the key
protected void setRoot(Page newRoot)
public boolean hasUnsavedChanges()
public java.util.Iterator<K> keyIterator(K from)
from - the first key to return
public java.util.Iterator<K> changeIterator(long minVersion)
minVersion - the minimum version
public java.util.Set<java.util.Map.Entry<K,V>> entrySet()
entrySet in interface java.util.Map<K,V>entrySet in class java.util.AbstractMap<K,V>public java.util.Set<K> keySet()
keySet in interface java.util.Map<K,V>keySet in class java.util.AbstractMap<K,V>public Page getRoot()
public void setReadOnly(boolean readOnly)
public boolean isReadOnly()
protected void checkOpen()
java.lang.IllegalStateException - if the map is closedprotected void checkWrite()
java.lang.IllegalStateException - if the map is read-onlypublic java.lang.String toString()
toString in class java.util.AbstractMap<K,V>public int hashCode()
hashCode in interface java.util.Map<K,V>hashCode in class java.util.AbstractMap<K,V>public boolean equals(java.lang.Object o)
equals in interface java.util.Map<K,V>equals in class java.util.AbstractMap<K,V>public int size()
size in interface java.util.Map<K,V>size in class java.util.AbstractMap<K,V>public long getSize()
protected void removePage(Page p)
p - the pagepublic MVMap<K,V> openVersion(long version)
version - the version
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||