MCPcopy Create free account
hub / github.com/google/re2j / hashCode

Method hashCode

java/com/google/re2j/Regexp.java:288–316  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

286 }
287
288 @Override
289 public int hashCode() {
290 int hashcode = op.hashCode();
291 switch (op) {
292 case END_TEXT:
293 hashcode += 31 * (flags & RE2.WAS_DOLLAR);
294 break;
295 case LITERAL:
296 case CHAR_CLASS:
297 hashcode += 31 * Arrays.hashCode(runes);
298 break;
299 case ALTERNATE:
300 case CONCAT:
301 hashcode += 31 * Arrays.deepHashCode(subs);
302 break;
303 case STAR:
304 case PLUS:
305 case QUEST:
306 hashcode += 31 * (flags & RE2.NON_GREEDY) + 31 * subs[0].hashCode();
307 break;
308 case REPEAT:
309 hashcode += 31 * min + 31 * max + 31 * subs[0].hashCode();
310 break;
311 case CAPTURE:
312 hashcode += 31 * cap + 31 * (name != null ? name.hashCode() : 0) + 31 * subs[0].hashCode();
313 break;
314 }
315 return hashcode;
316 }
317
318 // equals() returns true if this and that have identical structure.
319 @Override

Callers 1

testEqualsMethod · 0.95

Calls

no outgoing calls

Tested by 1

testEqualsMethod · 0.76