|
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.pre.Hash<A>
public final class Hash<A>
Produces a hash code for an object which should attempt uniqueness.
Field Summary | |
---|---|
static Hash<Boolean> |
booleanHash
A hash instance for the boolean type. |
static Hash<Byte> |
byteHash
A hash instance for the byte type. |
static Hash<Character> |
charHash
A hash instance for the char type. |
static Hash<Double> |
doubleHash
A hash instance for the double type. |
static Hash<Float> |
floatHash
A hash instance for the float type. |
static Hash<Integer> |
intHash
A hash instance for the int type. |
static Hash<Long> |
longHash
A hash instance for the long type. |
static Hash<Short> |
shortHash
A hash instance for the short type. |
static Hash<StringBuffer> |
stringBufferHash
A hash instance for the StringBuffer type. |
static Hash<StringBuilder> |
stringBuilderHash
A hash instance for the StringBuilder type. |
static Hash<String> |
stringHash
A hash instance for the String type. |
Method Summary | ||
---|---|---|
static
|
anyHash()
A hash that uses Object.hashCode() . |
|
static
|
arrayHash(Hash<A> ha)
A hash instance for the Array type. |
|
|
comap(F<B,A> g)
Maps the given function across this hash as a contra-variant functor. |
|
static
|
eitherHash(Hash<A> ha,
Hash<B> hb)
A hash instance for the Either type. |
|
int |
hash(A a)
Compute the hash of the given value. |
|
static
|
hash(F<A,Integer> f)
Construct a hash with the given hash function. |
|
static
|
listHash(Hash<A> ha)
A hash instance for the List type. |
|
static
|
nonEmptyListHash(Hash<A> ha)
A hash instance for the NonEmptyList type. |
|
static
|
optionHash(Hash<A> ha)
A hash instance for the Option type. |
|
static
|
p1Hash(Hash<A> ha)
A hash instance for a product-1. |
|
static
|
p2Hash(Hash<A> ha,
Hash<B> hb)
A hash instance for a product-2. |
|
static
|
p3Hash(Hash<A> ha,
Hash<B> hb,
Hash<C> hc)
A hash instance for a product-3. |
|
static
|
p4Hash(Hash<A> ha,
Hash<B> hb,
Hash<C> hc,
Hash<D> hd)
A hash instance for a product-4. |
|
static
|
p5Hash(Hash<A> ha,
Hash<B> hb,
Hash<C> hc,
Hash<D> hd,
Hash<E> he)
A hash instance for a product-5. |
|
static
|
p6Hash(Hash<A> ha,
Hash<B> hb,
Hash<C> hc,
Hash<D> hd,
Hash<E> he,
Hash<F$> hf)
A hash instance for a product-6. |
|
static
|
p7Hash(Hash<A> ha,
Hash<B> hb,
Hash<C> hc,
Hash<D> hd,
Hash<E> he,
Hash<F$> hf,
Hash<G> hg)
A hash instance for a product-7. |
|
static
|
p8Hash(Hash<A> ha,
Hash<B> hb,
Hash<C> hc,
Hash<D> hd,
Hash<E> he,
Hash<F$> hf,
Hash<G> hg,
Hash<H> hh)
A hash instance for a product-8. |
|
static
|
streamHash(Hash<A> ha)
A hash instance for the Stream type. |
|
static
|
treeHash(Hash<A> ha)
A hash instance for the Tree type. |
|
static
|
v2Hash(Hash<A> ea)
A hash instance for a vector-2. |
|
static
|
v3Hash(Hash<A> ea)
A hash instance for a vector-3. |
|
static
|
v4Hash(Hash<A> ea)
A hash instance for a vector-4. |
|
static
|
v5Hash(Hash<A> ea)
A hash instance for a vector-5. |
|
static
|
v6Hash(Hash<A> ea)
A hash instance for a vector-6. |
|
static
|
v7Hash(Hash<A> ea)
A hash instance for a vector-7. |
|
static
|
v8Hash(Hash<A> ea)
A hash instance for a vector-8. |
|
static
|
validationHash(Hash<A> ha,
Hash<B> hb)
A hash instance for the Validation type. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final Hash<Boolean> booleanHash
boolean
type.
public static final Hash<Byte> byteHash
byte
type.
public static final Hash<Character> charHash
char
type.
public static final Hash<Double> doubleHash
double
type.
public static final Hash<Float> floatHash
float
type.
public static final Hash<Integer> intHash
int
type.
public static final Hash<Long> longHash
long
type.
public static final Hash<Short> shortHash
short
type.
public static final Hash<String> stringHash
String
type.
public static final Hash<StringBuffer> stringBufferHash
StringBuffer
type.
public static final Hash<StringBuilder> stringBuilderHash
StringBuilder
type.
Method Detail |
---|
public int hash(A a)
a
- The value to compute the hash value for.
public <B> Hash<B> comap(F<B,A> g)
g
- The function to map.
public static <A> Hash<A> hash(F<A,Integer> f)
f
- The function to construct the hash with.
public static <A> Hash<A> anyHash()
Object.hashCode()
.
Object.hashCode()
.public static <A,B> Hash<Either<A,B>> eitherHash(Hash<A> ha, Hash<B> hb)
Either
type.
ha
- Hash the left side of Either
.hb
- Hash the right side of Either
.
Either
type.public static <A,B> Hash<Validation<A,B>> validationHash(Hash<A> ha, Hash<B> hb)
Validation
type.
ha
- Hash the failing side of Validation
.hb
- Hash the succeeding side of Validation
.
Validation
type.public static <A> Hash<List<A>> listHash(Hash<A> ha)
List
type.
ha
- A hash for the elements of the list.
List
type.public static <A> Hash<NonEmptyList<A>> nonEmptyListHash(Hash<A> ha)
NonEmptyList
type.
ha
- A hash for the elements of the non-empty list.
NonEmptyList
type.public static <A> Hash<Option<A>> optionHash(Hash<A> ha)
Option
type.
ha
- A hash for the element of the optional value.
Option
type.public static <A> Hash<Stream<A>> streamHash(Hash<A> ha)
Stream
type.
ha
- A hash for the elements of the stream.
Stream
type.public static <A> Hash<Array<A>> arrayHash(Hash<A> ha)
Array
type.
ha
- A hash for the elements of the array.
Array
type.public static <A> Hash<Tree<A>> treeHash(Hash<A> ha)
Tree
type.
ha
- A hash for the elements of the tree.
Tree
type.public static <A> Hash<P1<A>> p1Hash(Hash<A> ha)
ha
- A hash for the first element of the product.
public static <A,B> Hash<P2<A,B>> p2Hash(Hash<A> ha, Hash<B> hb)
ha
- A hash for the first element of the product.hb
- A hash for the second element of the product.
public static <A,B,C> Hash<P3<A,B,C>> p3Hash(Hash<A> ha, Hash<B> hb, Hash<C> hc)
ha
- A hash for the first element of the product.hb
- A hash for the second element of the product.hc
- A hash for the third element of the product.
public static <A,B,C,D> Hash<P4<A,B,C,D>> p4Hash(Hash<A> ha, Hash<B> hb, Hash<C> hc, Hash<D> hd)
ha
- A hash for the first element of the product.hb
- A hash for the second element of the product.hc
- A hash for the third element of the product.hd
- A hash for the fourth element of the product.
public static <A,B,C,D,E> Hash<P5<A,B,C,D,E>> p5Hash(Hash<A> ha, Hash<B> hb, Hash<C> hc, Hash<D> hd, Hash<E> he)
ha
- A hash for the first element of the product.hb
- A hash for the second element of the product.hc
- A hash for the third element of the product.hd
- A hash for the fourth element of the product.he
- A hash for the fifth element of the product.
public static <A,B,C,D,E,F$> Hash<P6<A,B,C,D,E,F$>> p6Hash(Hash<A> ha, Hash<B> hb, Hash<C> hc, Hash<D> hd, Hash<E> he, Hash<F$> hf)
ha
- A hash for the first element of the product.hb
- A hash for the second element of the product.hc
- A hash for the third element of the product.hd
- A hash for the fourth element of the product.he
- A hash for the fifth element of the product.hf
- A hash for the sixth element of the product.
public static <A,B,C,D,E,F$,G> Hash<P7<A,B,C,D,E,F$,G>> p7Hash(Hash<A> ha, Hash<B> hb, Hash<C> hc, Hash<D> hd, Hash<E> he, Hash<F$> hf, Hash<G> hg)
ha
- A hash for the first element of the product.hb
- A hash for the second element of the product.hc
- A hash for the third element of the product.hd
- A hash for the fourth element of the product.he
- A hash for the fifth element of the product.hf
- A hash for the sixth element of the product.hg
- A hash for the seventh element of the product.
public static <A,B,C,D,E,F$,G,H> Hash<P8<A,B,C,D,E,F$,G,H>> p8Hash(Hash<A> ha, Hash<B> hb, Hash<C> hc, Hash<D> hd, Hash<E> he, Hash<F$> hf, Hash<G> hg, Hash<H> hh)
ha
- A hash for the first element of the product.hb
- A hash for the second element of the product.hc
- A hash for the third element of the product.hd
- A hash for the fourth element of the product.he
- A hash for the fifth element of the product.hf
- A hash for the sixth element of the product.hg
- A hash for the seventh element of the product.hh
- A hash for the eighth element of the product.
public static <A> Hash<V2<A>> v2Hash(Hash<A> ea)
ea
- A hash for the elements of the vector.
public static <A> Hash<V3<A>> v3Hash(Hash<A> ea)
ea
- A hash for the elements of the vector.
public static <A> Hash<V4<A>> v4Hash(Hash<A> ea)
ea
- A hash for the elements of the vector.
public static <A> Hash<V5<A>> v5Hash(Hash<A> ea)
ea
- A hash for the elements of the vector.
public static <A> Hash<V6<A>> v6Hash(Hash<A> ea)
ea
- A hash for the elements of the vector.
public static <A> Hash<V7<A>> v7Hash(Hash<A> ea)
ea
- A hash for the elements of the vector.
public static <A> Hash<V8<A>> v8Hash(Hash<A> ea)
ea
- A hash for the elements of the vector.
|
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 |