Package gnu.kawa.util
Interface BoundedHashable
-
- All Known Subinterfaces:
AVector<E>
,CharSeq
,GVector<E>
,IntSequence
,Sequence<E>
- All Known Implementing Classes:
AbstractCharVector
,ArgListPair
,ArgListVector
,BitVector
,Blob
,ByteVector
,CharBuffer
,CharVector
,ComposedArray.AsSequence
,EmptyList
,F32Vector
,F64Vector
,FlattenedArray
,FString
,FVector
,GeneralArray1
,ImmutablePair
,IndirectIndexedSeq
,IntVector
,IString
,IString.SubString
,LList
,LongVector
,Nodes.NodeVector
,Pair
,PairWithPosition
,PrimIntegerVector
,Range
,Range.IntRange
,RAPair
,S16Vector
,S32Vector
,S64Vector
,S8Vector
,ShortVector
,SimpleVector
,SubSequence
,SyntaxForms.PairSyntaxForm
,SyntaxForms.PairWithPositionSyntaxForm
,Translator.FormStack
,U16Vector
,U32Vector
,U64Vector
,U8Vector
public interface BoundedHashable
Supports computing a hash-code while protecting against cycles.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description int
boundedHash(int seed, int limit)
Calculate a hash code for this object.
-
-
-
Method Detail
-
boundedHash
int boundedHash(int seed, int limit)
Calculate a hash code for this object.- Parameters:
seed
- The seed is an initial value, or the accumulated hash code from previous elements in a containing object. Using zero as the seed is fine.limit
- A limit on the number of sub-elements whose hash we should calculate. This guards against cycles. Any recursive calls should be done with a smaller value of limit, and no recursive calls must be done when the limit is zero.- Returns:
- A well-dispersed hash code.
The result is not compatible with
Object#hashCode
.
-
-