Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.archive.crawler.settings
Class SoftSettingsHash

    java.lang.Object
      org.archive.crawler.settings.SoftSettingsHash

    public class SoftSettingsHash

extends java.lang.Object

Nested Class Summary
`(package private) class` | `SoftSettingsHash.EntryIterator` Iterator over all elements in hash.
`(package private) static class` | `SoftSettingsHash.SettingsEntry` The entries in this hash extend SoftReference, using the host string as the key.

Constructor Summary
`SoftSettingsHash(int initialCapacity)` Constructs a new, empty `SoftSettingsHash` with the given initial capacity.

Method Summary
`void` | `clear()` Removes all settings object from this hash.
`(package private) static boolean` | `eq(java.lang.Object x, java.lang.Object y)` Check for equality of non-null reference x and possibly-null y.
`CrawlerSettings` | `get(java.lang.String key)` Returns the value to which the specified key is mapped in this weak hash map, or `null` if the map contains no mapping for this key.
`(package private) static int` | `hash(java.lang.String key)` Make hash value from a String.
`(package private) static int` | `indexFor(int h, int length)` Return index for hash code h.
`SoftSettingsHash.EntryIterator` | `iterator()`
`CrawlerSettings` | `put(SoftSettingsHash.SettingsEntry entry)`
`CrawlerSettings` | `put(java.lang.String key, CrawlerSettings settings)` Associates the specified settings object with the specified key in this hash.
`java.lang.Object` | `remove(java.lang.String key)` Removes the settings object identified by the key from this hash if present.
`(package private) void` | `resize(int newCapacity)` Rehashes the contents of this hash into a new `HashMap` instance with a larger capacity.
`int` | `size()` Returns the number of key-value mappings in this map.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### SoftSettingsHash

    public SoftSettingsHash(int initialCapacity)

  Constructs a new, empty `SoftSettingsHash` with the given initial capacity.

  Parameters:
    `initialCapacity` - The initial capacity of the `SoftSettingsHash`
  Throws:
    `java.lang.IllegalArgumentException` - If the initial capacity is negative.

Method Detail

### eq

    static boolean eq(java.lang.Object x,
                      java.lang.Object y)

  Check for equality of non-null reference x and possibly-null y. By default uses Object.equals.

### indexFor

    static int indexFor(int h,
                        int length)

  Return index for hash code h.

### size

    public int size()

  Returns the number of key-value mappings in this map. This result is a snapshot, and may not reflect unprocessed entries that will be removed before next attempted access because they are no longer referenced.

### get

    public CrawlerSettings get(java.lang.String key)

  Returns the value to which the specified key is mapped in this weak hash map, or `null` if the map contains no mapping for this key. Null is also returned if the element has been GC'ed.

  Parameters:
    `key` - the key whose associated settings object is to be returned.
  Returns:
    the settings object represented by the key, or `null` if the map contains no mapping for this key.
  See Also:
    `put(String, CrawlerSettings)`

### put

    public CrawlerSettings put(java.lang.String key,
                               CrawlerSettings settings)

  Associates the specified settings object with the specified key in this hash. If the hash previously contained a settings object for this key, the old object is replaced.

  Parameters:
    `key` - key with which the specified settings object is to be associated.
    `settings` - settings object to be associated with the specified key.
  Returns:
    previous value associated with specified key, or `null` if there was no mapping for key.

### put

    public CrawlerSettings put(SoftSettingsHash.SettingsEntry entry)

### resize

    void resize(int newCapacity)

  Rehashes the contents of this hash into a new `HashMap` instance with a larger capacity. This method is called automatically when the number of keys in this map exceeds its capacity and load factor. Note that this method is a no-op if it's called with newCapacity == 2*MAXIMUM_CAPACITY (which is Integer.MIN_VALUE).

  Parameters:
    `newCapacity` - the new capacity, MUST be a power of two.

### remove

    public java.lang.Object remove(java.lang.String key)

  Removes the settings object identified by the key from this hash if present.

  Parameters:
    `key` - key whose element is to be removed from the hash.
  Returns:
    previous value associated with specified key, or `null` if there was no mapping for key.

### clear

    public void clear()

  Removes all settings object from this hash.

### hash

    static int hash(java.lang.String key)

  Make hash value from a String.

  Parameters:
    `key` - the string for which to create hash value.
  Returns:
    the hash value.

### iterator

    public SoftSettingsHash.EntryIterator iterator()

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2008 Internet Archive. All Rights Reserved.