1
2
3
4
5
6
7
8 package com.buckosoft.PicMan.util;
9
10 import com.buckosoft.PicMan.domain.Set;
11
12
13
14
15
16
17
18 public class SetsCRC {
19
20 private long crc = 0;
21
22 public long getCRC() {
23 return(crc);
24 }
25
26 public void addSet(Set set) {
27 int x = 1;
28 int i;
29 for (i=0; i<set.getName().length(); i++) {
30 int c = set.getName().charAt(i);
31 crc += c*x;
32 if (x++ > 5)
33 x = 1;
34 }
35 for (i=0; i<set.getDescription().length(); i++) {
36 int c = set.getDescription().charAt(i);
37 crc += c*x;
38 if (x++ > 5)
39 x = 1;
40 }
41 if (set.isMetaSet())
42 crc += x;
43 x++;
44 if (set.isMicroSet() || set.isNanoSet())
45 crc += x;
46 x++;
47
48 }
49 }