01: /*******************************************************************************
02: * Copyright (c) 2000, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.jface.viewers;
11:
12: /**
13: * This interface is used to compare elements in a viewer for equality,
14: * and to provide the hash code for an element.
15: * This allows the client of the viewer to specify different equality criteria
16: * and a different hash code implementation than the
17: * <code>equals</code> and <code>hashCode</code> implementations of the
18: * elements themselves.
19: *
20: * @see StructuredViewer#setComparer
21: */
22: public interface IElementComparer {
23:
24: /**
25: * Compares two elements for equality
26: *
27: * @param a the first element
28: * @param b the second element
29: * @return whether a is equal to b
30: */
31: boolean equals(Object a, Object b);
32:
33: /**
34: * Returns the hash code for the given element.
35: * @param element the element the hash code is calculated for
36: *
37: * @return the hash code for the given element
38: */
39: int hashCode(Object element);
40: }
|