KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jface > viewers > IElementComparer


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11
12 package org.eclipse.jface.viewers;
13
14 /**
15  * This interface is used to compare elements in a viewer for equality,
16  * and to provide the hash code for an element.
17  * This allows the client of the viewer to specify different equality criteria
18  * and a different hash code implementation than the
19  * <code>equals</code> and <code>hashCode</code> implementations of the
20  * elements themselves.
21  *
22  * @see StructuredViewer#setComparer
23  */

24 public interface IElementComparer {
25
26     /**
27      * Compares two elements for equality
28      *
29      * @param a the first element
30      * @param b the second element
31      * @return whether a is equal to b
32      */

33     boolean equals(Object JavaDoc a, Object JavaDoc b);
34
35     /**
36      * Returns the hash code for the given element.
37      * @param element the element the hash code is calculated for
38      *
39      * @return the hash code for the given element
40      */

41     int hashCode(Object JavaDoc element);
42 }
43
Popular Tags