1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 package org.archive.util.fingerprint;
26
27 /***
28 * Set for holding primitive long fingerprints.
29 *
30 * @author Gordon Mohr
31 */
32 public interface LongFPSet {
33 /***
34 * Add a fingerprint to the set. Note that subclasses can implement
35 * different policies on how to add - some might grow the available space,
36 * others might implement some type of LRU caching.
37 *
38 * In particular, you cannot on the {@link #count()} method returning
39 * 1 greater than before the addition.
40 *
41 * @param l the fingerprint to add
42 * @return <code>true</code> if set has changed with this addition
43 */
44 boolean add(long l);
45
46 /***
47 * Does this set contain a given fingerprint.
48 * @param l the fingerprint to check for
49 * @return <code>true</code> if the fingerprint is in the set
50 */
51 boolean contains(long l);
52
53 /***
54 * Remove a fingerprint from the set, if it is there
55 * @param l the fingerprint to remove
56 * @return <code>true</code> if we removed the fingerprint
57 */
58 boolean remove(long l);
59
60 /*** get the number of elements in the Set
61 * @return the number of elements in the Set
62 */
63 long count();
64
65 /***
66 * Do a contains() check that doesn't require laggy
67 * activity (eg disk IO). If this returns true,
68 * fp is definitely contained; if this returns
69 * false, fp *MAY* still be contained -- must use
70 * full-cost contains() to be sure.
71 *
72 * @param fp the fingerprint to check for
73 * @return <code>true</code> if contains the fingerprint
74 */
75 boolean quickContains(long fp);
76 }