Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: ddff5d1e718137900a7b8706a7d23c2ac01de68c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*****************************************************************************
 * Copyright (c) 2011 Atos
 *
 *    
 * 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:
 *  Mathieu Velten (Atos) mathieu.velten@atos.net - Initial API and implementation
 *  Philippe Roland (Atos) philippe.roland@atos.net - Initial API and implementation
 *
 *****************************************************************************/
package org.eclipse.papyrus.views.modelexplorer.matching;


/***
 * An IMatchingItem implementation that matches for IReferencables
 * 
 * @author proland
 */
public class ReferencableMatchingItem implements IMatchingItem {

	Object object;

	public ReferencableMatchingItem(Object object) {
		this.object = object;
	}

	public boolean matchingItemEquals(Object obj) {
		if(obj instanceof IReferencable) {
			IReferencable referencable = (IReferencable)obj;
			return referencable.getElementBehind().equals(object);
		}
		return super.equals(obj);
	}

	public int matchingItemHashcode() {
		if(object != null) {
			return object.hashCode();
		}
		return 0;
	}

}

Back to the top