|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jjoost.util.filters.AcceptUnique<V>
public class AcceptUnique<V>
A Filter which returns true if and only if it has never seen the value being tested before,
using the provided set to maintain the previously visited set of values.
| Constructor Summary | |
|---|---|
AcceptUnique()
Construct a new AcceptUnique using default propreties (hash set using Object.equals() and Object.hashCode()) |
|
AcceptUnique(Set<V> set)
Construct a new AcceptUnique using the provided set to maintain the previously visited set of values |
|
| Method Summary | ||
|---|---|---|
boolean |
accept(V next)
Returns true if the Filter accepts the parameter and false otherwise |
|
static
|
get()
Returns a Filter which returns true if and only if it has never seen the value being tested before, using regular
object equality. |
|
static
|
get(Equality<? super V> eq)
Returns a Filter which returns true if and only if it has never seen the value being tested before, using the provided
equality. |
|
static
|
get(Set<V> set)
Returns a Filter which returns true if and only if it has never seen the value being tested before, using the provided
set to maintain all visited values, and hence the set's definition of equality. |
|
java.lang.String |
toString()
|
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public AcceptUnique()
AcceptUnique using default propreties (hash set using Object.equals() and Object.hashCode())
public AcceptUnique(Set<V> set)
AcceptUnique using the provided set to maintain the previously visited set of values
| Method Detail |
|---|
public boolean accept(V next)
Filtertrue if the Filter accepts the parameter and false otherwise
accept in interface Filter<V>next - value to test
true if the filter accepts test; false otherwisepublic java.lang.String toString()
toString in class java.lang.Objectpublic static <V> AcceptUnique<V> get()
Filter which returns true if and only if it has never seen the value being tested before, using regular
object equality. It maintains a set of all visited values and therefore can be expensive with respect to memory utilisation.
public static <V> AcceptUnique<V> get(Equality<? super V> eq)
Filter which returns true if and only if it has never seen the value being tested before, using the provided
equality. It maintains a set of all visited values and therefore can be expensive with respect to memory utilisation.
eq - the equality determining uniqueness
public static <V> AcceptUnique<V> get(Set<V> set)
Filter which returns true if and only if it has never seen the value being tested before, using the provided
set to maintain all visited values, and hence the set's definition of equality. This can be expensive with respect to memory utilisation.
set - the set to store visited values in
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||