|
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.Enumerator<A>
public final class Enumerator<A>
Abstracts over a type that may have a successor and/or predecessor value. This implies ordering for that type. A user
may construct an enumerator with an optimised version for plus
, otherwise a default is implemented using
the given successor/predecessor implementations.
Field Summary | |
---|---|
static Enumerator<BigDecimal> |
bigdecimalEnumerator
An enumerator for BigDecimal . |
static Enumerator<BigInteger> |
bigintEnumerator
An enumerator for BigInteger . |
static Enumerator<Boolean> |
booleanEnumerator
An enumerator for boolean . |
static Enumerator<Byte> |
byteEnumerator
An enumerator for byte . |
static Enumerator<Character> |
charEnumerator
An enumerator for char . |
static Enumerator<Double> |
doubleEnumerator
An enumerator for double . |
static Enumerator<Float> |
floatEnumerator
An enumerator for float . |
static Enumerator<Integer> |
intEnumerator
An enumerator for int . |
static Enumerator<Long> |
longEnumerator
An enumerator for long . |
static Enumerator<Natural> |
naturalEnumerator
An enumerator for Natural |
static Enumerator<Ordering> |
orderingEnumerator
An enumerator for Ordering . |
static Enumerator<Short> |
shortEnumerator
An enumerator for short . |
Method Summary | ||
---|---|---|
static
|
enumerator(F<A,Option<A>> successor,
F<A,Option<A>> predecessor,
Option<A> max,
Option<A> min,
Ord<A> order)
Construct an enumerator. |
|
static
|
enumerator(F<A,Option<A>> successor,
F<A,Option<A>> predecessor,
Option<A> max,
Option<A> min,
Ord<A> order,
F<A,F<Long,Option<A>>> plus)
Construct an enumerator. |
|
Option<A> |
max()
Returns the maximum value for this enumerator if there is one. |
|
Option<A> |
min()
Returns the minimum value for this enumerator if there is one. |
|
Ord<A> |
order()
Returns the ordering for the enumerator. |
|
F<A,F<Long,Option<A>>> |
plus()
Returns a function that moves a value along the enumerator a given number of times. |
|
F<Long,Option<A>> |
plus(A a)
Returns a function that moves a value along the enumerator a given number of times. |
|
Option<A> |
plus(A a,
long l)
Moves a value along the enumerator a given number of times. |
|
F<A,Option<A>> |
plus(long l)
Returns a function that moves a value along the enumerator a given number of times. |
|
F<A,Option<A>> |
predecessor()
Returns the potential predecessor of a value for this enumerator in curried form. |
|
Option<A> |
predecessor(A a)
Returns the potential predecessor of a value for this enumerator. |
|
Enumerator<A> |
setMax(Option<A> max)
Create a new enumerator with the given maximum value. |
|
Enumerator<A> |
setMin(Option<A> min)
Create a new enumerator with the given minimum value. |
|
F<A,Option<A>> |
successor()
Returns the potential successor of a value for this enumerator in curried form. |
|
Option<A> |
successor(A a)
Returns the potential successor of a value for this enumerator. |
|
Stream<A> |
toStream(A a)
Returns a stream of the values from this enumerator, starting at the given value, counting up. |
|
|
xmap(F<A,B> f,
F<B,A> g)
Invariant functor map over this enumerator. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final Enumerator<Boolean> booleanEnumerator
boolean
.
public static final Enumerator<Byte> byteEnumerator
byte
.
public static final Enumerator<Character> charEnumerator
char
.
public static final Enumerator<Double> doubleEnumerator
double
.
public static final Enumerator<Float> floatEnumerator
float
.
public static final Enumerator<Integer> intEnumerator
int
.
public static final Enumerator<BigInteger> bigintEnumerator
BigInteger
.
public static final Enumerator<BigDecimal> bigdecimalEnumerator
BigDecimal
.
public static final Enumerator<Long> longEnumerator
long
.
public static final Enumerator<Short> shortEnumerator
short
.
public static final Enumerator<Ordering> orderingEnumerator
Ordering
.
public static final Enumerator<Natural> naturalEnumerator
Natural
Method Detail |
---|
public F<A,Option<A>> successor()
public Option<A> successor(A a)
a
- The value to return the successor of.
public F<A,Option<A>> predecessor()
public Option<A> predecessor(A a)
a
- The value to return the predecessor of.
public Option<A> max()
public Option<A> min()
public F<A,F<Long,Option<A>>> plus()
public F<Long,Option<A>> plus(A a)
a
- The value to begin moving along from.
public F<A,Option<A>> plus(long l)
l
- The number of times to move along the enumerator.
public Option<A> plus(A a, long l)
a
- The value to begin moving along from.l
- The number of times to move along the enumerator.
public Ord<A> order()
public <B> Enumerator<B> xmap(F<A,B> f, F<B,A> g)
f
- The covariant map.g
- The contra-variant map.
public Stream<A> toStream(A a)
a
- A value at which to begin the stream.
public Enumerator<A> setMin(Option<A> min)
min
- A minimum value.
public Enumerator<A> setMax(Option<A> max)
max
- A maximum value.
public static <A> Enumerator<A> enumerator(F<A,Option<A>> successor, F<A,Option<A>> predecessor, Option<A> max, Option<A> min, Ord<A> order, F<A,F<Long,Option<A>>> plus)
successor
- The successor function.predecessor
- The predecessor function.max
- The potential maximum value.min
- The potential minimum value.order
- The ordering for the type.plus
- The function to move the enumeration a given number of times. This may be supplied for a performance
enhancement for certain types.
public static <A> Enumerator<A> enumerator(F<A,Option<A>> successor, F<A,Option<A>> predecessor, Option<A> max, Option<A> min, Ord<A> order)
plus
function is derived from the successor
and
predecessor
.
successor
- The successor function.predecessor
- The predecessor function.max
- The potential maximum value.min
- The potential minimum value.order
- The ordering for the type.
|
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 |