searchDesign
Class StorageTable

java.lang.Object
  |
  +--java.util.Dictionary
        |
        +--searchDesign.StorageTable

public class StorageTable
extends java.util.Dictionary
implements java.lang.Cloneable, java.io.Serializable, StorageInterface

eine moegliche Datenstruktur Ich benutze - wie auf dem letzten Aufgabenblatt der woechentlichen Seminar-Aufgaben vorgeschlagen - einen geaenderten Quelltext der Klasse java.util.Hashtable im wesentlichen war eine aenderung notwendig: die table muss in der Lage sein, zu akkumulieren (DD im Index, positionen und spaces in KD)

See Also:
Serialized Form

Constructor Summary
StorageTable()
          Constructs a new, empty StorageTable with a default capacity and load factor, which is 0.75.
StorageTable(int initialCapacity)
          Constructs a new, empty StorageTable with the specified initial capacity and default load factor, which is 0.75.
StorageTable(int initialCapacity, float loadFactor)
          Constructs a new, empty StorageTable with the specified initial capacity and the specified load factor.
StorageTable(java.util.Map t)
          Constructs a new StorageTable with the same mappings as the given Map.
 
Method Summary
 Data[] asDataArray()
          Erzeugt aus der Datenstruktur ein Array mit Data-Objekten und gibt dieses zurück.
 void clear()
          Clears this StorageTable so that it contains no keys.
 java.lang.Object clone()
          Creates a shallow copy of this StorageTable.
 boolean contains(java.lang.Object value)
          Tests if some key maps into the specified value in this StorageTable.
 boolean containsKey(java.lang.Object key)
          Tests if the specified object is a key in this StorageTable.
 boolean containsValue(java.lang.Object value)
          Returns true if this StorageTable maps one or more keys to this value. Note that this method is identical in functionality to contains (which predates the Map interface).
 java.util.Enumeration elements()
          Returns an enumeration of the values in this StorageTable.
 java.lang.Object get(java.lang.Object key)
          Returns the value to which the specified key is mapped in this StorageTable.
 boolean isEmpty()
          Tests if this StorageTable maps no keys to values.
 java.util.Enumeration keys()
          Returns an enumeration of the keys in this StorageTable.
 void put(Data newData)
          Fügt newData in die Direktzugriffsstruktur ein.
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
          die put() von Sun, ausser aenderung im falle von identischem key, hier nicht element in der liste ersetzen mit neuem, sondern akkumulieren durch die add() von Data (d.h entweder DocumentData oder Spaces und Positions)
 void putAll(java.util.Map t)
          Copies all of the mappings from the specified Map to this StorageTable These mappings will replace any mappings that this StorageTable had for any of the keys currently in the specified Map.
protected  void rehash()
          Increases the capacity of and internally reorganizes this StorageTable, in order to accommodate and access its entries more efficiently.
 java.lang.Object remove(java.lang.Object key)
          Removes the key (and its corresponding value) from this StorageTable.
 int size()
          Returns the number of keys in this StorageTable.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StorageTable

public StorageTable(int initialCapacity,
                    float loadFactor)
Constructs a new, empty StorageTable with the specified initial capacity and the specified load factor.
Parameters:
initialCapacity - the initial capacity of the StorageTable.
loadFactor - the load factor of the StorageTable.
Throws:
java.lang.IllegalArgumentException - if the initial capacity is less than zero, or if the load factor is nonpositive.

StorageTable

public StorageTable(int initialCapacity)
Constructs a new, empty StorageTable with the specified initial capacity and default load factor, which is 0.75.
Parameters:
initialCapacity - the initial capacity of the StorageTable.
Throws:
java.lang.IllegalArgumentException - if the initial capacity is less than zero.

StorageTable

public StorageTable()
Constructs a new, empty StorageTable with a default capacity and load factor, which is 0.75.

StorageTable

public StorageTable(java.util.Map t)
Constructs a new StorageTable with the same mappings as the given Map. The StorageTable is created with a capacity of twice the number of entries in the given Map or 11 (whichever is greater), and a default load factor, which is 0.75.
Parameters:
t - the map whose mappings are to be placed in this map.
Since:
1.2
Method Detail

put

public void put(Data newData)
Fügt newData in die Direktzugriffsstruktur ein. Fall der Key von newData bereits darin enthalten ist, wird die Methode add von Data aufgerufen.
Specified by:
put in interface StorageInterface
Parameters:
newData - Das neu einzufügende Data-Objekt

