1 /******************************************************************************* 2 * Copyright (c) 2004, 2005 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 package org.eclipse.ltk.core.refactoring; 12 13 /** 14 * Comparator class to compare two refactoring status entries. The general 15 * contract of this class is equivalent to the one of class 16 * {@link java.util.Comparator}from the Java Collection Framework. 17 * <p> 18 * This interface is intended to be implemented by clients. 19 * </p> 20 * 21 * @since 3.1 22 */ 23 public interface IRefactoringStatusEntryComparator { 24 25 /** 26 * Compares two refactoring status entries for order. Returns a negative 27 * integer, zero, or a positive integer as the first status entry is less 28 * than, equal to, or greater than the second. 29 * <p> 30 * The implementor must ensure that <tt>sgn(compare(x, y)) == 31 * -sgn(compare(y, x))</tt> 32 * for all <tt>x</tt> and <tt>y</tt>. 33 * </p> 34 * <p> 35 * The implementor must ensure that the relation is transitive: 36 * <tt>((compare(x, y)>0) && (compare(y, z)>0))</tt> implies 37 * <tt>compare(x, z)>0</tt>. 38 * </p> 39 * <p> 40 * Furthermore, the implementer must ensure that <tt>compare(x, y)==0</tt> 41 * implies that <tt>sgn(compare(x, z))==sgn(compare(y, z))</tt> for all 42 * <tt>z</tt>. 43 * </p> 44 * 45 * @param entry1 the first refactoring status entry to be compared. 46 * @param entry2 the second refactoring status entry to be compared. 47 * @return a negative integer, zero, or a positive integer as the first 48 * status entry is less than, equal to, or greater than the second. 49 */ 50 public int compare(RefactoringStatusEntry entry1, RefactoringStatusEntry entry2); 51 } 52