uka.util
Class IntIntHashBijection

java.lang.Object
  extended byuka.util.IDConstants
      extended byuka.util.IntIntHashBijection
All Implemented Interfaces:
Printable, java.io.Serializable

public class IntIntHashBijection
extends IDConstants
implements java.io.Serializable, Printable

Author:
Bernhard Haumacher
See Also:
Serialized Form

Nested Class Summary
static class IntIntHashBijection.Entry
           
static interface IntIntHashBijection.Iterator
           
 
Field Summary
private  IntIntHashBijection.Entry all
           
private  int expandAt
           
private  IntHashFunction hashFunction1
           
private  IntHashFunction hashFunction2
           
private  int INVALID_VALUE1
           
private  int INVALID_VALUE2
           
private  int size
           
private  IntIntHashBijection.Entry[] table1
           
private  IntIntHashBijection.Entry[] table2
           
 
Fields inherited from class uka.util.IDConstants
FIRST_NEW_ID, FIRST_VALID_ID, INVALID_ID, UNUSED_ID
 
Constructor Summary
IntIntHashBijection()
           
IntIntHashBijection(int INVALID_VALUE1, int INVALID_VALUE2)
           
 
Method Summary
 void appendTo(ToString s)
          This method should append the contents of each instance variable of the current object to the given ToString object.
 void clear()
           
protected  IntIntHashBijection.Entry createEntry(int value1, int value2)
          Factory method for creating new entries.
 void dump()
           
private  void ensureCapacity(int size)
           
private  IntIntHashBijection.Entry getEntry1(int hash, int value1)
           
private  IntIntHashBijection.Entry getEntry2(int hash, int value2)
           
protected  int getHash1(int value1)
           
protected  int getHash2(int value2)
           
private  int getIndex(int hash)
           
 int getSize()
           
 int getValue1(int value2)
           
 int getValue2(int value1)
           
private  void init(int INVALID_VALUE1, int INVALID_VALUE2)
           
private  void insert(IntIntHashBijection.Entry newe)
           
 IntIntHashBijection.Iterator iterator()
           
 void put(int value1, int value2)
           
private  void readObject(java.io.ObjectInputStream in)
           
protected  void remove(IntIntHashBijection.Entry e)
           
 void remove1(int value1)
           
private  void remove1(int hash1, int value1)
           
 void remove2(int value2)
           
private  void remove2(int hash2, int value2)
           
private  void setHashSize(int size)
           
 java.lang.String toString()
           
private  void writeObject(java.io.ObjectOutputStream out)
          For serializing an instance of this class, it has to be externalized, because weak references are not serializable.
 
Methods inherited from class uka.util.IDConstants
isNew, isValid, normalizeID, toggleNew
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

INVALID_VALUE1

private int INVALID_VALUE1

INVALID_VALUE2

private int INVALID_VALUE2

hashFunction1

private IntHashFunction hashFunction1

hashFunction2

private IntHashFunction hashFunction2

all

private IntIntHashBijection.Entry all

table1

private IntIntHashBijection.Entry[] table1

table2

private IntIntHashBijection.Entry[] table2

size

private int size

expandAt

private int expandAt
Constructor Detail

IntIntHashBijection

public IntIntHashBijection()

IntIntHashBijection

public IntIntHashBijection(int INVALID_VALUE1,
                           int INVALID_VALUE2)
Method Detail

init

private void init(int INVALID_VALUE1,
                  int INVALID_VALUE2)

getSize

public int getSize()

getIndex

private int getIndex(int hash)

getHash1

protected int getHash1(int value1)

getHash2

protected int getHash2(int value2)

iterator

public IntIntHashBijection.Iterator iterator()

ensureCapacity

private void ensureCapacity(int size)

setHashSize

private void setHashSize(int size)

getEntry1

private IntIntHashBijection.Entry getEntry1(int hash,
                                            int value1)

getValue2

public int getValue2(int value1)

getEntry2

private IntIntHashBijection.Entry getEntry2(int hash,
                                            int value2)

getValue1

public int getValue1(int value2)

insert

private void insert(IntIntHashBijection.Entry newe)

remove1

public void remove1(int value1)

remove2

public void remove2(int value2)

remove1

private void remove1(int hash1,
                     int value1)

remove2

private void remove2(int hash2,
                     int value2)

remove

protected void remove(IntIntHashBijection.Entry e)

createEntry

protected IntIntHashBijection.Entry createEntry(int value1,
                                                int value2)
Factory method for creating new entries. May be overridden in subclasses.


put

public void put(int value1,
                int value2)

clear

public void clear()

writeObject

private void writeObject(java.io.ObjectOutputStream out)
                  throws java.io.IOException
For serializing an instance of this class, it has to be externalized, because weak references are not serializable. Only objects that are currently alive can be marshaled and inserted to the unmarshaled copy. Therefore, the validity of identifiers may differ from the copy that is marshaled and the copy that is unmarshaled.

Throws:
java.io.IOException

readObject

private void readObject(java.io.ObjectInputStream in)
                 throws java.io.IOException,
                        java.lang.ClassNotFoundException
Throws:
java.io.IOException
java.lang.ClassNotFoundException

toString

public java.lang.String toString()

dump

public void dump()

appendTo

public void appendTo(ToString s)
Description copied from interface: Printable
This method should append the contents of each instance variable of the current object to the given ToString object. The appended data should be labeled with the name of the corresponding instance variable.

Specified by:
appendTo in interface Printable
See Also:
ToString, ToString.append(String, Object), ToString.append(String, boolean), ToString.append(String, byte), ToString.append(String, int)