asDataArray

public Data[] asDataArray()
Erzeugt aus der Datenstruktur ein Array mit Data-Objekten und gibt dieses zurück.
Specified by:
asDataArray in interface StorageInterface
Returns:
Data-Array

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)
die put() von Sun, ausser aenderung im falle von identischem key, hier nicht element in der liste ersetzen mit neuem, sondern akkumulieren durch die add() von Data (d.h entweder DocumentData oder Spaces und Positions)
Overrides:
put in class java.util.Dictionary
Parameters:
key - der key unter dem gespeichert wird
value - der zu speichernde wert

size

public int size()
Returns the number of keys in this StorageTable.
Specified by:
size in interface StorageInterface
Overrides:
size in class java.util.Dictionary
Returns:
the number of keys in this StorageTable.

isEmpty

public boolean isEmpty()
Tests if this StorageTable maps no keys to values.
Overrides:
isEmpty in class java.util.Dictionary
Returns:
true if this StorageTable maps no keys to values; false otherwise.

keys

public java.util.Enumeration keys()
Returns an enumeration of the keys in this StorageTable.
Overrides:
keys in class java.util.Dictionary
Returns:
an enumeration of the keys in this StorageTable.
See Also:
Enumeration, elements(), #keySet(), Map

elements

public java.util.Enumeration elements()
Returns an enumeration of the values in this StorageTable. Use the Enumeration methods on the returned object to fetch the elements sequentially.
Overrides:
elements in class java.util.Dictionary
Returns:
an enumeration of the values in this StorageTable.
See Also:
Enumeration, keys(), #values(), Map

contains

public boolean contains(java.lang.Object value)
Tests if some key maps into the specified value in this StorageTable. This operation is more expensive than the containsKey method.

Note that this method is identical in functionality to containsValue, (which is part of the Map interface in the collections framework).

Parameters:
value - a value to search for.
Returns:
true if and only if some key maps to the value argument in this StorageTable as determined by the equals method; false otherwise.
Throws:
NullPointerException - if the value is null.
See Also:
containsKey(Object), containsValue(Object), Map

containsValue

public boolean containsValue(java.lang.Object value)
Returns true if this StorageTable maps one or more keys to this value.

Note that this method is identical in functionality to contains (which predates the Map interface).

Parameters:
value - value whose presence in this StorageTable is to be tested.
Returns:
true if this map maps one or more keys to the specified value.
Since:
1.2
See Also:
Map

containsKey

public boolean containsKey(java.lang.Object key)
Tests if the specified object is a key in this StorageTable.
Parameters:
key - possible key.
Returns:
true if and only if the specified object is a key in this StorageTable, as determined by the equals method; false otherwise.
See Also:
contains(Object)

get

public java.lang.Object get(java.lang.Object key)
Returns the value to which the specified key is mapped in this StorageTable.
Specified by:
get in interface StorageInterface
Overrides:
get in class java.util.Dictionary
Parameters:
key - a key in the StorageTable.
Returns:
the value to which the key is mapped in this StorageTable; null if the key is not mapped to any value in this StorageTable.
See Also:
put(Object, Object)

rehash

protected void rehash()
Increases the capacity of and internally reorganizes this StorageTable, in order to accommodate and access its entries more efficiently. This method is called automatically when the number of keys in the StorageTable exceeds this StorageTable's capacity and load factor.

remove

public java.lang.Object remove(java.lang.Object key)
Removes the key (and its corresponding value) from this StorageTable. This method does nothing if the key is not in the StorageTable.
Overrides:
remove in class java.util.Dictionary
Parameters:
key - the key that needs to be removed.
Returns:
the value to which the key had been mapped in this StorageTable, or null if the key did not have a mapping.

putAll

public void putAll(java.util.Map t)
Copies all of the mappings from the specified Map to this StorageTable These mappings will replace any mappings that this StorageTable had for any of the keys currently in the specified Map.
Parameters:
t - Mappings to be stored in this map.
Since:
1.2

clear

public void clear()
Clears this StorageTable so that it contains no keys.

clone

public java.lang.Object clone()
Creates a shallow copy of this StorageTable. All the structure of the StorageTable itself is copied, but the keys and values are not cloned. This is a relatively expensive operation.
Overrides:
clone in class java.lang.Object
Returns:
a clone of the StorageTable.