Revision 9acb2402
Added by Leszek Koltunski over 5 years ago
| src/main/java/org/distorted/scores/RubikScoresDownloader.java | ||
|---|---|---|
| 103 | 103 |
private static int computeHash(String name, String veri, String country, String lvllist, |
| 104 | 104 |
String objlist, String timelist, int runnings) |
| 105 | 105 |
{
|
| 106 |
return 0; |
|
| 106 |
int length, hash = 0; |
|
| 107 |
|
|
| 108 |
length = name.length(); |
|
| 109 |
for(int i=0; i<length; i++) hash += i*name.charAt(i); |
|
| 110 |
length = veri.length(); |
|
| 111 |
for(int i=0; i<length; i++) hash += i*veri.charAt(i); |
|
| 112 |
length = country.length(); |
|
| 113 |
for(int i=0; i<length; i++) hash += i*country.charAt(i); |
|
| 114 |
length = lvllist.length(); |
|
| 115 |
for(int i=0; i<length; i++) hash += i*lvllist.charAt(i); |
|
| 116 |
length = objlist.length(); |
|
| 117 |
for(int i=0; i<length; i++) hash += i*objlist.charAt(i); |
|
| 118 |
length = timelist.length(); |
|
| 119 |
for(int i=0; i<length; i++) hash += i*timelist.charAt(i); |
|
| 120 |
|
|
| 121 |
hash *= runnings; |
|
| 122 |
hash %= 541; |
|
| 123 |
|
|
| 124 |
return hash<0 ? -hash: hash; |
|
| 107 | 125 |
} |
| 108 | 126 |
|
| 109 | 127 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
Implement computeHash()