|
Copyright 2008 - 2009 Tony Morris, Runar Bjarnason, Tom Adams, Brad Clow, Ricky Clarkson, Nick Partridge, Jason Zaugg This software is released under an open source BSD licence. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectfj.data.Set<A>
public abstract class Set<A>
Provides an in-memory, immutable set, implemented as a red/black tree.
Method Summary | ||
---|---|---|
|
bind(Ord<B> o,
F<A,Set<B>> f)
Binds the given function across this set. |
|
protected abstract fj.data.Set.Color |
color()
|
|
F<A,F<Set<A>,Set<A>>> |
delete()
First-class deletion function. |
|
Set<A> |
delete(A a)
Deletes the given element from this set. |
|
static
|
empty(Ord<A> ord)
The empty set. |
|
Set<A> |
filter(F<A,Boolean> f)
Filters elements from this set by returning only elements which produce true
when the given function is applied to them. |
|
|
foldMap(F<A,B> f,
Monoid<B> m)
Folds this Set using the given monoid. |
|
static
|
insert()
First-class insertion function. |
|
Set<A> |
insert(A x)
Inserts the given element into this set. |
|
Set<A> |
intersect(Set<A> s)
Remove all elements from this set that do not occur in the given set. |
|
boolean |
isEmpty()
|
|
static
|
iterableSet(Ord<A> o,
Iterable<A> as)
Return the elements of the given iterable as a set. |
|
Iterator<A> |
iterator()
Returns an iterator over this set. |
|
static
|
join(Ord<A> o,
Set<Set<A>> s)
Join a set of sets into a single set. |
|
|
map(Ord<B> o,
F<A,B> f)
Maps the given function across this set. |
|
static
|
member()
First-class membership check. |
|
boolean |
member(A x)
Checks if the given element is a member of this set. |
|
Set<A> |
minus(Set<A> s)
Remove all elements from this set that occur in the given set. |
|
Ord<A> |
ord()
Returns the order of this Set. |
|
static
|
single(Ord<A> o,
A a)
Returns a set with a single element. |
|
int |
size()
Returns the size of this set. |
|
P3<Set<A>,Option<A>,Set<A>> |
split(A a)
Splits this set at the given element. |
|
boolean |
subsetOf(Set<A> s)
Returns true if this set is a subset of the given set. |
|
List<A> |
toList()
Returns a list representation of this set. |
|
Stream<A> |
toStream()
Returns a stream representation of this set. |
|
Set<A> |
union(Set<A> s)
Add all the elements of the given set to this set. |
|
P2<Boolean,Set<A>> |
update(A a,
F<A,A> f)
Updates, with the given function, the first element in the set that is equal to the given element, according to the order. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public boolean isEmpty()
protected abstract fj.data.Set.Color color()
public Ord<A> ord()
public P2<Boolean,Set<A>> update(A a, F<A,A> f)
a
- An element to replace.f
- A function to transforms the found element.
public static <A> Set<A> empty(Ord<A> ord)
ord
- An order for the type of elements.
public boolean member(A x)
x
- An element to check for membership in this set.
public static <A> F<Set<A>,F<A,Boolean>> member()
public Set<A> insert(A x)
x
- An element to insert into this set.
public static <A> F<A,F<Set<A>,Set<A>>> insert()
public Iterator<A> iterator()
iterator
in interface Iterable<A>
public static <A> Set<A> single(Ord<A> o, A a)
o
- An order for the type of element.a
- An element to put in a set.
public <B> Set<B> map(Ord<B> o, F<A,B> f)
o
- An order for the elements of the new set.f
- A function to map across this set.
public <B> B foldMap(F<A,B> f, Monoid<B> m)
f
- A transformation from this Set's elements, to the monoid.m
- The monoid to fold this Set with.
public List<A> toList()
public Stream<A> toStream()
public <B> Set<B> bind(Ord<B> o, F<A,Set<B>> f)
o
- An order for the elements of the target set.f
- A function to bind across this set.
public Set<A> union(Set<A> s)
s
- A set to add to this set.
public Set<A> filter(F<A,Boolean> f)
true
when the given function is applied to them.
f
- The predicate function to filter on.
public Set<A> delete(A a)
a
- an element to remove.
public F<A,F<Set<A>,Set<A>>> delete()
public Set<A> intersect(Set<A> s)
s
- A set of elements to retain.
public Set<A> minus(Set<A> s)
s
- A set of elements to delete.
public int size()
public P3<Set<A>,Option<A>,Set<A>> split(A a)
a
- A value at which to split this set.
public boolean subsetOf(Set<A> s)
s
- A set which is a superset of this set if this method returns true.
public static <A> Set<A> join(Ord<A> o, Set<Set<A>> s)
s
- A set of sets.o
- An order for the elements of the new set.
public static <A> Set<A> iterableSet(Ord<A> o, Iterable<A> as)
o
- An order for the elements of the new set.as
- An iterable of elements to add to a set.
|
Copyright 2008 - 2009 Tony Morris, Runar Bjarnason, Tom Adams, Brad Clow, Ricky Clarkson, Nick Partridge, Jason Zaugg This software is released under an open source BSD licence. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |