@Test public void searchAidHash() throws NoSuchFieldException, IllegalAccessException { addItem(AID_BASIC, HASH_BASIC, RULE_BASIC); RuleEntry re = RuleEntry.searchAidHash(TestUtils.concatByteArray(AID_BASIC, HASH_BASIC), (short) 0, (byte) AID_BASIC.length, (short) AID_BASIC.length, (byte) HASH_BASIC.length); assertNotNull(re); assertEquals(re.getAidLength(), AID_BASIC.length); byte[] aidData = new byte[AID_BASIC.length]; byte[] hashData = new byte[HASH_BASIC.length]; byte[] ruleData = new byte[RULE_BASIC.length]; assertEquals(AID_BASIC.length, re.getAid(aidData, (short) 0)); assertEquals(HASH_BASIC.length, re.getHash(hashData, (short) 0)); assertEquals(RULE_BASIC.length, re.getRule(ruleData, (short) 0)); assertArrayEquals(AID_BASIC, aidData); assertArrayEquals(HASH_BASIC, hashData); assertArrayEquals(RULE_BASIC, ruleData); }
static RuleEntry searchAidHash(byte[] buf, short aidOfs, byte aidLen, short hashOfs, byte hashLen) { for (RuleEntry re = first; re != null; re = re.next) { if (re.aidLength != aidLen || re.hashLength != hashLen) continue; if (Util.arrayCompare(re.aid, (short) 0, buf, aidOfs, aidLen) == 0 && Util.arrayCompare(re.hash, (short) 0, buf, hashOfs, hashLen) == 0) return re; } return null; }
RuleEntry { static RuleEntry searchAidHash(byte[] buf, short aidOfs, byte aidLen, short hashOfs, byte hashLen) { for (RuleEntry re = first; re != null; re = re.next) { if (re.aidLength != aidLen || re.hashLength != hashLen) continue; if (Util.arrayCompare(re.aid, (short) 0, buf, aidOfs, aidLen) == 0 && Util.arrayCompare(re.hash, (short) 0, buf, hashOfs, hashLen) == 0) return re; } return null; } }
RuleEntry { static RuleEntry searchAidHash(byte[] buf, short aidOfs, byte aidLen, short hashOfs, byte hashLen) { for (RuleEntry re = first; re != null; re = re.next) { if (re.aidLength != aidLen || re.hashLength != hashLen) continue; if (Util.arrayCompare(re.aid, (short) 0, buf, aidOfs, aidLen) == 0 && Util.arrayCompare(re.hash, (short) 0, buf, hashOfs, hashLen) == 0) return re; } return null; } private  RuleEntry(); }
RuleEntry { static RuleEntry searchAidHash(byte[] buf, short aidOfs, byte aidLen, short hashOfs, byte hashLen) { for (RuleEntry re = first; re != null; re = re.next) { if (re.aidLength != aidLen || re.hashLength != hashLen) continue; if (Util.arrayCompare(re.aid, (short) 0, buf, aidOfs, aidLen) == 0 && Util.arrayCompare(re.hash, (short) 0, buf, hashOfs, hashLen) == 0) return re; } return null; } private  RuleEntry(); static RuleEntry getFirst(); byte getAidLength(); byte getHashLength(); byte getRuleLength(); RuleEntry getNext(); void setAid(byte[] buf, short ofs, byte len); void setHash(byte[] buf, short ofs, byte len); void setRule(byte[] buf, short ofs, byte len); }
RuleEntry { static RuleEntry searchAidHash(byte[] buf, short aidOfs, byte aidLen, short hashOfs, byte hashLen) { for (RuleEntry re = first; re != null; re = re.next) { if (re.aidLength != aidLen || re.hashLength != hashLen) continue; if (Util.arrayCompare(re.aid, (short) 0, buf, aidOfs, aidLen) == 0 && Util.arrayCompare(re.hash, (short) 0, buf, hashOfs, hashLen) == 0) return re; } return null; } private  RuleEntry(); static RuleEntry getFirst(); byte getAidLength(); byte getHashLength(); byte getRuleLength(); RuleEntry getNext(); void setAid(byte[] buf, short ofs, byte len); void setHash(byte[] buf, short ofs, byte len); void setRule(byte[] buf, short ofs, byte len);  }