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

cc.kave.repackaged.jayes.util.sharing.CanonicalIntArraySet Maven / Gradle / Ivy

The newest version!
/**
 * Copyright (c) 2011 Michael Kutschke.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Michael Kutschke - initial API and implementation.
 */
package cc.kave.repackaged.jayes.util.sharing;

import java.util.Arrays;

/**
 * This class uses the Arrays.hashCode and Arrays.equals methods as basis for the
 * equality relation between it's members.
 * @author michael
 *
 */
public final class CanonicalIntArraySet extends CanonicalSet {


    @Override
	protected Entry createEntry(int[] array) {
		return new IntArrayEntry(array);
	}

	@Override
	protected boolean hasProperType(Object o) {
		return o instanceof int[];
	}

	private static class IntArrayEntry extends Entry  {
	
		public IntArrayEntry(int[] entry) {
			super(entry);
		}
	
		@Override
		protected int computeHash(int[] entry2) {
			return Arrays.hashCode(entry2);
		}
	
		@Override
		protected boolean equals(int[] entry2, int[] entry3) {
			return Arrays.equals(entry2,entry3);
		}
	
	
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy