public static NameN construct(String name, int hash, int[] q, int qlen) { /* We have specialized implementations for shorter * names, so let's not allow runt instances here */ if (qlen < 4) { throw new IllegalArgumentException(); } int q1 = q[0]; int q2 = q[1]; int q3 = q[2]; int q4 = q[3]; int rem = qlen - 4; int[] buf; if (rem > 0) { buf = Arrays.copyOfRange(q, 4, qlen); } else { buf = null; } return new NameN(name, hash, q1, q2, q3, q4, buf, qlen); }
@Override public boolean equals(int[] quads, int len) { if (len != qlen) { return false; } // Will always have >= 4 quads, can unroll if (quads[0] != q1) return false; if (quads[1] != q2) return false; if (quads[2] != q3) return false; if (quads[3] != q4) return false; switch (len) { default: return _equals2(quads); case 8: if (quads[7] != q[3]) return false; case 7: if (quads[6] != q[2]) return false; case 6: if (quads[5] != q[1]) return false; case 5: if (quads[4] != q[0]) return false; case 4: } return true; }
private static Name constructName(int hash, String name, int[] quads, int qlen) { if (qlen < 4) { // Need to check for 3 quad one, can do others too switch (qlen) { case 1: return new Name1(name, hash, quads[0]); case 2: return new Name2(name, hash, quads[0], quads[1]); case 3: return new Name3(name, hash, quads[0], quads[1], quads[2]); default: } } return NameN.construct(name, hash, quads, qlen); }
private static Name constructName(int hash, String name, int[] quads, int qlen) { if (qlen < 4) { // Need to check for 3 quad one, can do others too switch (qlen) { case 1: return new Name1(name, hash, quads[0]); case 2: return new Name2(name, hash, quads[0], quads[1]); case 3: return new Name3(name, hash, quads[0], quads[1], quads[2]); default: } } return NameN.construct(name, hash, quads, qlen); }
public static NameN construct(String name, int hash, int[] q, int qlen) { /* We have specialized implementations for shorter * names, so let's not allow runt instances here */ if (qlen < 4) { throw new IllegalArgumentException(); } int q1 = q[0]; int q2 = q[1]; int q3 = q[2]; int q4 = q[3]; int rem = qlen - 4; int[] buf; if (rem > 0) { buf = Arrays.copyOfRange(q, 4, qlen); } else { buf = null; } return new NameN(name, hash, q1, q2, q3, q4, buf, qlen); }
@Override public boolean equals(int[] quads, int len) { if (len != qlen) { return false; } // Will always have >= 4 quads, can unroll if (quads[0] != q1) return false; if (quads[1] != q2) return false; if (quads[2] != q3) return false; if (quads[3] != q4) return false; switch (len) { default: return _equals2(quads); case 8: if (quads[7] != q[3]) return false; case 7: if (quads[6] != q[2]) return false; case 6: if (quads[5] != q[1]) return false; case 5: if (quads[4] != q[0]) return false; case 4: } return true; }
public static NameN construct(String name, int hash, int[] q, int qlen) { /* We have specialized implementations for shorter * names, so let's not allow runt instances here */ if (qlen < 4) { throw new IllegalArgumentException(); } int q1 = q[0]; int q2 = q[1]; int q3 = q[2]; int q4 = q[3]; int rem = qlen - 4; int[] buf; if (rem > 0) { buf = Arrays.copyOfRange(q, 4, qlen); } else { buf = null; } return new NameN(name, hash, q1, q2, q3, q4, buf, qlen); }
@Override public boolean equals(int[] quads, int len) { if (len != qlen) { return false; } // Will always have >= 4 quads, can unroll if (quads[0] != q1) return false; if (quads[1] != q2) return false; if (quads[2] != q3) return false; if (quads[3] != q4) return false; switch (len) { default: return _equals2(quads); case 8: if (quads[7] != q[3]) return false; case 7: if (quads[6] != q[2]) return false; case 6: if (quads[5] != q[1]) return false; case 5: if (quads[4] != q[0]) return false; case 4: } return true; }
public static NameN construct(String name, int hash, int[] q, int qlen) { /* We have specialized implementations for shorter * names, so let's not allow runt instances here */ if (qlen < 4) { throw new IllegalArgumentException(); } int q1 = q[0]; int q2 = q[1]; int q3 = q[2]; int q4 = q[3]; int rem = qlen - 4; int[] buf; if (rem > 0) { buf = Arrays.copyOfRange(q, 4, qlen); } else { buf = null; } return new NameN(name, hash, q1, q2, q3, q4, buf, qlen); }
@Override public boolean equals(int[] quads, int len) { if (len != qlen) { return false; } // Will always have >= 4 quads, can unroll if (quads[0] != q1) return false; if (quads[1] != q2) return false; if (quads[2] != q3) return false; if (quads[3] != q4) return false; switch (len) { default: return _equals2(quads); case 8: if (quads[7] != q[3]) return false; case 7: if (quads[6] != q[2]) return false; case 6: if (quads[5] != q[1]) return false; case 5: if (quads[4] != q[0]) return false; case 4: } return true; }
public static NameN construct(String name, int hash, int[] q, int qlen) { /* We have specialized implementations for shorter * names, so let's not allow runt instances here */ if (qlen < 4) { throw new IllegalArgumentException(); } int q1 = q[0]; int q2 = q[1]; int q3 = q[2]; int q4 = q[3]; int rem = qlen - 4; int[] buf; if (rem > 0) { buf = Arrays.copyOfRange(q, 4, qlen); } else { buf = null; } return new NameN(name, hash, q1, q2, q3, q4, buf, qlen); }
@Override public boolean equals(int[] quads, int len) { if (len != qlen) { return false; } // Will always have >= 4 quads, can unroll if (quads[0] != q1) return false; if (quads[1] != q2) return false; if (quads[2] != q3) return false; if (quads[3] != q4) return false; switch (len) { default: return _equals2(quads); case 8: if (quads[7] != q[3]) return false; case 7: if (quads[6] != q[2]) return false; case 6: if (quads[5] != q[1]) return false; case 5: if (quads[4] != q[0]) return false; case 4: } return true; }
private static Name constructName(int hash, String name, int[] quads, int qlen) { if (qlen < 4) { // Need to check for 3 quad one, can do others too switch (qlen) { case 1: return new Name1(name, hash, quads[0]); case 2: return new Name2(name, hash, quads[0], quads[1]); case 3: return new Name3(name, hash, quads[0], quads[1], quads[2]); default: } } // Otherwise, need to copy the incoming buffer int[] buf = new int[qlen]; for (int i = 0; i < qlen; ++i) { buf[i] = quads[i]; } return new NameN(name, hash, buf, qlen); }
private static Name constructName(int hash, String name, int[] quads, int qlen) { if (qlen < 4) { // Need to check for 3 quad one, can do others too switch (qlen) { case 1: return new Name1(name, hash, quads[0]); case 2: return new Name2(name, hash, quads[0], quads[1]); case 3: return new Name3(name, hash, quads[0], quads[1], quads[2]); default: } } // Otherwise, need to copy the incoming buffer int[] buf = new int[qlen]; for (int i = 0; i < qlen; ++i) { buf[i] = quads[i]; } return new NameN(name, hash, buf, qlen); }