Skip to main content
summaryrefslogtreecommitdiffstats
blob: 7f43f468082766218dd3fd5371ca6d1b523a0160 (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
--******************************************************************************
--* Copyright (c) 2016 University of York
--* 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:
--*     Horacio Hoyos - Initial API and implementation
--*******************************************************************************/

module Forward2Reverse;
create OUT : ReverseList from IN : ForwardList;

rule list2list {
	from
		forwardList : ForwardList!DoublyLinkedList
	to
		reverseList : ReverseList!DoublyLinkedList (
			name <- forwardList.name,
			headElement <- forwardList.headElement
		)
}

rule element2element {
	from
		forwardElement : ForwardList!Element
	to
		reverseElement : ReverseList!Element (
			name <- forwardElement.name,
			list <- forwardElement.list,
			source <- forwardElement.target
		)
}

Back to the top