/** * Get a singleton instance of hash function of a type * defined in the configuration. * @param conf current configuration * @return defined hash type, or null if type is invalid */ public static Hash getInstance(Configuration conf) { int type = getHashType(conf); return getInstance(type); }
/** * Constructor. * <p> * Builds a hash function that must obey to a given maximum number of returned values and a highest value. * @param maxValue The maximum highest returned value. * @param nbHash The number of resulting hashed values. * @param hashType type of the hashing function (see {@link Hash}). */ public HashFunction(int maxValue, int nbHash, int hashType) { if (maxValue <= 0) { throw new IllegalArgumentException("maxValue must be > 0"); } if (nbHash <= 0) { throw new IllegalArgumentException("nbHash must be > 0"); } this.maxValue = maxValue; this.nbHash = nbHash; this.hashFunction = Hash.getInstance(hashType); if (this.hashFunction == null) throw new IllegalArgumentException("hashType must be known"); }
/** * Constructor. * <p> * Builds a hash function that must obey to a given maximum number of returned values and a highest value. * @param maxValue The maximum highest returned value. * @param nbHash The number of resulting hashed values. * @param hashType type of the hashing function (see {@link Hash}). */ public HashFunction(int maxValue, int nbHash, int hashType) { if (maxValue <= 0) { throw new IllegalArgumentException("maxValue must be > 0"); } if (nbHash <= 0) { throw new IllegalArgumentException("nbHash must be > 0"); } this.maxValue = maxValue; this.nbHash = nbHash; this.hashFunction = Hash.getInstance(hashType); if (this.hashFunction == null) throw new IllegalArgumentException("hashType must be known"); }
/** * Get a singleton instance of hash function of a type * defined in the configuration. * @param conf current configuration * @return defined hash type, or null if type is invalid */ public static Hash getInstance(Configuration conf) { int type = getHashType(conf); return getInstance(type); }
/** * Get a singleton instance of hash function of a type * defined in the configuration. * @param conf current configuration * @return defined hash type, or null if type is invalid */ public static Hash getInstance(Configuration conf) { int type = getHashType(conf); return getInstance(type); }
/** * Constructor. * <p> * Builds a hash function that must obey to a given maximum number of returned values and a highest value. * @param maxValue The maximum highest returned value. * @param nbHash The number of resulting hashed values. * @param hashType type of the hashing function (see {@link Hash}). */ public HashFunction(int maxValue, int nbHash, int hashType) { if (maxValue <= 0) { throw new IllegalArgumentException("maxValue must be > 0"); } if (nbHash <= 0) { throw new IllegalArgumentException("nbHash must be > 0"); } this.maxValue = maxValue; this.nbHash = nbHash; this.hashFunction = Hash.getInstance(hashType); if (this.hashFunction == null) throw new IllegalArgumentException("hashType must be known"); }
/** * Get a singleton instance of hash function of a type * defined in the configuration. * @param conf current configuration * @return defined hash type, or null if type is invalid */ public static Hash getInstance(Configuration conf) { int type = getHashType(conf); return getInstance(type); }
/** * Get a singleton instance of hash function of a type * defined in the configuration. * @param conf current configuration * @return defined hash type, or null if type is invalid */ public static Hash getInstance(Configuration conf) { int type = getHashType(conf); return getInstance(type); }
/** * Get a singleton instance of hash function of a type * defined in the configuration. * @param conf current configuration * @return defined hash type, or null if type is invalid */ public static Hash getInstance(Configuration conf) { int type = getHashType(conf); return getInstance(type); }
/** * Constructor. * <p> * Builds a hash function that must obey to a given maximum number of returned values and a highest value. * @param maxValue The maximum highest returned value. * @param nbHash The number of resulting hashed values. * @param hashType type of the hashing function (see {@link Hash}). */ public HashFunction(int maxValue, int nbHash, int hashType) { if (maxValue <= 0) { throw new IllegalArgumentException("maxValue must be > 0"); } if (nbHash <= 0) { throw new IllegalArgumentException("nbHash must be > 0"); } this.maxValue = maxValue; this.nbHash = nbHash; this.hashFunction = Hash.getInstance(hashType); if (this.hashFunction == null) throw new IllegalArgumentException("hashType must be known"); }
/** * Constructor. * <p> * Builds a hash function that must obey to a given maximum number of returned values and a highest value. * @param maxValue The maximum highest returned value. * @param nbHash The number of resulting hashed values. * @param hashType type of the hashing function (see {@link Hash}). */ public HashFunction(int maxValue, int nbHash, int hashType) { if (maxValue <= 0) { throw new IllegalArgumentException("maxValue must be > 0"); } if (nbHash <= 0) { throw new IllegalArgumentException("nbHash must be > 0"); } this.maxValue = maxValue; this.nbHash = nbHash; this.hashFunction = Hash.getInstance(hashType); if (this.hashFunction == null) throw new IllegalArgumentException("hashType must be known"); }
/** * Constructor. * <p> * Builds a hash function that must obey to a given maximum number of returned values and a highest value. * @param maxValue The maximum highest returned value. * @param nbHash The number of resulting hashed values. * @param hashType type of the hashing function (see {@link Hash}). */ public HashFunction(int maxValue, int nbHash, int hashType) { if (maxValue <= 0) { throw new IllegalArgumentException("maxValue must be > 0"); } if (nbHash <= 0) { throw new IllegalArgumentException("nbHash must be > 0"); } this.maxValue = maxValue; this.nbHash = nbHash; this.hashFunction = Hash.getInstance(hashType); if (this.hashFunction == null) throw new IllegalArgumentException("hashType must be known"); }
/** * Constructor. * <p> * Builds a hash function that must obey to a given maximum number of returned values and a highest value. * @param maxValue The maximum highest returned value. * @param nbHash The number of resulting hashed values. * @param hashType type of the hashing function (see {@link Hash}). */ public HashFunction(int maxValue, int nbHash, int hashType) { if (maxValue <= 0) { throw new IllegalArgumentException("maxValue must be > 0"); } if (nbHash <= 0) { throw new IllegalArgumentException("nbHash must be > 0"); } this.maxValue = maxValue; this.nbHash = nbHash; this.hashFunction = Hash.getInstance(hashType); if (this.hashFunction == null) throw new IllegalArgumentException("hashType must be known"); }
assertTrue("testHash", MurmurHash.getInstance() == Hash.getInstance(cfg)); JenkinsHash.getInstance() == Hash.getInstance(cfg)); MurmurHash.getInstance() == Hash.getInstance(cfg)); JenkinsHash.getInstance() == Hash.getInstance(Hash.JENKINS_HASH)); assertTrue("testHash error murmur getInstance !!!", MurmurHash.getInstance() == Hash.getInstance(Hash.MURMUR_HASH)); Hash.getInstance(Hash.INVALID_HASH)); int murmurHash = Hash.getInstance(Hash.MURMUR_HASH).hash(LINE.getBytes()); for (int i = 0; i < iterations; i++) { assertTrue("multiple evaluation murmur hash error !!!", murmurHash == Hash.getInstance(Hash.MURMUR_HASH) .hash(LINE.getBytes())); murmurHash = Hash.getInstance(Hash.MURMUR_HASH).hash(LINE.getBytes(), 67); for (int i = 0; i < iterations; i++) { assertTrue( "multiple evaluation murmur hash error !!!", murmurHash == Hash.getInstance(Hash.MURMUR_HASH).hash( LINE.getBytes(), 67)); int jenkinsHash = Hash.getInstance(Hash.JENKINS_HASH).hash(LINE.getBytes()); for (int i = 0; i < iterations; i++) { assertTrue( "multiple evaluation jenkins hash error !!!",
assertTrue("testHash", MurmurHash.getInstance() == Hash.getInstance(cfg)); JenkinsHash.getInstance() == Hash.getInstance(cfg)); MurmurHash.getInstance() == Hash.getInstance(cfg)); JenkinsHash.getInstance() == Hash.getInstance(Hash.JENKINS_HASH)); assertTrue("testHash error murmur getInstance !!!", MurmurHash.getInstance() == Hash.getInstance(Hash.MURMUR_HASH)); Hash.getInstance(Hash.INVALID_HASH)); int murmurHash = Hash.getInstance(Hash.MURMUR_HASH).hash(LINE.getBytes()); for (int i = 0; i < iterations; i++) { assertTrue("multiple evaluation murmur hash error !!!", murmurHash == Hash.getInstance(Hash.MURMUR_HASH) .hash(LINE.getBytes())); murmurHash = Hash.getInstance(Hash.MURMUR_HASH).hash(LINE.getBytes(), 67); for (int i = 0; i < iterations; i++) { assertTrue( "multiple evaluation murmur hash error !!!", murmurHash == Hash.getInstance(Hash.MURMUR_HASH).hash( LINE.getBytes(), 67)); int jenkinsHash = Hash.getInstance(Hash.JENKINS_HASH).hash(LINE.getBytes()); for (int i = 0; i < iterations; i++) { assertTrue( "multiple evaluation jenkins hash error !!!",