Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 80dad69f53fb655e0806d7124b4b57181cfcc984 (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
/*****************************************************************************
 * Copyright (c) 2015 CEA LIST.
 * 
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License 2.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 *
 * Contributors:
 *  Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.net - Initial API and implementation
 *****************************************************************************/

package org.eclipse.papyrus.uml.diagram.clazz.custom.parsers;

import org.eclipse.uml2.uml.Classifier;
import org.eclipse.uml2.uml.NamedElement;

/**
 * The Enum for kind of End member.
 */
public enum EndMemberKind {
	SOURCE(0), TARGET(1), UNKNOWN(-1);

	/** The kind index. */
	private final int kindIndex;

	/**
	 * Instantiates a new classifier member kind.
	 *
	 * @param index
	 *            the index
	 */
	private EndMemberKind(int index) {
		kindIndex = index;
	}

	/**
	 * Extract named element.
	 *
	 * @param classifier
	 *            the classifier
	 * @return the named element
	 */
	public NamedElement extractNamedElement(Classifier classifier) {
		if (kindIndex < 0) {
			return null;
		}
		return classifier.getMembers().get(kindIndex);
	}

	/**
	 * Gets the index.
	 *
	 * @return the index
	 */
	public int getIndex() {
		return kindIndex;
	}
}

Back to the top