javautils.dispensers
Class DispenserWithoutDuplicatesDecorator

java.lang.Object
  |
  +--javautils.dispensers.AbstractDispenser
        |
        +--javautils.dispensers.DispenserWithoutDuplicatesDecorator
All Implemented Interfaces:
Dispenser

public class DispenserWithoutDuplicatesDecorator
extends AbstractDispenser

A Decorator [Gamma1995] that filters out duplicates.


Constructor Summary
DispenserWithoutDuplicatesDecorator(Dispenser original)
          A new dispenser without duplicates.
 
Method Summary
 java.lang.Object pop()
          Chooses the next element to be processed, removes it from the dispenser, and returns the element.
 void push(java.lang.Object element)
          Adds a new element into the dispenser.
 int size()
          Number of elements in the dispenser.
 
Methods inherited from class javautils.dispensers.AbstractDispenser
isEmpty, notEmpty, pushAll, pushAll, pushAllRight
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DispenserWithoutDuplicatesDecorator

public DispenserWithoutDuplicatesDecorator(Dispenser original)

A new dispenser without duplicates. The client should never use the original dispenser directly.

Method Detail

size

public int size()
Description copied from interface: Dispenser

Number of elements in the dispenser.


pop

public java.lang.Object pop()
Description copied from interface: Dispenser

Chooses the next element to be processed, removes it from the dispenser, and returns the element.


push

public void push(java.lang.Object element)
Description copied from interface: Dispenser

Adds a new element into the dispenser.