--******************************************************************************
--* 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 v2.0
--* which accompanies this distribution, and is available at
--* http://www.eclipse.org/legal/epl-v20.html
--*
--* Contributors:
--*     Horacio Hoyos - Initial API and implementation
--*******************************************************************************/
-- @atlcompiler emftvm
-- @path ForwardList=/org.eclipse.qvtd.xtext.qvtcore.tests/src/org/eclipse/qvtd/xtext/qvtcore/tests/forward2reverse/DoublyLinkedList.ecore
-- @path ReverseList=/org.eclipse.qvtd.xtext.qvtcore.tests/src/org/eclipse/qvtd/xtext/qvtcore/tests/forward2reverse/DoublyLinkedList.ecore

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
		)
}