Sharkysoft home

lava.util
Class DuplicateIdentifier

java.lang.Object
  |
  +--lava.util.DuplicateIdentifier

public class DuplicateIdentifier
extends java.lang.Object

Identifies duplicates in an Object stream.

Details: DuplicateIdentifier observes a stream of Objects and determines whether elements in the stream are repeats of previously seen Objects. A repeat is any Object that has the same hash value as a previously seen Object and which is also equal to that Object, as determined by the equals method.

Since:
1999.04.14
Version:
2000.07.08
Author:
Sharky

Constructor Summary
DuplicateIdentifier()
           
 
Method Summary
protected  void finalize()
          Clears memory.
 void forget(java.lang.Object obj)
          Forgets object.
 boolean isUnique(java.lang.Object obj)
          Determines uniqueness of Object.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DuplicateIdentifier

public DuplicateIdentifier()
Method Detail

isUnique

public boolean isUnique(java.lang.Object obj)
Determines uniqueness of Object.

Details: isUnique remembers the given Object and determines whether its equal has been previously seen in an earlier isUnique call. If the Object's equal has never been seen, isUnique returns true, false otherwise.

Parameters:
obj - the Object
Returns:
true iff the object's equal has not been seen

finalize

protected void finalize()
Clears memory.

Details: finalize releases Objects from the memory used to identify duplicates.

Overrides:
finalize in class java.lang.Object
Parameters:
-  
Returns:
 
Throws:
-  
Since:
1999

forget

public void forget(java.lang.Object obj)
Forgets object.

Details: forget causes this DuplicateIdentifier to forget that it ever saw the given object. A subsequent call to isUnique on the given object will return true as a result, regardless of whether the object has been previously seen or not.

Parameters:
obj - the object
Since:
2000.07.08

Sharkysoft home