All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jenetics.internal.util.Hash Maven / Gradle / Ivy

There is a newer version: 3.6.0
Show newest version
/*
 * Java Genetic Algorithm Library (jenetics-3.0.1).
 * Copyright (c) 2007-2015 Franz Wilhelmstötter
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * Author:
 *    Franz Wilhelmstötter ([email protected])
 */
package org.jenetics.internal.util;

import org.jenetics.util.Seq;

/**
 * Interface for calculating the object hash value.
 *
 * @author Franz Wilhelmstötter
 * @since 1.6
 * @version 3.0 — $Date: 2014-07-31 $
 */
public interface Hash {

	/**
	 * Add hash code for a {@code boolean} value.
	 *
	 * @param value the value to add to the hash code.
	 * @return {@code this}
	 */
	public Hash and(final boolean value);

	/**
	 * Add hash code for an {@code boolean} array.
	 *
	 * @param values the value to add to the hash code.
	 * @return {@code this}
	 */
	public Hash and(final boolean[] values);

	/**
	 * Add hash code for a {@code byte}.
	 *
	 * @param value the value to add to the hash code.
	 * @return {@code this}
	 */
	public Hash and(final byte value);

	/**
	 * Add hash code for an {@code byte} arrays.
	 *
	 * @param values the value to add to the hash code.
	 * @return {@code this}
	 */
	public Hash and(final byte[] values);

	/**
	 * Add hash code for a {@code char}.
	 *
	 * @param value the value to add to the hash code.
	 * @return {@code this}
	 */
	public Hash and(final char value);

	/**
	 * Add hash code for an {@code char} array.
	 *
	 * @param values the value to add to the hash code.
	 * @return {@code this}
	 */
	public Hash and(final char[] values);

	/**
	 * Add hash code for a {@code short}.
	 *
	 * @param value the value to add to the hash code.
	 * @return {@code this}
	 */
	public Hash and(final short value);

	/**
	 * Add hash code for an {@code short} array.
	 *
	 * @param values the value to add to the hash code.
	 * @return {@code this}
	 */
	public Hash and(final short[] values);

	/**
	 * Add hash code for an {@code int}.
	 *
	 * @param value the value to add to the hash code.
	 * @return {@code this}
	 */
	public Hash and(final int value);

	/**
	 * Add hash code for an {@code int} array.
	 *
	 * @param values the value to add to the hash code.
	 * @return {@code this}
	 */
	public Hash and(final int[] values);

	/**
	 * Add hash code for a {@code long}.
	 *
	 * @param value the value to add to the hash code.
	 * @return {@code this}
	 */
	public Hash and(final long value);

	/**
	 * Add hash code for an {@code long} array.
	 *
	 * @param values the value to add to the hash code.
	 * @return {@code this}
	 */
	public Hash and(final long[] values);

	/**
	 * Add hash code for a {@code float}.
	 *
	 * @param value the value to add to the hash code.
	 * @return {@code this}
	 */
	public Hash and(final float value);

	/**
	 * Add hash code for an {@code float} array.
	 *
	 * @param values the value to add to the hash code.
	 * @return {@code this}
	 */
	public Hash and(final float[] values);

	/**
	 * Add hash code for a {@code double}.
	 *
	 * @param value the value to add to the hash code.
	 * @return {@code this}
	 */
	public Hash and(final double value);

	/**
	 * Add hash code for an {@code double} array.
	 *
	 * @param values the value to add to the hash code.
	 * @return {@code this}
	 */
	public Hash and(final double[] values);

	/**
	 * Add hash code for a {@code Object}.
	 *
	 * @param value the value to add to the hash code.
	 * @return {@code this}
	 */
	public Hash and(final Object value);

	/**
	 * Add hash code for an {@code Object}.
	 *
	 * @param values the value to add to the hash code.
	 * @return {@code this}
	 */
	public Hash and(final Object[] values);

	/**
	 * Add hash code for a {@code Seq}.
	 *
	 * @param values the value to add to the hash code.
	 * @return {@code this}
	 */
	public Hash and(final Seq values);

	/**
	 * Return the calculated hash value.
	 *
	 * @return the calculated hash value.
	 */
	public int value();

	/**
	 * Create a HashCodeBuilder for the given type.
	 *
	 * @param type the type the {@code Hash} is created for.
	 * @return a new default {@code Hash} implementation.
	 */
	public static Hash of(final Class type) {
		return new DefaultHashCodeBuilder(type);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy