From 7b1fa4278b4d5adf010562f7dd3ae348fdf2f032 Mon Sep 17 00:00:00 2001
From: Ludovic Apvrille <ludovic.apvrille@telecom-paristech.fr>
Date: Thu, 20 May 2010 12:47:08 +0000
Subject: [PATCH] Update on Avatar State Machines

---
 .../AvatarActionOnSignal.java                 |  85 ++++++++++++++
 src/avatartranslator/AvatarStartState.java    |  58 ++++++++++
 src/avatartranslator/AvatarState.java         |  74 ++++++++++++
 src/avatartranslator/AvatarStateMachine.java  |  78 +++++++++++++
 .../AvatarStateMachineElement.java            |  65 +++++++++++
 src/avatartranslator/AvatarStopState.java     |  58 ++++++++++
 src/avatartranslator/AvatarTransition.java    | 105 ++++++++++++++++++
 7 files changed, 523 insertions(+)
 create mode 100644 src/avatartranslator/AvatarActionOnSignal.java
 create mode 100644 src/avatartranslator/AvatarStartState.java
 create mode 100644 src/avatartranslator/AvatarState.java
 create mode 100644 src/avatartranslator/AvatarStateMachine.java
 create mode 100644 src/avatartranslator/AvatarStateMachineElement.java
 create mode 100644 src/avatartranslator/AvatarStopState.java
 create mode 100644 src/avatartranslator/AvatarTransition.java

