/** * Uses {@link Hash} to choose a random (but stable) value from within this field. * * @param step * Increments. For example, 15 if "H/15". Or {@link #NO_STEP} to indicate * the special constant for "H" without the step value. */ protected long doHash(int step, int field) throws ANTLRException { int u = UPPER_BOUNDS[field]; if (field==2) u = 28; // day of month can vary depending on month, so to make life simpler, just use [1,28] that's always safe if (field==4) u = 6; // Both 0 and 7 of day of week are Sunday. For better distribution, limit upper bound to 6 return doHash(LOWER_BOUNDS[field], u, step, field); }
/** * Uses {@link Hash} to choose a random (but stable) value from within this field. * * @param step * Increments. For example, 15 if "H/15". Or {@link #NO_STEP} to indicate * the special constant for "H" without the step value. */ protected long doHash(int step, int field) throws ANTLRException { int u = UPPER_BOUNDS[field]; if (field==2) u = 28; // day of month can vary depending on month, so to make life simpler, just use [1,28] that's always safe if (field==4) u = 6; // Both 0 and 7 of day of week are Sunday. For better distribution, limit upper bound to 6 return doHash(LOWER_BOUNDS[field], u, step, field); }