<?xml version="1.0" encoding="UTF-8"?>
<!-- ***************************************************************************
* Copyright (c) 2015 Ericsson
*
* 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:
*   Jean-Christian Kouame - Initial API and implementation
*************************************************************************** -->
<tmfxml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:noNamespaceSchemaLocation="xmlDefinition.xsd">

<!-- ***************************************************************************
* The following represents the state of the attributes in the system after the
* analysis.
*
* n corresponds to a null state value
*
* Timestamp			|	1	|	3	|	5	|	7	|
* -events and field value-
* ev.test			|	10				20
* ev.test1			|			100				200
* -states-
* test				|	1				0
* test1				|	n		0				1
* checkpoint		|	0				1		0
* or_three_operands	|	1				0		1
* not_operand		|	0				1		0
*
*************************************************************************** -->

	<stateProvider id="test.xml.conditions" version="1">
		<eventHandler eventName="test">
			<stateChange>
				<if>
					<condition>
						<field name="testField" />
						<stateValue type="long" value="10" />
					</condition>
				</if>
				<then>
					<stateAttribute type="eventName" />
					<stateValue type="long" value="1" />
				</then>
				<else>
					<stateAttribute type="eventName" />
					<stateValue type="long" value="0" />
				</else>
			</stateChange>
		</eventHandler>
		<eventHandler eventName="test1">
			<stateChange>
				<if>
					<condition>
						<field name="testField" />
						<stateValue type="long" value="200" />
					</condition>
				</if>
				<then>
					<stateAttribute type="eventName" />
					<stateValue type="long" value="1" />
				</then>
				<else>
					<stateAttribute type="eventName" />
					<stateValue type="long" value="0" />
				</else>
			</stateChange>
		</eventHandler>
		<eventHandler eventName="*">
			<stateChange>
				<if>
					<condition>
						<stateValue type="query">
							<stateAttribute type="constant" value="test" />
						</stateValue>
						<stateValue type="query">
							<stateAttribute type="constant" value="test1" />
						</stateValue>
					</condition>
				</if>
				<then>
					<stateAttribute type="constant" value="checkpoint" />
					<stateValue type="long" value="1" />
				</then>
				<else>
					<stateAttribute type="constant" value="checkpoint" />
					<stateValue type="long" value="0" />
				</else>
			</stateChange>
		</eventHandler>
		<eventHandler eventName="*">
			<stateChange>
				<if>
					<and>
						<condition>
							<stateAttribute type="constant" value="test" />
							<stateValue type="long" value="0" />
						</condition>
						<condition>
							<stateAttribute type="constant" value="test1" />
							<stateValue type="long" value="0" />
						</condition>
						<condition>
							<stateAttribute type="constant" value="checkpoint" />
							<stateValue type="long" value="1" />
						</condition>
					</and>
				</if>
				<then>
					<stateAttribute type="constant" value="and_three_operands" />
					<stateValue type="long" value="0" />
				</then>
				<else>
					<stateAttribute type="constant" value="and_three_operands" />
					<stateValue type="long" value="1" />
				</else>
			</stateChange>
		</eventHandler>
		<eventHandler eventName="*">
			<stateChange>
				<if>
					<not>
						<condition>
							<stateAttribute type="constant" value="and_three_operands" />
							<stateValue type="long" value="1" />
						</condition>
					</not>
				</if>
				<then>
					<stateAttribute type="constant" value="not_operand" />
					<stateValue type="long" value="1" />
				</then>
				<else>
					<stateAttribute type="constant" value="not_operand" />
					<stateValue type="long" value="0" />
				</else>
			</stateChange>
		</eventHandler>
	</stateProvider>
</tmfxml>