Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: bcc79b83562d723990833e9f22bba902af3e75b0 (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
/*****************************************************************************
 * 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 v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *  Jeremie Tatibouet
 * 
 *****************************************************************************/
package org.eclipse.papyrus.uml.alf.transaction.commit;

import org.eclipse.papyrus.uml.alf.text.representation.AlfTextualRepresentation;
import org.eclipse.papyrus.uml.alf.text.representation.util.RepresentationParser;
import org.eclipse.papyrus.uml.alf.text.representation.util.RepresentationParsingError;
import org.eclipse.uml2.uml.NamedElement;

public abstract class Scenario implements IScenario {

	/**
	 * The textual representation of a model element from the user stand point
	 */
	protected AlfTextualRepresentation userModelState;

	/**
	 * The textual representation of a model element from the semantic model stand point
	 */
	protected AlfTextualRepresentation currentModelState;

	public Scenario() {
		this.userModelState = null;
		this.currentModelState = null;
	}

	protected void init(NamedElement target) throws IllegalArgumentException {
		if (target == null) {
			throw new IllegalArgumentException("The model element provided to the scenario cannot be null");
		}
		try {
			this.userModelState = RepresentationParser.getInstance().parse(target);
		} catch (RepresentationParsingError e) {
			e.printStackTrace();
		}
		try {
			this.currentModelState = RepresentationParser.getInstance().getSnapshot(target);
		} catch (RepresentationParsingError e) {
			e.printStackTrace();
		}
	}
}

Back to the top