Package squidpony.squidmath
Interface IPointHash
- All Known Subinterfaces:
FlawedPointHash
- All Known Implementing Classes:
FlawedPointHash.CubeHash
,FlawedPointHash.FNVHash
,FlawedPointHash.QuiltHash
,FlawedPointHash.RugHash
,GoldPointHash
,HastyPointHash
,IntPointHash
,IPointHash.IntImpl
,IPointHash.LongImpl
,PointHash
public interface IPointHash
An interface for "point hashes", that is, functions that produce usually-unique integer results given multiple
integer inputs. The hash functions this guarantees an implementor will provide all take int inputs and return an int.
There are lots of cases where an implementor would have other functions that take long inputs or return longs, and in
those cases the interface methods would probably be implemented by delegating to the long inputs and/or casting the
result to a long. Implementors must have a
Created by Tommy Ettinger on 4/13/2020.
setState(int)
function, but it doesn't have to do anything if the
algorithm doesn't support a state; similarly, hashWithState(int, int, int)
can return the same thing as
hash(int, int)
if states aren't supported. If states are supported, then calling hash(int, int)
while the state is, for example, 42 should be the same as calling hashWithState(int, int, int)
with a state
parameter of 42 (regardless of what the state actually is in the implementor).
Created by Tommy Ettinger on 4/13/2020.
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
IPointHash.IntImpl
A convenience abstract class to implement IPointHash when you have an int for state.static class
IPointHash.LongImpl
A convenience abstract class to implement IPointHash when you have a long for state. -
Method Summary
Modifier and Type Method Description int
hash(int x, int y)
int
hash(int x, int y, int z)
int
hash(int x, int y, int z, int w)
int
hash(int x, int y, int z, int w, int u, int v)
int
hashWithState(int x, int y, int state)
int
hashWithState(int x, int y, int z, int state)
int
hashWithState(int x, int y, int z, int w, int state)
int
hashWithState(int x, int y, int z, int w, int u, int v, int state)
void
setState(int state)