Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.strangeberry.rendezvous
Class DNSCache  view DNSCache download DNSCache.java

java.lang.Object
  extended bycom.strangeberry.rendezvous.DNSCache

class DNSCache
extends java.lang.Object

A table of DNS entries. This is a closed hash table which can handle multiple entries with the same name. It provides iterators to efficiently iterate over all the entries with a given name.

Version:
1.11, 11/29/2002

Nested Class Summary
private  class DNSCache.IterateAll
          Iterate over all entries.
private  class DNSCache.IterateKey
          Iterate over some entries.
 
Field Summary
(package private)  int count
           
(package private)  DNSEntry[] entries
           
(package private) static float LOAD_FACTOR
           
(package private)  float loadFactor
           
 
Constructor Summary
(package private) DNSCache(int size)
          Create a table with a given initial size.
 
Method Summary
(package private)  void add(DNSEntry entry)
          Add an entry to the table.
private  void add(DNSEntry[] entries, DNSEntry entry)
          Add an entry to a table.
(package private)  java.util.Iterator all()
          Iterate over all entries.
(package private)  java.util.Iterator find(java.lang.String name)
          Iterate only over items with matching name.
(package private)  DNSEntry get(DNSEntry entry)
          Get a matching DNS entry from the table (using equals).
(package private)  DNSEntry get(java.lang.String name, int type, int clazz)
          Get a matching DNS entry from the table.
(package private)  void print()
          List all entries for debugging.
private  DNSEntry[] rehash(DNSEntry[] entries, int size)
          Rehash a table.
(package private)  boolean remove(DNSEntry entry)
          Remove a specific entry from the table.
private  void remove(int i)
          Remove entry at a given index.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOAD_FACTOR

static final float LOAD_FACTOR
See Also:
Constant Field Values

entries

DNSEntry[] entries

count

int count

loadFactor

float loadFactor
Constructor Detail

DNSCache

DNSCache(int size)
Create a table with a given initial size.

Method Detail

add

void add(DNSEntry entry)
Add an entry to the table. The table will be grown if it is more than 75% full.


add

private void add(DNSEntry[] entries,
                 DNSEntry entry)
Add an entry to a table.


rehash

private DNSEntry[] rehash(DNSEntry[] entries,
                          int size)
Rehash a table.


remove

boolean remove(DNSEntry entry)
Remove a specific entry from the table. Returns true if the entry was found.


remove

private void remove(int i)
Remove entry at a given index. Reshuffle as needed.


get

DNSEntry get(DNSEntry entry)
Get a matching DNS entry from the table (using equals). Returns the entry that was found.


get

DNSEntry get(java.lang.String name,
             int type,
             int clazz)
Get a matching DNS entry from the table.


all

java.util.Iterator all()
Iterate over all entries.


find

java.util.Iterator find(java.lang.String name)
Iterate only over items with matching name.


print

void print()
List all entries for debugging.