diff --git a/src/avatartranslator/AvatarActionOnSignal.java b/src/avatartranslator/AvatarActionOnSignal.java
new file mode 100644
index 0000000000..832e6144d6
--- /dev/null
+++ b/src/avatartranslator/AvatarActionOnSignal.java
@@ -0,0 +1,85 @@
+/**Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille
+ *
+ * ludovic.apvrille AT enst.fr
+ *
+ * This software is a computer program whose purpose is to allow the
+ * edition of TURTLE analysis, design and deployment diagrams, to
+ * allow the generation of RT-LOTOS or Java code from this diagram,
+ * and at last to allow the analysis of formal validation traces
+ * obtained from external tools, e.g. RTL from LAAS-CNRS and CADP
+ * from INRIA Rhone-Alpes.
+ *
+ * This software is governed by the CeCILL  license under French law and
+ * abiding by the rules of distribution of free software.  You can  use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and  rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty  and the software's author,  the holder of the
+ * economic rights,  and the successive licensors  have only  limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading,  using,  modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean  that it is complicated to manipulate,  and  that  also
+ * therefore means  that it is reserved for developers  and  experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and,  more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ *
+ * /**
+ * Class AvatarActionOnSignal
+ * Creation: 20/05/2010
+ * @version 1.0 20/05/2010
+ * @author Ludovic APVRILLE
+ * @see
+ */
+
+package avatartranslator;
+
+import java.util.*;
+
+
+public class AvatarActionOnSignal extends AvatarStateMachineElement {
+	private AvatarSignal signal;
+	private LinkedList<String> values;
+	
+    public AvatarActionOnSignal(String _name, AvatarSignal _signal, Object _referenceObject) {
+        super(_name, _referenceObject);
+		signal = _signal;
+		values = new LinkedList<String>();
+    }
+	
+	public AvatarSignal getSignal() {
+		return signal;
+	}
+	
+	public void addValue(String _val) {
+		values.add(_val);
+	}
+	
+	public int getNbOfValues() {
+		return values.size();
+	}
+	
+	public String getValue(int _index) {
+		return value.get(_index);
+	}
+	
+	public boolean isSending() {
+		return signal.isOut();
+	}
+	
+	public boolean isReceiving() {
+		return signal.isIn();
+	}
+    
+}
\ No newline at end of file
diff --git a/src/avatartranslator/AvatarStartState.java b/src/avatartranslator/AvatarStartState.java
new file mode 100644
index 0000000000..5f0d2f1c70
--- /dev/null
+++ b/src/avatartranslator/AvatarStartState.java
@@ -0,0 +1,58 @@
+/**Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille
+ *
+ * ludovic.apvrille AT enst.fr
+ *
+ * This software is a computer program whose purpose is to allow the
+ * edition of TURTLE analysis, design and deployment diagrams, to
+ * allow the generation of RT-LOTOS or Java code from this diagram,
+ * and at last to allow the analysis of formal validation traces
+ * obtained from external tools, e.g. RTL from LAAS-CNRS and CADP
+ * from INRIA Rhone-Alpes.
+ *
+ * This software is governed by the CeCILL  license under French law and
+ * abiding by the rules of distribution of free software.  You can  use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and  rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty  and the software's author,  the holder of the
+ * economic rights,  and the successive licensors  have only  limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading,  using,  modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean  that it is complicated to manipulate,  and  that  also
+ * therefore means  that it is reserved for developers  and  experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and,  more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ *
+ * /**
+ * Class AvatarStartState
+ * Creation: 20/05/2010
+ * @version 1.0 20/05/2010
+ * @author Ludovic APVRILLE
+ * @see
+ */
+
+package avatartranslator;
+
+import java.util.*;
+
+
+public class AvatarStartState extends AvatarStateMachineElement {
+	
+	
+    public AvatarStartState(String _name, Object _referenceObject) {
+        super(_name, _referenceObject);
+    }
+    
+}
\ No newline at end of file
diff --git a/src/avatartranslator/AvatarState.java b/src/avatartranslator/AvatarState.java
new file mode 100644
index 0000000000..e1c98554f1
--- /dev/null
+++ b/src/avatartranslator/AvatarState.java
@@ -0,0 +1,74 @@
+/**Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille
+ *
+ * ludovic.apvrille AT enst.fr
+ *
+ * This software is a computer program whose purpose is to allow the
+ * edition of TURTLE analysis, design and deployment diagrams, to
+ * allow the generation of RT-LOTOS or Java code from this diagram,
+ * and at last to allow the analysis of formal validation traces
+ * obtained from external tools, e.g. RTL from LAAS-CNRS and CADP
+ * from INRIA Rhone-Alpes.
+ *
+ * This software is governed by the CeCILL  license under French law and
+ * abiding by the rules of distribution of free software.  You can  use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and  rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty  and the software's author,  the holder of the
+ * economic rights,  and the successive licensors  have only  limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading,  using,  modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean  that it is complicated to manipulate,  and  that  also
+ * therefore means  that it is reserved for developers  and  experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and,  more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ *
+ * /**
+ * Class AvatarBlock
+ * Creation: 20/05/2010
+ * @version 1.0 20/05/2010
+ * @author Ludovic APVRILLE
+ * @see
+ */
+
+package avatartranslator;
+
+import java.util.*;
+
+
+public class AvatarBlock extends AvatarStateMachineElement {
+	
+	private AvatarStateMachine asm;
+	
+	
+	
+    public AvatarBlock(String _name, Object _referenceObject) {
+        super(_name, _referenceObject);
+		
+    }
+	
+	public void setStateMachine(AvatarStateMAchine _asm) {
+		asm = _asm;
+	}
+	
+	public boolean isACompositeState() {
+		return (asm != null);
+	}
+	
+	public AvatarStateMachine getStateMachine() {
+		return asm;
+	}
+	
+}
\ No newline at end of file
diff --git a/src/avatartranslator/AvatarStateMachine.java b/src/avatartranslator/AvatarStateMachine.java
new file mode 100644
index 0000000000..59627fd2b1
--- /dev/null
+++ b/src/avatartranslator/AvatarStateMachine.java
@@ -0,0 +1,78 @@
+/**Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille
+
+ludovic.apvrille AT enst.fr
+
+This software is a computer program whose purpose is to allow the 
+edition of TURTLE analysis, design and deployment diagrams, to 
+allow the generation of RT-LOTOS or Java code from this diagram, 
+and at last to allow the analysis of formal validation traces 
+obtained from external tools, e.g. RTL from LAAS-CNRS and CADP 
+from INRIA Rhone-Alpes.
+
+This software is governed by the CeCILL  license under French law and
+abiding by the rules of distribution of free software.  You can  use, 
+modify and/ or redistribute the software under the terms of the CeCILL
+license as circulated by CEA, CNRS and INRIA at the following URL
+"http://www.cecill.info". 
+
+As a counterpart to the access to the source code and  rights to copy,
+modify and redistribute granted by the license, users are provided only
+with a limited warranty  and the software's author,  the holder of the
+economic rights,  and the successive licensors  have only  limited
+liability. 
+
+In this respect, the user's attention is drawn to the risks associated
+with loading,  using,  modifying and/or developing or reproducing the
+software by the user in light of its specific status of free software,
+that may mean  that it is complicated to manipulate,  and  that  also
+therefore means  that it is reserved for developers  and  experienced
+professionals having in-depth computer knowledge. Users are therefore
+encouraged to load and test the software's suitability as regards their
+requirements in conditions enabling the security of their systems and/or 
+data to be ensured and,  more generally, to use and operate it in the 
+same conditions as regards security. 
+
+The fact that you are presently reading this means that you have had
+knowledge of the CeCILL license and that you accept its terms.
+
+/**
+ * Class AvatarStateMachine
+ * State machine, with composite states
+ * Creation: 20/05/2010
+ * @version 1.0 20/05/2010
+ * @author Ludovic APVRILLE
+ * @see
+ */
+
+
+package avatartranslator;
+
+import java.util.*;
+
+import myutil.*;
+
+public class AvatarStateMachine extends AvatarElement {
+    
+	protected LinkedList<AvatarStateMachineElement> elements;
+	protected AvatarStartState startState;
+    
+	
+    public AvatarStateMachine(String _name, Object _referenceObject) {
+		super(_name, _referenceObject);
+        elements = new LinkedList<AvatarStateMachineElement>();
+    }
+	
+	public void setStartState(AvatarStartState _state) {
+		startState = _state; 
+	}
+	
+	public void addElement(AvatarStateMachineElement _element) {
+		elements.add(_element);
+	}
+	
+	public LinkedList<AvatarStateMachineElement> getListOfElements() {
+		return elements;
+	}
+    
+
+}
\ No newline at end of file
diff --git a/src/avatartranslator/AvatarStateMachineElement.java b/src/avatartranslator/AvatarStateMachineElement.java
new file mode 100644
index 0000000000..2abd801376
--- /dev/null
+++ b/src/avatartranslator/AvatarStateMachineElement.java
@@ -0,0 +1,65 @@
+/**Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille
+ *
+ * ludovic.apvrille AT enst.fr
+ *
+ * This software is a computer program whose purpose is to allow the
+ * edition of TURTLE analysis, design and deployment diagrams, to
+ * allow the generation of RT-LOTOS or Java code from this diagram,
+ * and at last to allow the analysis of formal validation traces
+ * obtained from external tools, e.g. RTL from LAAS-CNRS and CADP
+ * from INRIA Rhone-Alpes.
+ *
+ * This software is governed by the CeCILL  license under French law and
+ * abiding by the rules of distribution of free software.  You can  use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and  rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty  and the software's author,  the holder of the
+ * economic rights,  and the successive licensors  have only  limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading,  using,  modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean  that it is complicated to manipulate,  and  that  also
+ * therefore means  that it is reserved for developers  and  experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and,  more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ *
+ * /**
+ * Class AvatarStateMachineElement
+ * Creation: 20/05/2010
+ * @version 1.0 20/05/2010
+ * @author Ludovic APVRILLE
+ * @see
+ */
+
+package avatartranslator;
+
+import java.util.*;
+
+
+public class AvatarStateMachineElement extends AvatarElement {
+	
+	private LinkedList<AvatarStateMachineElement> nexts;
+	
+    public AvatarStateMachineElement(String _name, Object _referenceObject) {
+        super(_name, _referenceObject);
+		nexts = new LinkedList<AvatarStateMachineElement>();
+    }
+	
+	public void addNext(AvatarStateMachineElement _element) {
+		nexts.add(_element);
+	}
+	
+    
+}
\ No newline at end of file
diff --git a/src/avatartranslator/AvatarStopState.java b/src/avatartranslator/AvatarStopState.java
new file mode 100644
index 0000000000..cfd7ead258
--- /dev/null
+++ b/src/avatartranslator/AvatarStopState.java
@@ -0,0 +1,58 @@
+/**Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille
+ *
+ * ludovic.apvrille AT enst.fr
+ *
+ * This software is a computer program whose purpose is to allow the
+ * edition of TURTLE analysis, design and deployment diagrams, to
+ * allow the generation of RT-LOTOS or Java code from this diagram,
+ * and at last to allow the analysis of formal validation traces
+ * obtained from external tools, e.g. RTL from LAAS-CNRS and CADP
+ * from INRIA Rhone-Alpes.
+ *
+ * This software is governed by the CeCILL  license under French law and
+ * abiding by the rules of distribution of free software.  You can  use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and  rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty  and the software's author,  the holder of the
+ * economic rights,  and the successive licensors  have only  limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading,  using,  modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean  that it is complicated to manipulate,  and  that  also
+ * therefore means  that it is reserved for developers  and  experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and,  more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ *
+ * /**
+ * Class AvatarStopState
+ * Creation: 20/05/2010
+ * @version 1.0 20/05/2010
+ * @author Ludovic APVRILLE
+ * @see
+ */
+
+package avatartranslator;
+
+import java.util.*;
+
+
+public class AvatarStopState extends AvatarStateMachineElement {
+	
+	
+    public AvatarStopState(String _name, Object _referenceObject) {
+        super(_name, _referenceObject);
+    }
+    
+}
\ No newline at end of file
diff --git a/src/avatartranslator/AvatarTransition.java b/src/avatartranslator/AvatarTransition.java
new file mode 100644
index 0000000000..155b31004f
--- /dev/null
+++ b/src/avatartranslator/AvatarTransition.java
@@ -0,0 +1,105 @@
+/**Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille
+ *
+ * ludovic.apvrille AT enst.fr
+ *
+ * This software is a computer program whose purpose is to allow the
+ * edition of TURTLE analysis, design and deployment diagrams, to
+ * allow the generation of RT-LOTOS or Java code from this diagram,
+ * and at last to allow the analysis of formal validation traces
+ * obtained from external tools, e.g. RTL from LAAS-CNRS and CADP
+ * from INRIA Rhone-Alpes.
+ *
+ * This software is governed by the CeCILL  license under French law and
+ * abiding by the rules of distribution of free software.  You can  use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and  rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty  and the software's author,  the holder of the
+ * economic rights,  and the successive licensors  have only  limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading,  using,  modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean  that it is complicated to manipulate,  and  that  also
+ * therefore means  that it is reserved for developers  and  experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and,  more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ *
+ * /**
+ * Class AvatarTransition
+ * Creation: 20/05/2010
+ * @version 1.0 20/05/2010
+ * @author Ludovic APVRILLE
+ * @see
+ */
+
+package avatartranslator;
+
+import java.util.*;
+
+
+public class AvatarTransition extends AvatarStateMachineElement {
+	private String guard = "[ ]";
+	private String minDelay = "", maxDelay = "";
+	private String minCompute = "", maxCompute = "";
+	
+	private LinkedList<String> actions; // actions on variable, or method call
+	
+    public AvatarTransition(String _name, AvatarSignal _signal, Object _referenceObject) {
+        super(_name, _referenceObject);
+		actions = new LinkedList<String>();
+    }
+	
+	public String getGuard() {
+		return guard;
+	}
+	
+	public void setGuard(String _guard) {
+		guard = _guard;
+	}
+	
+	public int getNbOfAction() {
+		return actions.size();
+	}
+	
+	public String getAction(int _index) {
+		return value.get(_index);
+	}
+	
+	public void setDelays(String _minDelay, String _maxDelay) {
+		minDelay = _minDelay;
+		maxDelay = _maxDelay;
+	}
+	
+	public void setComputes(String _minCompute, String _maxCompute) {
+		minCompute = _minCompute;
+		maxCompute = _maxCompute;
+	}
+	
+	public String getMinDelay() {
+		return minDelay;
+	}
+	
+	public String getMaxDelay() {
+		return maxDelay;
+	}
+	
+	public String getMinCompute() {
+		return minCompute;
+	}
+	
+	public String getMaxCompute() {
+		return maxCompute;
+	}
+    
+}
\ No newline at end of file
-- 
GitLab