Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 60d19a60a99891ad364ba906764fbaccec910002 (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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/*****************************************************************************
 * Copyright (c) 2017 CEA LIST.
 *
 *
 * 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:
 *  Pauline DEVILLE (CEA LIST) pauline.deville@cea.fr - Initial API and implementation
 *
 *****************************************************************************/
package org.eclipse.papyrus.toolsmiths.profilemigration.internal.nodes;

import org.eclipse.emf.compare.Conflict;
import org.eclipse.emf.edit.tree.impl.TreeNodeImpl;

import com.google.common.collect.Iterables;

/**
 * This class is wrapper for TreeNode used to represent a conflict TreeNode.
 * 
 */
public class ConflictNode extends TreeNodeImpl {

	/**
	 * Constructor.
	 * 
	 * @param conflict
	 *            The conflict represented by this TreeNode
	 */
	public ConflictNode(Conflict conflict) {
		setData(conflict);
	}

	/**
	 * Add the given MatchNode to the children of this ConflictNode.
	 * 
	 * @param matchNode
	 *            The MatchNode to add
	 * @return <code>true</code> if the MatchNode has been added
	 */
	public boolean addConflictingTree(MatchNode matchNode) {
		return getChildren().add(matchNode);
	}

	/**
	 * Remove the given MatchNode of the children of this ConflictNode.
	 * 
	 * @param matchNode
	 *            The MatchNode to remove
	 * @return <code>true</code> if the MatchNode has been removed
	 */
	public boolean removeConflictingTree(MatchNode matchNode) {
		return getChildren().remove(matchNode);
	}

	/**
	 * Getter for the conflict represented by this TreeNode.
	 * 
	 * @return the conflict
	 */
	public Conflict getConflict() {
		return (Conflict) getData();
	}

	/**
	 * Get all the match trees that are part of the conflict
	 * 
	 * @return an iterable of all MatchNode that are part of the conflict
	 */
	public Iterable<MatchNode> getConflictingTrees() {
		return Iterables.filter(getChildren(), MatchNode.class);
	}

}

Back to the top