|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.terrier.structures.collections.FSOrderedMapFile<K,V>
K - Type of the keysV - Type of the valuespublic class FSOrderedMapFile<K extends org.apache.hadoop.io.WritableComparable,V extends org.apache.hadoop.io.Writable>
An implementation of java.util.Map that can be accessed from disk. Key and value types are assumed to have a fixed size. Their factories must be passed to the constructor. In the name, FSOrderedMapFile, FS stands for Fixed Size.
| Nested Class Summary | |
|---|---|
static class |
FSOrderedMapFile.EntryIterator<IK extends org.apache.hadoop.io.Writable,IV extends org.apache.hadoop.io.Writable>
an iterator for entries. |
static interface |
FSOrderedMapFile.FSOMapFileBSearchShortcut<KEY>
interface FSOMapFileBSearchShortcut |
static class |
FSOrderedMapFile.MapFileInMemory<IK extends org.apache.hadoop.io.Writable,IV extends org.apache.hadoop.io.Writable>
MapFileInMemory class |
static interface |
FSOrderedMapFile.MapFileWriter
Interface for writing a FSOMapFile |
static class |
FSOrderedMapFile.MultiFSOMapWriter
Writes out a FSOMapFile, but assumes that input data need not be sorted by key. |
| Nested classes/interfaces inherited from interface java.util.Map |
|---|
java.util.Map.Entry<K,V> |
| Field Summary | |
|---|---|
protected RandomDataInput |
dataFile
actual underlying data file |
protected java.lang.String |
dataFilename
filename of the underlying file |
protected int |
entrySize
total size of one key,value pair |
protected FixedSizeWriteableFactory<K> |
keyFactory
|
protected static org.apache.log4j.Logger |
logger
The logger used for this class |
protected int |
numberOfEntries
The number of entries in the file. |
protected FSOrderedMapFile.FSOMapFileBSearchShortcut<K> |
shortcut
|
static java.lang.String |
USUAL_EXTENSION
USUAL_EXTENSION |
protected FixedSizeWriteableFactory<V> |
valueFactory
|
| Constructor Summary | |
|---|---|
FSOrderedMapFile(Index index,
java.lang.String structureName)
constructor |
|
FSOrderedMapFile(RandomDataInput file,
java.lang.String filename,
FixedSizeWriteableFactory<K> _keyFactory,
FixedSizeWriteableFactory<V> _valueFactory)
constructor |
|
FSOrderedMapFile(java.lang.String filename,
boolean updateable,
FixedSizeWriteableFactory<K> _keyFactory,
FixedSizeWriteableFactory<V> _valueFactory)
Construct a new object to access the underlying file data structure |
|
| Method Summary | |
|---|---|
protected void |
_clear()
|
void |
clear()
Remove all entries from this map |
void |
close()
|
boolean |
containsKey(java.lang.Object o)
|
boolean |
containsValue(java.lang.Object o)
|
java.util.Set<java.util.Map.Entry<K,V>> |
entrySet()
|
java.util.Map.Entry<K,V> |
get(int entryNumber)
Return the entry at the specified index |
V |
get(java.lang.Object _key)
|
protected java.util.Map.Entry<K,V> |
getEntry(K key)
this method is the one which does the actual disk lookup of entries |
WriteableFactory<K> |
getKeyFactory()
Get the key factory |
WriteableFactory<V> |
getValueFactory()
Get the value factory |
boolean |
isEmpty()
|
java.util.Set<K> |
keySet()
|
static FSOrderedMapFile.MapFileWriter |
mapFileWrite(java.lang.String filename)
returns a utility class which can be used to write a FSOrderedMapFile. |
static void |
mapFileWrite(java.lang.String filename,
java.lang.Iterable<java.util.Map.Entry<org.apache.hadoop.io.WritableComparable,org.apache.hadoop.io.Writable>> t)
writes an entire map FSOrderedMapFile at once, to the specified filename, and using the data contained in the specified iterator |
static void |
mapFileWrite(java.lang.String filename,
java.util.Iterator<java.util.Map.Entry<org.apache.hadoop.io.WritableComparable,org.apache.hadoop.io.Writable>> ti)
writes an entire map FSOrderedMapFile at once, to the specified filename, and using the data contained in the specified iterator |
static int |
numberOfEntries(java.lang.String filename,
FixedSizeWriteableFactory<?> _keyFactory,
FixedSizeWriteableFactory<?> _valueFactory)
Return number of entries |
V |
put(K key,
V value)
|
void |
putAll(java.util.Map<? extends K,? extends V> m)
|
V |
remove(java.lang.Object _key)
|
void |
setBSearchShortcut(FSOrderedMapFile.FSOMapFileBSearchShortcut<K> _shortcut)
Set the FSOMapFileBSearchShortcut |
int |
size()
Returns the number of entries in this map |
java.util.Collection<V> |
values()
|
protected RandomDataOutput |
write()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface java.util.Map |
|---|
equals, hashCode |
| Field Detail |
|---|
public static final java.lang.String USUAL_EXTENSION
protected static final org.apache.log4j.Logger logger
protected RandomDataInput dataFile
protected java.lang.String dataFilename
protected int numberOfEntries
protected int entrySize
protected FSOrderedMapFile.FSOMapFileBSearchShortcut<K extends org.apache.hadoop.io.WritableComparable> shortcut
protected FixedSizeWriteableFactory<K extends org.apache.hadoop.io.WritableComparable> keyFactory
protected FixedSizeWriteableFactory<V extends org.apache.hadoop.io.Writable> valueFactory
| Constructor Detail |
|---|
public FSOrderedMapFile(Index index,
java.lang.String structureName)
throws java.io.IOException
index - structureName -
java.io.IOException
public FSOrderedMapFile(java.lang.String filename,
boolean updateable,
FixedSizeWriteableFactory<K> _keyFactory,
FixedSizeWriteableFactory<V> _valueFactory)
throws java.io.IOException
filename - Filename of the file containing the structureupdateable - Whether the file can be updated in this JVM_keyFactory - factory object for keys_valueFactory - factory object for values
java.io.IOException - thrown if an IO problem occurs
public FSOrderedMapFile(RandomDataInput file,
java.lang.String filename,
FixedSizeWriteableFactory<K> _keyFactory,
FixedSizeWriteableFactory<V> _valueFactory)
throws java.io.IOException
file - filename - _keyFactory - _valueFactory -
java.io.IOException| Method Detail |
|---|
protected RandomDataOutput write()
public static int numberOfEntries(java.lang.String filename,
FixedSizeWriteableFactory<?> _keyFactory,
FixedSizeWriteableFactory<?> _valueFactory)
filename - _keyFactory - _valueFactory -
public WriteableFactory<K> getKeyFactory()
public WriteableFactory<V> getValueFactory()
public void clear()
clear in interface java.util.Map<K extends org.apache.hadoop.io.WritableComparable,V extends org.apache.hadoop.io.Writable>protected void _clear()
public java.util.Set<java.util.Map.Entry<K,V>> entrySet()
entrySet in interface java.util.Map<K extends org.apache.hadoop.io.WritableComparable,V extends org.apache.hadoop.io.Writable>public java.util.Set<K> keySet()
keySet in interface java.util.Map<K extends org.apache.hadoop.io.WritableComparable,V extends org.apache.hadoop.io.Writable>public java.util.Collection<V> values()
values in interface java.util.Map<K extends org.apache.hadoop.io.WritableComparable,V extends org.apache.hadoop.io.Writable>public int size()
size in interface java.util.Map<K extends org.apache.hadoop.io.WritableComparable,V extends org.apache.hadoop.io.Writable>public boolean containsValue(java.lang.Object o)
containsValue in interface java.util.Map<K extends org.apache.hadoop.io.WritableComparable,V extends org.apache.hadoop.io.Writable>public boolean containsKey(java.lang.Object o)
containsKey in interface java.util.Map<K extends org.apache.hadoop.io.WritableComparable,V extends org.apache.hadoop.io.Writable>public boolean isEmpty()
isEmpty in interface java.util.Map<K extends org.apache.hadoop.io.WritableComparable,V extends org.apache.hadoop.io.Writable>
public V put(K key,
V value)
put in interface java.util.Map<K extends org.apache.hadoop.io.WritableComparable,V extends org.apache.hadoop.io.Writable>public V remove(java.lang.Object _key)
remove in interface java.util.Map<K extends org.apache.hadoop.io.WritableComparable,V extends org.apache.hadoop.io.Writable>public void setBSearchShortcut(FSOrderedMapFile.FSOMapFileBSearchShortcut<K> _shortcut)
protected java.util.Map.Entry<K,V> getEntry(K key)
public V get(java.lang.Object _key)
get in interface java.util.Map<K extends org.apache.hadoop.io.WritableComparable,V extends org.apache.hadoop.io.Writable>public java.util.Map.Entry<K,V> get(int entryNumber)
get in interface OrderedMap<K extends org.apache.hadoop.io.WritableComparable,V extends org.apache.hadoop.io.Writable>public void putAll(java.util.Map<? extends K,? extends V> m)
putAll in interface java.util.Map<K extends org.apache.hadoop.io.WritableComparable,V extends org.apache.hadoop.io.Writable>
public void close()
throws java.io.IOException
close in interface java.io.Closeablejava.io.IOException
public static void mapFileWrite(java.lang.String filename,
java.lang.Iterable<java.util.Map.Entry<org.apache.hadoop.io.WritableComparable,org.apache.hadoop.io.Writable>> t)
throws java.io.IOException
java.io.IOException
public static void mapFileWrite(java.lang.String filename,
java.util.Iterator<java.util.Map.Entry<org.apache.hadoop.io.WritableComparable,org.apache.hadoop.io.Writable>> ti)
throws java.io.IOException
java.io.IOException
public static FSOrderedMapFile.MapFileWriter mapFileWrite(java.lang.String filename)
throws java.io.IOException
java.io.IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||