diff --git a/src/Main.java b/src/Main.java
index 8fb4898176da1f4210df90c8bea55479418ad372..c0a0dc05b98734516bfe01a11fc65a7e8edd4ec6 100755
--- a/src/Main.java
+++ b/src/Main.java
@@ -72,23 +72,27 @@ public class Main implements ActionListener {
     public static void main(String[] args) {
 		
 		TraceManager.devPolicy = TraceManager.TO_DEVNULL;
-      
+        
         System.out.println("\n*** TTool version: " + DefaultText.getFullVersion() + " ***\n");
 		
-		/*IntExpressionEvaluator iee = new  IntExpressionEvaluator();
+		/*
+		TraceManager.devPolicy = TraceManager.TO_CONSOLE;
+		
+		IntExpressionEvaluator iee = new  IntExpressionEvaluator();
 		int result = (int)(iee.getResultOf("(11+3)*7"));
 		System.out.println("Result=" + result);
 		if(iee.hasError()) {
 			System.out.println("Error in parsing:" + iee.getError());
 		}
 		
+		TraceManager.addDev("Toto");
 		BoolExpressionEvaluator bee = new  BoolExpressionEvaluator();
-		boolean b = bee.getResultOf("true == true");
+		boolean b = bee.getResultOf("not (8 > 10)");
 		System.out.println("Bool result=" + b);
 		if(bee.hasError()) {
 			System.out.println("Error in parsing:" + bee.getError());
 		}
-		b = bee.getResultOf("true == (1 == 3)");
+		/*b = bee.getResultOf("true == (1 == 3)");
 		System.out.println("Bool result=" + b);
 		if(bee.hasError()) {
 			System.out.println("Error in parsing:" + bee.getError());
diff --git a/src/avatartranslator/AvatarActionOnSignal.java b/src/avatartranslator/AvatarActionOnSignal.java
index 0bb23a5c9efe72dee97071b44033d41e5bde35d5..80b1d02d4a68fd355509275215081f3d80614c59 100644
--- a/src/avatartranslator/AvatarActionOnSignal.java
+++ b/src/avatartranslator/AvatarActionOnSignal.java
@@ -74,6 +74,10 @@ public class AvatarActionOnSignal extends AvatarStateMachineElement {
 		values.add(_val);
 	}
 	
+	public LinkedList<String> getValues() {
+		return values;
+	}
+	
 	public int getNbOfValues() {
 		return values.size();
 	}
diff --git a/src/avatartranslator/AvatarAttribute.java b/src/avatartranslator/AvatarAttribute.java
index 2b2a96cef7796683a2ce14e827b96d697d6a4bc6..f930bf6065daf7d16b4ef7fb8d3cf2f3f7a7e642 100644
--- a/src/avatartranslator/AvatarAttribute.java
+++ b/src/avatartranslator/AvatarAttribute.java
@@ -86,6 +86,9 @@ public class AvatarAttribute extends AvatarElement{
 	}
 	
 	public String getInitialValue() {
+		if ((initialValue == null) || (initialValue.length() == 0)) {
+			return getDefaultInitialValue();
+		}
 		return initialValue;
 	}
 	
diff --git a/src/avatartranslator/AvatarBlock.java b/src/avatartranslator/AvatarBlock.java
index 52338b7a934e58c0be2b1f646c8db0e72be0dbb2..128caf76626333b3a3c0f4d01c683bcd4cab832c 100644
--- a/src/avatartranslator/AvatarBlock.java
+++ b/src/avatartranslator/AvatarBlock.java
@@ -140,6 +140,16 @@ public class AvatarBlock extends AvatarElement {
 		return attributes.get(_index);
 	}
 	
+	public int getIndexOfAvatarAttributeWithName(String _name) {
+		int cpt = 0;
+		for(AvatarAttribute attribute: attributes) {
+			if (attribute.getName().compareTo(_name)== 0) {
+				return cpt;
+			}
+			cpt ++;
+		}
+		return -1;
+	}
 	
 	public AvatarAttribute getAvatarAttributeWithName(String _name) {
 		for(AvatarAttribute attribute: attributes) {
diff --git a/src/avatartranslator/AvatarSpecification.java b/src/avatartranslator/AvatarSpecification.java
index 454db5b3060c89d8e58434a368659c34253cf2bd..6c5f3510c596aa59f235828009f4196305b2d685 100644
--- a/src/avatartranslator/AvatarSpecification.java
+++ b/src/avatartranslator/AvatarSpecification.java
@@ -52,7 +52,7 @@ import java.util.*;
 import myutil.*;
 
 public class AvatarSpecification extends AvatarElement {
-   private String[] ops = {">", "<", "+", "-", "*", "/", "[", "]", "(", ")", ":", "=", "==", ",", "!", "?", "{", "}"};
+   public static String[] ops = {">", "<", "+", "-", "*", "/", "[", "]", "(", ")", ":", "=", "==", ",", "!", "?", "{", "}"};
     
    private LinkedList<AvatarBlock> blocks;
    private LinkedList<AvatarRelation> relations;
diff --git a/src/avatartranslator/AvatarTransition.java b/src/avatartranslator/AvatarTransition.java
index b64658272fe4872236837add5d712c5ff9450d8f..41eee5438b0244d637fef0d39f5a67d97beb35d5 100644
--- a/src/avatartranslator/AvatarTransition.java
+++ b/src/avatartranslator/AvatarTransition.java
@@ -241,30 +241,43 @@ public class AvatarTransition extends AvatarStateMachineElement {
 	
 	// Assumes actions are correctly formatted
 	public boolean hasMethodCall() {
-		int index;
+		
 		
 		for(String action: actions) {
-			index = action.indexOf("=");
-			
-			// Method of the form f(...)
-			if (index == -1) {
+			if (isAMethodCall(action)) {
 				return true;
 			}
+		}
+		return false;
 			
-			// Method of the form x = f(...)
-			action = action.substring(index+1, action.length()).trim();
-			index = action.indexOf("(");
-			if (index != -1) {
-				action = action.substring(0, index).trim();
-				 boolean b1 = (action.substring(0,1)).matches("[a-zA-Z]");
-				 boolean b2 = action.matches("\\w*");
-				 if (b1 && b2) {
-					 return true;
-				 }
+	}
+	
+	public static boolean isAMethodCall(String _action) {
+		int index;
+		index = _action.indexOf("=");
+		
+		// Method of the form f(...)
+		if (index == -1) {
+			return true;
+		}
+		
+		// Method of the form x = f(...)
+		_action = _action.substring(index+1, _action.length()).trim();
+		index = _action.indexOf("(");
+		if (index != -1) {
+			_action = _action.substring(0, index).trim();
+			if (_action.length() == 0) {
+				return false;
+				
+			}
+			boolean b1 = (_action.substring(0,1)).matches("[a-zA-Z]");
+			boolean b2 = _action.matches("\\w*");
+			if (b1 && b2) {
+				return true;
 			}
 		}
+		
 		return false;
-			
 	}
 	
 	public String getNiceName() {
diff --git a/src/avatartranslator/directsimulation/AvatarSimulationBlock.java b/src/avatartranslator/directsimulation/AvatarSimulationBlock.java
index c6e2a8b873fec4c7b2774f89a1f8e65959b85a9f..7de708f918ba7cee53c985b1c1533b91be4cfe9a 100644
--- a/src/avatartranslator/directsimulation/AvatarSimulationBlock.java
+++ b/src/avatartranslator/directsimulation/AvatarSimulationBlock.java
@@ -109,6 +109,14 @@ public class AvatarSimulationBlock  {
 		return STARTED;
 	}
 	
+	public String getAttributeValue(int _index) {
+		if (lastTransaction == null) {
+			return block.getAttribute(_index).getInitialValue();
+		}
+		
+		return lastTransaction.attributeValues.get(_index);
+	}
+	
 	public Vector<AvatarSimulationTransaction> getTransactions() {
 		return transactions;
 	}
@@ -128,7 +136,7 @@ public class AvatarSimulationBlock  {
 				completed = true;
 				return ll;
 			}
-			makeExecutedTransaction(_allTransactions, ass, _clockValue);
+			makeExecutedTransaction(_allTransactions, ass, _clockValue, null);
 			
 		}
 		
@@ -141,199 +149,284 @@ public class AvatarSimulationBlock  {
 		// ...
 		// To be done!
 		AvatarSimulationPendingTransaction aspt;
+		AvatarStateMachineElement asme;
+		boolean guardOk;
 		for(int i=0; i<lastTransaction.executedElement.nbOfNexts(); i++) {
-			aspt = new AvatarSimulationPendingTransaction();
-			aspt.asb = this;
-			aspt.elementToExecute = lastTransaction.executedElement.getNext(i);
-			if ((aspt.elementToExecute instanceof AvatarTransition) && (lastTransaction.executedElement instanceof AvatarState)) {
-				AvatarTransition trans = (AvatarTransition)(aspt.elementToExecute);
-				if (!trans.hasDelay() && (trans.getNbOfAction() == 0)){
-					// empty transition, "empty" is the meaning of actions -> look for an action after
-					if(trans.getNext(0) != null) {
-						if (trans.getNext(0) instanceof AvatarActionOnSignal) {
-							aspt.involvedElement = trans;
-							aspt.elementToExecute = trans.getNext(0);
-						}
-					}
+			asme = lastTransaction.executedElement.getNext(i);
+			guardOk = true;
+			// Guard on transition ? -> must evaluate the guard!
+			if (asme instanceof AvatarTransition) {
+				AvatarTransition at = (AvatarTransition)(asme);
+				if (at.isGuarded()) {
+					// Must evaluate the guard
+					String guard = at.getGuard();
+					String s = Conversion.replaceAllString(guard, "[", "").trim();
+					s = Conversion.replaceAllString(s, "]", "").trim();
+					guardOk = evaluateBoolExpression(s, lastTransaction.attributeValues);
+					TraceManager.addDev("guard ok=" + guardOk);
 				}
 			}
 			
-			if (aspt.elementToExecute instanceof AvatarTransition) { 
-				AvatarTransition trans = (AvatarTransition)(aspt.elementToExecute);
-				if (trans.hasDelay()) {
-					aspt.myMinDelay = trans.getMinDelay();
-					aspt.myMaxDelay = trans.getMaxDelay();
-					aspt.hasDelay = true;
-					if (lastTransaction != null) {
-						if (lastTransaction.clockValueWhenPerformed < _clockValue) {
-							aspt.hasElapsedTime = true;
-							aspt.elapsedTime = (int)(_clockValue - lastTransaction.clockValueWhenPerformed);
+			if(guardOk) {
+				aspt = new AvatarSimulationPendingTransaction();
+				aspt.asb = this;
+				aspt.elementToExecute = lastTransaction.executedElement.getNext(i);
+				if ((aspt.elementToExecute instanceof AvatarTransition) && (lastTransaction.executedElement instanceof AvatarState)) {
+					AvatarTransition trans = (AvatarTransition)(aspt.elementToExecute);
+					if (!trans.hasDelay() && (trans.getNbOfAction() == 0)){
+						// empty transition, "empty" is the meaning of actions -> look for an action after
+						if(trans.getNext(0) != null) {
+							if (trans.getNext(0) instanceof AvatarActionOnSignal) {
+								aspt.involvedElement = trans;
+								aspt.elementToExecute = trans.getNext(0);
+							}
 						}
 					}
 				}
-			} else if (aspt.involvedElement instanceof AvatarTransition) {
-				AvatarTransition trans = (AvatarTransition)(aspt.involvedElement);
-				if (trans.hasDelay()) {
-					aspt.myMinDelay = trans.getMinDelay();
-					aspt.myMaxDelay = trans.getMaxDelay();
-					aspt.hasDelay = true;
-					
-					if (lastTransaction != null) {
-						if (lastTransaction.clockValueWhenPerformed < _clockValue) {
-							aspt.hasElapsedTime = true;
-							aspt.elapsedTime = (int)(_clockValue - lastTransaction.clockValueWhenPerformed);
+				
+				if (aspt.elementToExecute instanceof AvatarTransition) { 
+					AvatarTransition trans = (AvatarTransition)(aspt.elementToExecute);
+					if (trans.hasDelay()) {
+						aspt.myMinDelay = trans.getMinDelay();
+						aspt.myMaxDelay = trans.getMaxDelay();
+						aspt.hasDelay = true;
+						if (lastTransaction != null) {
+							if (lastTransaction.clockValueWhenPerformed < _clockValue) {
+								aspt.hasElapsedTime = true;
+								aspt.elapsedTime = (int)(_clockValue - lastTransaction.clockValueWhenPerformed);
+							}
+						}
+					}
+				} else if (aspt.involvedElement instanceof AvatarTransition) {
+					AvatarTransition trans = (AvatarTransition)(aspt.involvedElement);
+					if (trans.hasDelay()) {
+						aspt.myMinDelay = trans.getMinDelay();
+						aspt.myMaxDelay = trans.getMaxDelay();
+						aspt.hasDelay = true;
+						
+						if (lastTransaction != null) {
+							if (lastTransaction.clockValueWhenPerformed < _clockValue) {
+								aspt.hasElapsedTime = true;
+								aspt.elapsedTime = (int)(_clockValue - lastTransaction.clockValueWhenPerformed);
+							}
 						}
 					}
 				}
+				aspt.clockValue = _clockValue;
+				ll.add(aspt);
 			}
-			aspt.clockValue = _clockValue;
-			ll.add(aspt);
 		}
 		return ll;
 	}
 	
-	/*public void runToNextBlockingElement(Vector<AvatarSimulationTransaction> _allTransactions, long _clockValue, int _maxTransationsInARow) {
-		
-		// No previous transaction
-		if (lastTransaction == null) {
-			AvatarStartState ass = block.getStateMachine().getStartState();
-			if (ass == null) {
-				completed = true;
-				return;
-			}
-			makeExecutedTransaction(_allTransactions, ass, _clockValue);
-		}
-		
-		boolean go = true;
-		int nbOfTransactions = 0;
-		AvatarStateMachineElement elt;
-		while(go) {
-			elt = lastTransaction.executedElement;
-			TraceManager.addDev("" + nbOfTransactions + "-> " + elt);
-			
-			// Last element?
-			if (elt.nbOfNexts() == 0) {
-				completed = true;
-				go = false;
-			}
-			
-			// Only one next?
-			if (elt.nbOfNexts() == 1) {
-				if (isBlocking(elt.getNext(0))) {
-					TraceManager.addDev("is blocking!");
-					go = false;
-				} else {
-					TraceManager.addDev("not blocking -> going on!");
-					executeElement(_allTransactions, elt.getNext(0), _clockValue);
-				}
-			}
-			
-			if (elt.nbOfNexts() > 1) {
-				go = false;
-			}
-			
-			nbOfTransactions ++;
-			if (nbOfTransactions == _maxTransationsInARow) {
-				go = false;
-			}
-		}
-		
-		if (nbOfTransactions == _maxTransationsInARow) {
-			go = false;
-			TraceManager.addDev("Too many transactions in a row: aborting block");
-			completed = true;
-		}
-	}*/
-	
 	public void runSoloPendingTransaction(AvatarSimulationPendingTransaction _aspt, Vector<AvatarSimulationTransaction> _allTransactions, long _clockValue, int _maxTransationsInARow) {
 		if (_aspt.involvedElement != null) {
-			executeElement(_allTransactions, _aspt.involvedElement, _clockValue);
+			executeElement(_allTransactions, _aspt.involvedElement, _clockValue, _aspt);
 		}
-		executeElement(_allTransactions, _aspt.elementToExecute, _clockValue);
+		executeElement(_allTransactions, _aspt.elementToExecute, _clockValue, _aspt);
 		
 	
 		//runToNextBlockingElement(_allTransactions, _clockValue, _maxTransationsInARow);
 	}
 	
 	
-	/*public boolean isBlocking(AvatarStateMachineElement _elt) {
-		TraceManager.addDev("Testing whether " + _elt + "is blocking or not");
-		
-		if (_elt instanceof AvatarStopState) {
-			return false;
-		}
-		
-		if (_elt instanceof AvatarState) {
-			return false;
-		}
-		
-		if (_elt instanceof AvatarRandom) {
-			return false;
-		}
-		
-		if (_elt instanceof AvatarTransition) {
-			AvatarTransition at = (AvatarTransition)_elt;
-			
-			if ((at.hasDelay()) || (at.hasCompute())) {
-				return true;
-			}
-			
-			return false;
-		}
-		
-		return true;
-	}*/
-	
-	public void executeElement(Vector<AvatarSimulationTransaction>_allTransactions, AvatarStateMachineElement _elt, long _clockValue) {
+	public void executeElement(Vector<AvatarSimulationTransaction>_allTransactions, AvatarStateMachineElement _elt, long _clockValue, AvatarSimulationPendingTransaction _aspt) {
 		// Stop state
 		if (_elt instanceof AvatarStopState) {
-			makeExecutedTransaction(_allTransactions, _elt, _clockValue);
+			makeExecutedTransaction(_allTransactions, _elt, _clockValue, _aspt);
 			
 		// Random
 		} else if (_elt instanceof AvatarState) {
-			makeExecutedTransaction(_allTransactions, _elt, _clockValue);
+			makeExecutedTransaction(_allTransactions, _elt, _clockValue, _aspt);
 			
 		// Random
 		} else if (_elt instanceof AvatarRandom) {
-			makeExecutedTransaction(_allTransactions, _elt, _clockValue);
+			makeExecutedTransaction(_allTransactions, _elt, _clockValue, _aspt);
 			
 		// Transition
 		} else if (_elt instanceof AvatarTransition) {
-			makeExecutedTransaction(_allTransactions, _elt, _clockValue);
+			makeExecutedTransaction(_allTransactions, _elt, _clockValue, _aspt);
 		
 		// Signal
 		} else if (_elt instanceof AvatarActionOnSignal) {
-			makeExecutedTransaction(_allTransactions, _elt, _clockValue);
+			makeExecutedTransaction(_allTransactions, _elt, _clockValue, _aspt);
 		}
 	}
 	
-	public void makeExecutedTransaction(Vector<AvatarSimulationTransaction> _allTransactions, AvatarStateMachineElement _elt, long _clockValue) {
-			AvatarSimulationTransaction ast = new AvatarSimulationTransaction(_elt);
-			ast.block = block;
-			ast.asb = this;
-			ast.concernedElement = null;
-			ast.initialClockValue = _clockValue;
-			ast.clockValueWhenPerformed = _clockValue;
-			ast.id = ast.setID();
-			
-			// Attributes
-			Vector<String> attributeValues = new Vector<String>();
-			String s;
-			if (lastTransaction == null) {
-				for(AvatarAttribute aa: block.getAttributes()) {
-					s = new String(aa.getInitialValue());
-					attributeValues.add(s);
+	public void makeExecutedTransaction(Vector<AvatarSimulationTransaction> _allTransactions, AvatarStateMachineElement _elt, long _clockValue, AvatarSimulationPendingTransaction _aspt) {
+		AvatarTransition at;
+		String action;
+		int i;
+		Vector<String> actions;
+		String value;
+		AvatarAttribute avat;
+		String result, name, param;
+		int index;
+		
+		AvatarSimulationTransaction ast = new AvatarSimulationTransaction(_elt);
+		ast.block = block;
+		ast.asb = this;
+		ast.concernedElement = null;
+		ast.initialClockValue = _clockValue;
+		ast.clockValueWhenPerformed = _clockValue;
+		ast.id = ast.setID();
+		
+		// Attributes
+		Vector<String> attributeValues = new Vector<String>();
+		String s;
+		if (lastTransaction == null) {
+			for(AvatarAttribute aa: block.getAttributes()) {
+				s = new String(aa.getInitialValue());
+				attributeValues.add(s);
+			}
+		} else {
+			// Recopy of previous values
+			for(String ss: lastTransaction.attributeValues) {
+				attributeValues.add(""+ss);
+			}
+			// Transition?
+			if (_elt instanceof AvatarTransition) {
+				at = (AvatarTransition)(_elt);
+				// Must compute new values of attributes
+				if (at.hasActions()) {
+					actions = new Vector<String>();
+					for(i=0; i<at.getNbOfAction(); i++) {
+						action = at.getAction(i);
+						makeAction(action, attributeValues, actions);
+					}
+					ast.actions = actions;
 				}
-			} else {
-				for(String ss: lastTransaction.attributeValues) {
-					attributeValues.add(""+ss);
+			} 
+			
+			// Action on signal?
+			if (_elt instanceof AvatarActionOnSignal) {
+				AvatarActionOnSignal aaos = (AvatarActionOnSignal)_elt;
+				if (_aspt != null) {
+					// Must put the right parameters
+					if (_aspt.isSynchronous) {
+						// Synchronous call
+						if ((_aspt.isSending) && (_aspt.linkedTransaction != null)){
+							// Synchronous Sending!
+							// Must be in the receiving transaction the right parameters
+							Vector<String> parameters = new Vector<String>();
+							for(i=0; i<aaos.getNbOfValues(); i++) {
+								value = aaos.getValue(i);
+								// Must get the type of the value
+								//TraceManager.addDev("Sending aaos: " + aaos + " block=" + block.getName());
+								try {
+									avat = aaos.getSignal().getListOfAttributes().get(i);
+									result = "";
+									if (avat.getType() == AvatarType.INTEGER) {
+										result += evaluateIntExpression(value, lastTransaction.attributeValues);
+									} else if (avat.getType() == AvatarType.BOOLEAN) {
+										result += evaluateBoolExpression(value, lastTransaction.attributeValues);
+									} 
+									
+									TraceManager.addDev("Adding value:" + result);
+									parameters.add(result);
+								} catch (Exception e) {}
+							}
+							_aspt.linkedTransaction.parameters = parameters;
+						} else if ((!(_aspt.isSending))  && (_aspt.parameters != null)){
+							// Synchronous Receiving
+							for(i=0; i<aaos.getNbOfValues(); i++) {
+								param = _aspt.parameters.get(i);
+								name = aaos.getValue(i);
+								index = block.getIndexOfAvatarAttributeWithName(name);
+								if (index != -1) {
+									attributeValues.remove(index);
+									attributeValues.add(index, param);
+									TraceManager.addDev("Reading value:" + param);
+								}
+							}
+						}
+						
+					} else {
+						// Asynchronous call
+						if ((_aspt.isSending) && (_aspt.linkedAsynchronousMessage != null)){
+							
+							// Asynchronous Sending
+							for(i=0; i<aaos.getNbOfValues(); i++) {
+								value = aaos.getValue(i);
+								// Must get the type of the value
+								avat = aaos.getSignal().getListOfAttributes().get(i);
+								result = "";
+								if (avat.getType() == AvatarType.INTEGER) {
+									result += evaluateIntExpression(value, lastTransaction.attributeValues);
+								} else if (avat.getType() == AvatarType.BOOLEAN) {
+									result += evaluateBoolExpression(value, lastTransaction.attributeValues);
+								} 
+								TraceManager.addDev("Adding value:" + result);
+								_aspt.linkedAsynchronousMessage.addParameter(result);
+							}
+							
+						} else if ((!(_aspt.isSending)) && (_aspt.linkedAsynchronousMessage != null)) {
+							// Asynchronous Receiving 
+							for(i=0; i<aaos.getNbOfValues(); i++) {
+								param = _aspt.linkedAsynchronousMessage.getParameters().get(i);
+								name = aaos.getValue(i);
+								index = block.getIndexOfAvatarAttributeWithName(name);
+								if (index != -1) {
+									attributeValues.remove(index);
+									attributeValues.add(index, param);
+									TraceManager.addDev("Reading value:" + param);
+								}
+							}
+						}
+					}
 				}
 			}
-			ast.attributeValues = attributeValues;
-			
-			addExecutedTransaction(_allTransactions, ast);
+		}
+		ast.attributeValues = attributeValues;
+		
+		addExecutedTransaction(_allTransactions, ast);
 	}
 	
+	public void makeAction(String _action, Vector<String> _attributeValues, Vector<String> _actions) {
+		String nameOfVar;
+		String act;
+		int ind;
+		
+		ind = _action.indexOf("=");
+		if (ind == -1) {
+			return;
+		}
+		
+		nameOfVar= _action.substring(0, ind).trim();
+		act = _action.substring(ind+1, _action.length());
+		
+		//TraceManager.addDev("1- Working on attribute =" + nameOfVar);
+		
+		if (AvatarTransition.isAMethodCall(_action)) {
+			_actions.add(nameOfVar + " = " + act);
+			return;
+		}
+		
+		// Variable
+		TraceManager.addDev("2- Working on attribute =" + nameOfVar);
+		int indexVar = block.getIndexOfAvatarAttributeWithName(nameOfVar);
+		if (indexVar != -1) {
+			// int or bool???
+			int type = block.getAttribute(indexVar).getType();
+			if (type == AvatarType.INTEGER) {
+				int result = evaluateIntExpression(act, _attributeValues);
+				_actions.add(nameOfVar + " = " + result);
+				_attributeValues.remove(indexVar);
+				_attributeValues.add(indexVar, ""+result);
+			} else if (type == AvatarType.BOOLEAN) {
+				boolean bool = evaluateBoolExpression(act, _attributeValues);
+				_actions.add(nameOfVar + " = " + bool);
+				_attributeValues.remove(indexVar);
+				_attributeValues.add(indexVar, ""+bool);
+			}
+		}
+		
+		// find the index of the attribute, and put its new value
+		return;
+	}
+	
+
+	
 	public void addExecutedTransaction(Vector<AvatarSimulationTransaction> _allTransactions, AvatarSimulationTransaction _ast) {
 		transactions.add(_ast);
 		lastTransaction = _ast;
@@ -347,4 +440,37 @@ public class AvatarSimulationBlock  {
 		
 		return lastTransaction.executedElement;
 	}
+	
+	public String getAttributeName(int _index) {
+		return block.getAttribute(_index).getName();
+	}
+	
+	public int evaluateIntExpression(String _expr, Vector<String> _attributeValues) {
+		String act = _expr;
+		int cpt = 0;
+		for(String attrValue: _attributeValues) {
+			act = Conversion.putVariableValueInString(AvatarSpecification.ops, act, getAttributeName(cpt), attrValue);
+			cpt ++;
+		}
+		
+		return (int)(new IntExpressionEvaluator().getResultOf(act));
+	}
+	
+	public boolean evaluateBoolExpression(String _expr, Vector<String> _attributeValues) {
+		String act = _expr;
+		int cpt = 0;
+		for(String attrValue: _attributeValues) {
+			act = Conversion.putVariableValueInString(AvatarSpecification.ops, act, getAttributeName(cpt), attrValue);
+			cpt ++;
+		}
+		
+		BoolExpressionEvaluator bee = new BoolExpressionEvaluator();
+		boolean result = bee.getResultOf(act);
+		if (bee.getError() != null) {
+			TraceManager.addDev("Error: " + bee.getError());
+		}
+		
+		//TraceManager.addDev("Result of " + _expr + " = " + result);
+		return result;
+	}
 }
\ No newline at end of file
diff --git a/src/avatartranslator/directsimulation/AvatarSimulationPendingTransaction.java b/src/avatartranslator/directsimulation/AvatarSimulationPendingTransaction.java
index 25548105f88561b51c7fdc2f1cb4baf542d59b62..f7ba4f49fa8cfdef4407dfdf8ae1c4130d454e97 100644
--- a/src/avatartranslator/directsimulation/AvatarSimulationPendingTransaction.java
+++ b/src/avatartranslator/directsimulation/AvatarSimulationPendingTransaction.java
@@ -60,6 +60,9 @@ public class AvatarSimulationPendingTransaction  {
 	public AvatarSimulationPendingTransaction linkedTransaction;
 	public AvatarSimulationAsynchronousTransaction linkedAsynchronousMessage;
 	public long clockValue;
+	public boolean isSynchronous;
+	public boolean isSending;
+	public Vector<String> parameters;
 	
 	// To store a delay prior to execution
 	public String myMinDelay;
diff --git a/src/avatartranslator/directsimulation/AvatarSimulationTransaction.java b/src/avatartranslator/directsimulation/AvatarSimulationTransaction.java
index 3f6a182db94c6cc01ce509eb9e9cdd12cf205ec1..2a15186b3df95816b02a7266e626a7fa027e8ae7 100644
--- a/src/avatartranslator/directsimulation/AvatarSimulationTransaction.java
+++ b/src/avatartranslator/directsimulation/AvatarSimulationTransaction.java
@@ -65,6 +65,7 @@ public class AvatarSimulationTransaction  {
 	public long clockValueWhenPerformed;
 	public long id;
 	public Vector<String> attributeValues;
+	public Vector<String> actions;
 	
     public AvatarSimulationTransaction(AvatarStateMachineElement _executeElement) {
 		executedElement = _executeElement;
@@ -93,6 +94,14 @@ public class AvatarSimulationTransaction  {
 		for(String s: attributeValues) {
 			res += s + " ";
 		}
+		if (actions != null) {
+			int cpt = 0;
+			res+= "\n";
+			for(String action: actions) {
+				res += "action#" + cpt + ": " + action + " ";
+				cpt ++;
+			}
+		}
 		return res;
 	}
 }
\ No newline at end of file
diff --git a/src/avatartranslator/directsimulation/AvatarSpecificationSimulation.java b/src/avatartranslator/directsimulation/AvatarSpecificationSimulation.java
index 193eb0fc5a3010e2dbef44952f099e026f873fea..23c0c9b90771c93584520675b706331dc6b1e1d7 100644
--- a/src/avatartranslator/directsimulation/AvatarSpecificationSimulation.java
+++ b/src/avatartranslator/directsimulation/AvatarSpecificationSimulation.java
@@ -337,7 +337,7 @@ public class AvatarSpecificationSimulation  {
 			if (ar.isAsynchronous()) {
 				// Mus see whether the channel is full or not
 				if (ar.isBlocking()) {
-					// Must see whether te channel is full or not
+					// Must see whether the channel is full or not
 					int nb = getNbOfAsynchronousMessages(ar);
 					if (nb < ar.getSizeOfFIFO()) {
 						transactions.add(_aspt);
@@ -437,7 +437,13 @@ public class AvatarSpecificationSimulation  {
 		if (_aspt.elementToExecute instanceof AvatarActionOnSignal) {
 			AvatarSignal sig = ((AvatarActionOnSignal)(_aspt.elementToExecute)).getSignal();
 			AvatarRelation rel = avspec.getAvatarRelationWithSignal(sig);
+			if (sig.isOut()) {
+				_aspt.isSending = true;
+			} else {
+				_aspt.isSending = false;
+			}
 			if (rel.isAsynchronous()) {
+				_aspt.isSynchronous = false;
 				if (sig.isOut()) {
 					// Create the stucture to put elements
 					AvatarSimulationAsynchronousTransaction asat = new AvatarSimulationAsynchronousTransaction(rel);
@@ -449,6 +455,8 @@ public class AvatarSpecificationSimulation  {
 					asynchronousMessages.remove(asat);
 					_aspt.linkedAsynchronousMessage = asat;
 				}
+			} else {
+				_aspt.isSynchronous = true;
 			}
 		}
 		
diff --git a/src/myutil/BoolExpressionEvaluator.java b/src/myutil/BoolExpressionEvaluator.java
index c5590febb8ae058b3276b605b5b3258ea7244f70..b6709b3ccef465c2db12477a561e1fe6a8e4a03c 100755
--- a/src/myutil/BoolExpressionEvaluator.java
+++ b/src/myutil/BoolExpressionEvaluator.java
@@ -58,7 +58,10 @@ public class BoolExpressionEvaluator {
 	public static final int NUMBER_TOKEN = -1;
 	public static final int BOOL_TOKEN = -2;
 	public static final int EQUAL_TOKEN = -3;
-	public static final int EOLN_TOKEN = -3;
+	public static final int LT_TOKEN = -4;
+	public static final int GT_TOKEN = -5;
+	public static final int NEG_TOKEN = -6;
+	public static final int EOLN_TOKEN = -7;
 	
 	private StringTokenizer tokens;
 	private String errorMessage = null;
@@ -86,10 +89,13 @@ public class BoolExpressionEvaluator {
 	
 	public boolean getResultOf(String _expr) {
 		TraceManager.addDev("Evaluating bool expr: " + _expr);
-		tokens = new java.util.StringTokenizer(_expr," \t\n\r+-*/()",true);
+		_expr = Conversion.replaceAllString(_expr, "not", "!").trim();
+		_expr = Conversion.replaceAllString(_expr, "==", "=").trim();
+		
+		tokens = new java.util.StringTokenizer(_expr," \t\n\r+-*/()!=",true);
 		
 		computeNextToken();
-		double result =  parseExpression();
+		int result =  (int)(parseExpression());
 		
 		if (result == TRUE_VALUE) {
 			return true;
@@ -129,7 +135,7 @@ public class BoolExpressionEvaluator {
 				errorMessage = "Expected an integer number.";
 			else if (token == BOOL_TOKEN) 
 				errorMessage = "Expected a boolean.";
-			else if (token == EQUAL_TOKEN) 
+			else if (token == EQUAL_TOKEN)
 				errorMessage = "Expected an equal.";
 			else errorMessage = 
 				"Expected a " + ((char) token) + ".";
@@ -193,7 +199,9 @@ public class BoolExpressionEvaluator {
 		int intresult2;
 		if (errorMessage != null) return result;
 		
+		
 		while (true) {
+			TraceManager.addDev("Token:" + currentType + " value=" + currentValue);
 			if (currentType == EQUAL_TOKEN) {
 				match(EQUAL_TOKEN);
 				if (errorMessage != null) return result;
@@ -217,6 +225,76 @@ public class BoolExpressionEvaluator {
 					return FALSE_VALUE;
 				}
 				
+			} else if (currentType == LT_TOKEN) {
+				match(LT_TOKEN);
+				if (errorMessage != null) return result;
+				
+				resulttmp = parseRootexp();
+				//intresult = (int)(resulttmp);
+				//intresult2 = (int)(result);
+				
+				if (errorMessage != null) return result;
+				
+				/*if ((intresult2 != TRUE_VALUE) && (intresult2 != FALSE_VALUE)) {
+					errorMessage = "Expression on the left is not a boolean (result=" + intresult2 + ")";
+				}
+				if ((intresult != TRUE_VALUE) && (intresult != FALSE_VALUE)) {
+					errorMessage = "Expression on the right is not a boolean (result=" + intresult + ")";
+				}*/
+				
+				if (result < resulttmp) {
+					return TRUE_VALUE;
+				} else {
+					return FALSE_VALUE;
+				}
+				
+			} else if (currentType == GT_TOKEN) {
+				match(GT_TOKEN);
+				if (errorMessage != null) return result;
+				
+				resulttmp = parseRootexp();
+				//intresult = (int)(resulttmp);
+				//intresult2 = (int)(result);
+				
+				if (errorMessage != null) return result;
+				
+				/*if ((intresult2 != TRUE_VALUE) && (intresult2 != FALSE_VALUE)) {
+					errorMessage = "Expression on the left is not a boolean (result=" + intresult2 + ")";
+				}
+				if ((intresult != TRUE_VALUE) && (intresult != FALSE_VALUE)) {
+					errorMessage = "Expression on the right is not a boolean (result=" + intresult + ")";
+				}*/
+				
+				if (result > resulttmp) {
+					return TRUE_VALUE;
+				} else {
+					return FALSE_VALUE;
+				}
+				
+			} else if (currentType == NEG_TOKEN) {
+				match(NEG_TOKEN);
+				if (errorMessage != null) return result;
+				
+				TraceManager.addDev("NEG TOKEN!");
+				resulttmp = parseRootexp();
+				//intresult = (int)(resulttmp);
+				//intresult2 = (int)(result);
+				
+				if (errorMessage != null) return result;
+				
+				/*if ((intresult2 != TRUE_VALUE) && (intresult2 != FALSE_VALUE)) {
+					errorMessage = "Expression on the left is not a boolean (result=" + intresult2 + ")";
+				}
+				if ((intresult != TRUE_VALUE) && (intresult != FALSE_VALUE)) {
+					errorMessage = "Expression on the right is not a boolean (result=" + intresult + ")";
+				}*/
+				
+				if (((int)(resulttmp)) == 0) {
+					return TRUE_VALUE;
+				} else {
+					return FALSE_VALUE;
+				}
+				
 			} else if (currentType == '*') {
 				match('*');
 				if (errorMessage != null) return result;
@@ -272,6 +350,19 @@ public class BoolExpressionEvaluator {
 			if (errorMessage != null) return result;
 		}
 		
+		else if (currentType==NEG_TOKEN){
+			match(NEG_TOKEN);
+			result = parseExpression();
+			if (result == TRUE_VALUE) {
+				result = FALSE_VALUE;
+			} else {
+				result = TRUE_VALUE;
+			}
+			if (errorMessage != null) return result;
+			//match(NEG_TOKEN);
+			if (errorMessage != null) return result;
+		}
+		
 		else {
 			errorMessage = "Expected a value or a parenthesis.";
 		}
@@ -326,13 +417,34 @@ public class BoolExpressionEvaluator {
 				return;
 			}
 			
-			if (s.compareTo("==") == 0) {
+			if (s.compareTo("<") == 0) {
+				currentValue = 0;
+				currentType = LT_TOKEN;
+				//TraceManager.addDev("equal token!");
+				return;
+			}
+			
+			if (s.compareTo(">") == 0) {
+				currentValue = 0;
+				currentType = GT_TOKEN;
+				//TraceManager.addDev("equal token!");
+				return;
+			}
+			
+			if (s.compareTo("=") == 0) {
 				currentValue = 0;
 				currentType = EQUAL_TOKEN;
 				//TraceManager.addDev("equal token!");
 				return;
 			}
 			
+			if (s.compareTo("!") == 0) {
+				currentValue = 0;
+				currentType = NEG_TOKEN;
+				//TraceManager.addDev("equal token!");
+				return;
+			}
+			
 			// Any other single character that is not 
 			// white space is a token.
 			
diff --git a/src/ui/AvatarDesignPanelTranslator.java b/src/ui/AvatarDesignPanelTranslator.java
index 0c6a33b044392b6820f3546ee8b5ce2eba58353d..9e92477aa0987cd60292263007e55b00d680e646 100644
--- a/src/ui/AvatarDesignPanelTranslator.java
+++ b/src/ui/AvatarDesignPanelTranslator.java
@@ -190,7 +190,7 @@ public class AvatarDesignPanelTranslator {
 			}
 			blockName = tmp.substring(0, index);
 			
-			TraceManager.addDev("blockName=" + blockName);
+			//TraceManager.addDev("blockName=" + blockName);
 			// Search for the block
 			for(Object o: _blocks) {
 				block = (AvatarBDBlock)o;
@@ -198,7 +198,7 @@ public class AvatarDesignPanelTranslator {
 					if (b) {
 						// authenticity
 						stateName = tmp.substring(index+1, tmp.length());
-						TraceManager.addDev("stateName=" + stateName);
+						//TraceManager.addDev("stateName=" + stateName);
 						index = stateName.indexOf(".");
 						if (index == -1) {
 							return null;
@@ -626,7 +626,7 @@ public class AvatarDesignPanelTranslator {
 						ce.setTGComponent(tgc);
 						addCheckingError(ce);
 					}
-					if (asmdrs.getNbOfValues() == -1) {
+					if (asmdrs.getNbOfValues() == -1){
 						CheckingError ce = new CheckingError(CheckingError.BEHAVIOR_ERROR, "Badly formed signal: " + asmdrs.getValue());
 						ce.setAvatarBlock(_ab);
 						ce.setTDiagramPanel(tdp);
@@ -643,20 +643,14 @@ public class AvatarDesignPanelTranslator {
 								addCheckingError(ce);
 							} else {
 								manageAttribute(tmp, _ab, aaos, tdp, tgc, asmdrs.getValue());
-								// Check that tmp is the identifier of an attribute
-								// Find the TAttribute
-								/*ta = getTAttribute(tmp);
-								
-								aa = _ab.getAvatarAttributeWithName(tmp);
-								if (aa == null) {
-									CheckingError ce = new CheckingError(CheckingError.BEHAVIOR_ERROR, "Badly formed parameter: " + tmp + " in signal expression: " + asmdrs.getValue());
+								if (aaos.getNbOfValues() != atas.getListOfAttributes().size()) {
+									CheckingError ce = new CheckingError(CheckingError.BEHAVIOR_ERROR, "Badly formed signal receiving: " + asmdrs.getValue() + " -> nb of parameters does not match definition");
+									TraceManager.addDev(" ERROR NB: in signal : " + aaos.getNbOfValues() + " in signal def:" + atas.getListOfAttributes().size() + " NAME=" + atas.getName());
 									ce.setAvatarBlock(_ab);
 									ce.setTDiagramPanel(tdp);
 									ce.setTGComponent(tgc);
 									addCheckingError(ce);
-								} else {
-									aaos.addValue(tmp);
-								}*/
+								}
 							}
 						}
 						//adag.setActionValue(makeTIFAction(asmdrs.getValue(), "?"));
@@ -705,6 +699,14 @@ public class AvatarDesignPanelTranslator {
 								addCheckingError(ce);
 							} else {
 								manageAttribute(tmp, _ab, aaos, tdp, tgc, asmdss.getValue());
+								if (aaos.getNbOfValues() != atas.getListOfAttributes().size()) {
+									CheckingError ce = new CheckingError(CheckingError.BEHAVIOR_ERROR, "Badly formed signal receiving: " + asmdss.getValue() + " -> nb of parameters does not match definition");
+									TraceManager.addDev(" ERROR NB: in signal : " + aaos.getNbOfValues() + " in signal def:" + atas.getListOfAttributes().size() + " NAME=" + atas.getName());
+									ce.setAvatarBlock(_ab);
+									ce.setTDiagramPanel(tdp);
+									ce.setTGComponent(tgc);
+									addCheckingError(ce);
+								}
 								// Check that tmp is the identifier of an attribute
 								/*aa = _ab.getAvatarAttributeWithName(tmp);
 								if (aa == null) {
diff --git a/src/ui/avatarinteractivesimulation/JFrameAvatarInteractiveSimulation.java b/src/ui/avatarinteractivesimulation/JFrameAvatarInteractiveSimulation.java
index dc31ddfddff9b87de607ff27a4562624650141be..658188d1e30ed92bef0ecf35be0393c5b5a8d750 100755
--- a/src/ui/avatarinteractivesimulation/JFrameAvatarInteractiveSimulation.java
+++ b/src/ui/avatarinteractivesimulation/JFrameAvatarInteractiveSimulation.java
@@ -93,7 +93,8 @@ public	class JFrameAvatarInteractiveSimulation extends JFrame implements AvatarS
 	
 	
 	// Commands
-	JPanel main, mainTop, commands, save, state, infos, outputs, cpuPanel, variablePanel; // from MGUI
+	JPanel main, mainTop, commands, save, state, infos; 
+	//outputs, cpuPanel; // from MGUI
 	JCheckBox latex, debug, animate, diploids, update, openDiagram, animateWithInfo;
 	JTabbedPane commandTab, infoTab;
 	protected JTextField paramMainCommand;
@@ -125,11 +126,18 @@ public	class JFrameAvatarInteractiveSimulation extends JFrame implements AvatarS
 	//JPanelSetVariables jpsv;
 	
 	// Blocks
-	JPanel blockPanel;
-	BlockTableModel blocktm;
-	//JButton updateBlockInformationButton;
+	private JPanel blockPanel;
+	private BlockTableModel blocktm;
 	private JScrollPane jspBlockInfo;
 	
+	// Variables
+	private JPanel variablePanel;
+	private VariableTableModel variabletm;
+	private JScrollPane jspVariableInfo;
+	
+	//JButton updateBlockInformationButton;
+	
+	
 	private int busyMode = 0; // Mode of AvatarSpecificationSimulation
 	
 	// For managing actions
@@ -598,6 +606,26 @@ public	class JFrameAvatarInteractiveSimulation extends JFrame implements AvatarS
 		jspBlockInfo.getVerticalScrollBar().setUnitIncrement(10);
 		jspBlockInfo.setPreferredSize(new Dimension(500, 300));
 		blockPanel.add(jspBlockInfo, BorderLayout.NORTH);
+		
+		// Variables
+		variablePanel = new JPanel();
+		variablePanel.setLayout(new BorderLayout());
+		infoTab.addTab("Variables", IconManager.imgic1202, variablePanel, "Variables");
+		variabletm = new VariableTableModel(ass);
+	
+		sorterPI = new TableSorter(variabletm);
+		jtablePI = new JTable(sorterPI);
+		sorterPI.setTableHeader(jtablePI.getTableHeader());
+		((jtablePI.getColumnModel()).getColumn(0)).setPreferredWidth(100);
+		((jtablePI.getColumnModel()).getColumn(1)).setPreferredWidth(75);
+		((jtablePI.getColumnModel()).getColumn(2)).setPreferredWidth(150);
+		((jtablePI.getColumnModel()).getColumn(3)).setPreferredWidth(150);
+		jtablePI.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
+		jspVariableInfo = new JScrollPane(jtablePI);
+		jspVariableInfo.setWheelScrollingEnabled(true);
+		jspVariableInfo.getVerticalScrollBar().setUnitIncrement(10);
+		jspVariableInfo.setPreferredSize(new Dimension(500, 300));
+		variablePanel.add(jspVariableInfo, BorderLayout.NORTH);
 		//updateTaskInformationButton = new JButton(actions[InteractiveSimulationActions.ACT_UPDATE_TASKS]);
 		//taskPanel.add(updateTaskInformationButton, BorderLayout.SOUTH);
 		
@@ -675,6 +703,7 @@ public	class JFrameAvatarInteractiveSimulation extends JFrame implements AvatarS
 	public void setComponents() {
 		setAll();
 		animateDiagrams();
+		animateFutureTransactions();
 	}
 	
 	public void close() {
@@ -758,6 +787,8 @@ public	class JFrameAvatarInteractiveSimulation extends JFrame implements AvatarS
 			animateDiagrams();
 		}
 		
+		animateFutureTransactions();
+		
 	}
 	
 	public void setAll() {
@@ -796,7 +827,18 @@ public	class JFrameAvatarInteractiveSimulation extends JFrame implements AvatarS
 		//actions[AvatarInteractiveSimulationActions.ACT_RESTORE_STATE].setEnabled(b);
 		
 		setLabelColors();
-		setcontentOfListOfPendingTransactions();
+		
+		if ((blockPanel != null) && (blockPanel.isVisible())) {
+			blockPanel.repaint();
+		}
+		
+		if ((variablePanel != null) && (variablePanel.isVisible())) {
+			variablePanel.repaint();
+		}
+	}
+	
+	public void animateFutureTransactions() {
+		setContentOfListOfPendingTransactions();
 	}
 	
 	public void setLabelColors() {
@@ -835,13 +877,15 @@ public	class JFrameAvatarInteractiveSimulation extends JFrame implements AvatarS
 		}
 	}
 	
-	public void setcontentOfListOfPendingTransactions() {
+	public void setContentOfListOfPendingTransactions() {
 		Vector<AvatarSimulationPendingTransaction> ll = ass.getPendingTransitions();
 		try {
-		listPendingTransactions.clearSelection();
-		selectedComponentForTransaction = null;
+			listPendingTransactions.clearSelection();
+			selectedComponentForTransaction = null;
 		if (ll != null) {
 			listPendingTransactions.setListData(ll);
+			int random = (int)(Math.floor((Math.random()*ll.size())));
+			listPendingTransactions.setSelectedIndex(random);
 		} else {
 			listPendingTransactions.setListData(new Vector<AvatarSimulationPendingTransaction>());
 		}
diff --git a/src/ui/avatarinteractivesimulation/VariableTableModel.java b/src/ui/avatarinteractivesimulation/VariableTableModel.java
new file mode 100755
index 0000000000000000000000000000000000000000..bf6678aac3985083032df2405b37b2d05db63975
--- /dev/null
+++ b/src/ui/avatarinteractivesimulation/VariableTableModel.java
@@ -0,0 +1,235 @@
+/**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 VariableTableModel
+ * Information on blocks
+ * Creation: 02/02/2011
+ * @version 1.0 02/02/2011
+ * @author Ludovic APVRILLE
+ * @see
+ */
+
+package ui.avatarinteractivesimulation;
+
+import java.util.*;
+import javax.swing.table.*;
+
+import myutil.*;
+import avatartranslator.*;
+import avatartranslator.directsimulation.*;
+
+public class VariableTableModel extends AbstractTableModel {
+	private static String ERROR_STRING = "-"; 
+	
+	private AvatarSpecificationSimulation ass;
+	
+	private int nbOfRows;
+	
+	//private String [] names;
+	public VariableTableModel(AvatarSpecificationSimulation _ass) {
+		ass = _ass;
+		computeData();
+	}
+
+	// From AbstractTableModel
+	public int getRowCount() {
+		return nbOfRows;
+	}
+
+	public int getColumnCount() {
+		return 4;
+	}
+
+	public Object getValueAt(int row, int column) {
+		if (ass == null) {
+			return ERROR_STRING;
+		}
+		
+		if (column == 0) {
+			return getBlockName(row);
+		} else if (column == 1) {
+			return getVariableType(row);
+		} else if (column == 2) {
+			return getVariableName(row);
+		} else if (column == 3) {
+			return getVariableValue(row);
+		}
+		return "";
+	}
+
+	public String getColumnName(int columnIndex) {
+		switch(columnIndex) {
+		case 0:
+			return "Block Name";
+		case 1:
+			return "Type";
+		case 2:
+			return "Name";
+		case 3:
+			return "Value";
+		}
+		return "unknown";
+	}
+	
+	private AvatarSimulationBlock getBlockByRow(int _row) {
+		int indexBlock = 0;
+		AvatarSimulationBlock block = null;
+		
+		Vector<AvatarSimulationBlock>  blocks = ass.getSimulationBlocks();
+		if (blocks.size() == 0) {
+			return null;
+		}
+		
+		
+		while(_row >= 0) {
+			block = blocks.get(indexBlock);
+			if (_row < block.getBlock().attributeNb()) {
+				return block;
+			}
+			_row = _row - block.getBlock().attributeNb();
+			indexBlock ++;
+		}
+		
+		return block;
+	}
+	
+	private AvatarAttribute getAttributeByRow(int _row) {
+		int indexBlock = 0;
+		Vector<AvatarSimulationBlock>  blocks = ass.getSimulationBlocks();
+		if (blocks.size() == 0) {
+			return null;
+		}
+		
+		AvatarSimulationBlock block = null;
+		while(_row >= 0) {
+			block = blocks.get(indexBlock);
+			if (_row < block.getBlock().attributeNb()) {
+				return block.getBlock().getAttribute(_row);
+			}
+			_row = _row - block.getBlock().attributeNb();
+			indexBlock ++;
+		}
+		
+		return null;
+	}
+	
+	private String getAttributeValueByRow(int _row) {
+		int indexBlock = 0;
+		Vector<AvatarSimulationBlock>  blocks = ass.getSimulationBlocks();
+		if (blocks.size() == 0) {
+			return ERROR_STRING;
+		}
+		
+		AvatarSimulationBlock block;
+		while(_row >= 0) {
+			block = blocks.get(indexBlock);
+			if (_row < block.getBlock().attributeNb()) {
+				return block.getAttributeValue(_row);
+			}
+			_row = _row - block.getBlock().attributeNb();
+			indexBlock ++;
+		}
+		
+		return ERROR_STRING;
+	}
+	
+	// Assumes tmlm != null
+	private String getBlockName(int row) {
+		return getBlockByRow(row).getName();
+	}
+	
+	// Assumes tmlm != null
+	private String getVariableType(int row) {
+		AvatarAttribute aa = getAttributeByRow(row);
+		if (aa == null) {
+			return ERROR_STRING;
+		}
+		return AvatarType.getStringType(aa.getType());
+	}
+	
+	private String getVariableName(int row) {
+		AvatarAttribute aa = getAttributeByRow(row);
+		if (aa == null) {
+			return ERROR_STRING;
+		}
+		return aa.getName();
+	}
+	
+	private String getVariableValue(int row) {
+		return getAttributeValueByRow(row);
+	}
+	
+	public String getBlockStatus(int row) {
+		int status = ass.getSimulationBlocks().get(row).getStatus();
+		
+		switch(status) {
+		case AvatarSimulationBlock.NOT_STARTED:
+			return "not started";
+		case AvatarSimulationBlock.STARTED:
+			return "running";
+		case AvatarSimulationBlock.COMPLETED:
+			return "terminated";
+		}
+		return "unknown";
+		
+	}
+	
+	public String getBlockNbOfTransactions(int row) {
+		return  ""+ ass.getSimulationBlocks().get(row).getTransactions().size();
+	}
+	
+	private void computeData() {
+		nbOfRows = 0;
+		if (ass == null) {
+			return ;
+		}
+		
+		Vector<AvatarSimulationBlock>  blocks = ass.getSimulationBlocks();
+		
+		if( blocks.size() == 0) {
+			return ;
+		}
+		
+		for(AvatarSimulationBlock block: blocks) {
+			nbOfRows += block.getBlock().attributeNb();
+		}
+		
+		return;
+	}
+
+}
\ No newline at end of file