KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > team > core > variants > IResourceVariantComparator


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 package org.eclipse.team.core.variants;
12
13 import org.eclipse.core.resources.IResource;
14
15 /**
16  * An <code>IResourceVariantComparator</code> is provided by a <code>Subscriber</code>
17  * and used by a <code>SyncInfo</code> to calculate the sync
18  * state of the workspace resources. Subscribers should provide a criteria
19  * best suited for their environment. For example, an FTP subscriber could choose to use file
20  * size or file timestamps as comparison criteria whereas a CVS workspace subscriber would
21  * use file revision numbers.
22  *
23  * @see org.eclipse.team.core.synchronize.SyncInfo
24  * @see org.eclipse.team.core.subscribers.Subscriber
25  * @since 3.0
26  */

27 public interface IResourceVariantComparator {
28     
29     /**
30      * Returns <code>true</code> if the local resource
31      * matches the remote resource based on this criteria and <code>false</code>
32      * otherwise. Comparing should be fast and based on cached information.
33      *
34      * @param local the local resource to be compared
35      * @param remote the remote resources to be compared
36      * @return <code>true</code> if local and remote are equal based on this criteria and <code>false</code>
37      * otherwise.
38      */

39     public boolean compare(IResource local, IResourceVariant remote);
40     
41     /**
42      * Returns <code>true</code> if the base resource
43      * matches the remote resource based on this criteria and <code>false</code>
44      * otherwise. Comparing should be fast and based on cached information.
45      *
46      * @param base the base resource to be compared
47      * @param remote the remote resources to be compared
48      * @return <code>true</code> if base and remote are equal based on this criteria and <code>false</code>
49      * otherwise.
50      */

51     public boolean compare(IResourceVariant base, IResourceVariant remote);
52
53     /**
54      * Answers <code>true</code> if the base tree is maintained by this comparator's
55      * subscriber. If the base tree is not considered than the subscriber can
56      * be considered as not supported three-way comparisons. Instead
57      * comparisons are made between the local and remote only without
58      * consideration for the base.
59      * @return whether this comparator is three-way or two-way
60      */

61     public boolean isThreeWay();
62 }
63
Popular Tags