2006/unicorn/org/w3c/unicorn/tasklisttree EnumCondType.java,1.2,1.3 TLTCond.java,1.5,1.6 TLTIf.java,1.2,1.3 TLTNode.java,1.6,1.7 TLTExec.java,1.6,1.7

Update of /sources/public/2006/unicorn/org/w3c/unicorn/tasklisttree
In directory hutz:/tmp/cvs-serv6157/org/w3c/unicorn/tasklisttree

Modified Files:
	EnumCondType.java TLTCond.java TLTIf.java TLTNode.java 
	TLTExec.java 
Log Message:
Code cleanup

Index: TLTNode.java
===================================================================
RCS file: /sources/public/2006/unicorn/org/w3c/unicorn/tasklisttree/TLTNode.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- TLTNode.java	19 Sep 2008 18:57:12 -0000	1.6
+++ TLTNode.java	11 Aug 2009 13:43:02 -0000	1.7
@@ -5,82 +5,95 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-
 import org.w3c.unicorn.contract.Observer;
 
 /**
- * Class made to manage the execution
- * of a tasklist. It can contain several TLTExec objects and
- * TLTIf.
+ * Class made to manage the execution of a tasklist. It can contain several
+ * TLTExec objects and TLTIf.
  * 
  * @author Barouh Jonathan & Batard Florent
- *
+ * 
  */
 public class TLTNode {
-	
+
 	private int NodeID;
-	private ArrayList<TLTExec> executionList; // list of observations to perform
+
+	private ArrayList<TLTExec> executionList; // list of observations to
+												// perform
+
 	private ArrayList<TLTIf> ifList; // list of conditions and child nodes
-	private static final Log logger = LogFactory.getLog("org.w3c.unicorn.tasklisttree");
-	
+
+	private static final Log logger = LogFactory
+			.getLog("org.w3c.unicorn.tasklisttree");
+
 	public boolean bExpandingOrExpanded = false;
-	
+
 	/**
 	 * Default constructor for a node.
-	 *
+	 * 
 	 */
 	public TLTNode() {
 		TLTNode.logger.trace("Constructor");
-		NodeID=0;
+		NodeID = 0;
 		executionList = new ArrayList<TLTExec>();
 		ifList = new ArrayList<TLTIf>();
 	}
-	
+
 	/**
 	 * Advanced constructor for a node.
-	 * @param level The level of execution
-	 * @param executionList The list of executions for the node
-	 * @param ifList The list of tltIf for the node
+	 * 
+	 * @param level
+	 *            The level of execution
+	 * @param executionList
+	 *            The list of executions for the node
+	 * @param ifList
+	 *            The list of tltIf for the node
 	 */
-	public TLTNode(int NodeID,ArrayList<TLTExec> executionList, ArrayList<TLTIf> ifList) {
+	public TLTNode(int NodeID, ArrayList<TLTExec> executionList,
+			ArrayList<TLTIf> ifList) {
 		TLTNode.logger.trace("Constructor");
 		TLTNode.logger.trace("NodeID : " + NodeID);
 		TLTNode.logger.trace("Number of executions : " + executionList.size());
 		TLTNode.logger.trace("Number of ifs : " + ifList.size());
 		this.NodeID = NodeID;
-		this.executionList  = executionList;
+		this.executionList = executionList;
 		this.ifList = ifList;
 	}
-	
 
 	/**
 	 * 
-	 * @param level The level of execution
+	 * @param level
+	 *            The level of execution
 	 */
 	public void setID(int NodeID) {
 		TLTNode.logger.trace("setID : " + NodeID);
 		this.NodeID = NodeID;
 	}
-	
+
 	/**
 	 * Adds an "exec" object to the executionList
-	 * @param exec The "exec" to add
+	 * 
+	 * @param exec
+	 *            The "exec" to add
 	 */
 	public void addExec(TLTExec exec) {
 		TLTNode.logger.trace("addExec : " + exec.getId());
-		if (!executionList.contains(exec))
+		if (!executionList.contains(exec)) {
 			executionList.add(exec);
+		}
 	}
-	
+
 	/**
 	 * Adds an "if" object to the ifList.
-	 * @param tltIf The "if" to add
+	 * 
+	 * @param tltIf
+	 *            The "if" to add
 	 */
 	public void addIf(TLTIf tltIf) {
 		TLTNode.logger.trace("addIf : ");
 		ifList.add(tltIf);
 	}
-	
+
 	/**
 	 * 
 	 * @return The list of executions
@@ -89,28 +102,28 @@
 		TLTNode.logger.trace("getExecutionList");
 		return executionList;
 	}
-	
-    public List<Observer> getAllObservers() {
-        List<Observer> res = new ArrayList();
-        getAllObserversRec(res);
-        return res;
-    }
 
-    private void getAllObserversRec(List<Observer> res) {
-        // Add every observers directly under this TLTNode
-        for(TLTExec exec : this.executionList) {
-            Observer o = exec.getObserver();
-            if(!res.contains(o)) {
-                res.add(o);
-            }
-        }
+	public List<Observer> getAllObservers() {
+		List<Observer> res = new ArrayList<Observer>();
+		getAllObserversRec(res);
+		return res;
+	}
 
-        // Recursively add observers in <if> elements
-        for(TLTIf ifNode : this.ifList) {
-            ifNode.getIfOk().getAllObserversRec(res);
-            ifNode.getIfNotOk().getAllObserversRec(res);
-        }
-    }
+	private void getAllObserversRec(List<Observer> res) {
+		// Add every observers directly under this TLTNode
+		for (TLTExec exec : this.executionList) {
+			Observer o = exec.getObserver();
+			if (!res.contains(o)) {
+				res.add(o);
+			}
+		}
+
+		// Recursively add observers in <if> elements
+		for (TLTIf ifNode : this.ifList) {
+			ifNode.getIfOk().getAllObserversRec(res);
+			ifNode.getIfNotOk().getAllObserversRec(res);
+		}
+	}
 
 	/**
 	 * 
@@ -120,7 +133,7 @@
 		TLTNode.logger.trace("getIfList");
 		return ifList;
 	}
-	
+
 	/**
 	 * 
 	 * @return The level of execution
@@ -130,12 +143,15 @@
 		return NodeID;
 	}
 
-	public String toString(){
-		String res=new String("TLTNode level"+this.NodeID+" ");
-			for(TLTIf conds : this.ifList)
-				res+=conds.toString();
-			for(TLTExec exec : this.executionList)
-				res+=exec.toString();
+	@Override
+	public String toString() {
+		String res = new String("TLTNode level" + this.NodeID + " ");
+		for (TLTIf conds : this.ifList) {
+			res += conds.toString();
+		}
+		for (TLTExec exec : this.executionList) {
+			res += exec.toString();
+		}
 		return res;
 	}
 }

Index: TLTExec.java
===================================================================
RCS file: /sources/public/2006/unicorn/org/w3c/unicorn/tasklisttree/TLTExec.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- TLTExec.java	25 Sep 2008 17:37:44 -0000	1.6
+++ TLTExec.java	11 Aug 2009 13:43:02 -0000	1.7
@@ -6,51 +6,64 @@
 import org.w3c.unicorn.contract.Observer;
 
 /**
- * Class made to manage the XML type execType of the tasklist.
- * Included in a TLTNode, its value attribute corresponds to an
- * observation which is to be launched. 
+ * Class made to manage the XML type execType of the tasklist. Included in a
+ * TLTNode, its value attribute corresponds to an observation which is to be
+ * launched.
  * 
  * @author Barouh Jonathan & Batard Florent
- *
+ * 
  */
 public class TLTExec {
 
 	private String id;
+
 	private String value;
+
 	private String type;
+
 	private ParamType param;
+
 	private Observer observer;
-	private static final Log logger = LogFactory.getLog("org.w3c.unicorn.tasklisttree");
-	
+
+	private static final Log logger = LogFactory
+			.getLog("org.w3c.unicorn.tasklisttree");
+
 	/**
 	 * Constructor for a TLTExec.
-	 * @param id The id of the exec
-	 * @param value The observer to run
-	 * @param param The parameter of the exec
+	 * 
+	 * @param id
+	 *            The id of the exec
+	 * @param value
+	 *            The observer to run
+	 * @param param
+	 *            The parameter of the exec
 	 */
-	public TLTExec(String id,Observer obs, String value,String type, ParamType param) {
-      String toTrace = "constructor(" + id + ", ";
+	public TLTExec(String id, Observer obs, String value, String type,
+			ParamType param) {
+		String toTrace = "constructor(" + id + ", ";
 		if (type.equals("observation")) {
 			toTrace += obs.getID() + ", ";
-			this.observer=obs;
+			this.observer = obs;
 		}
-		TLTExec.logger.trace(toTrace + type + ", " + value + ", " + param + ")"); 
+		TLTExec.logger
+				.trace(toTrace + type + ", " + value + ", " + param + ")");
 		this.id = id;
 		this.value = value;
-		this.type=type;
+		this.type = type;
 		this.param = param;
 
 	}
-	
+
 	/**
 	 * 
-	 * @param id The id of the exec
+	 * @param id
+	 *            The id of the exec
 	 */
 	public void setObserver(Observer obs) {
 		TLTExec.logger.trace("setObserver(" + obs.getID() + ")");
 		this.observer = obs;
 	}
-	
+
 	/**
 	 * 
 	 */
@@ -58,44 +71,47 @@
 		TLTExec.logger.trace("getObserver()");
 		return this.observer;
 	}
-	
-	
+
 	/**
 	 * 
-	 * @param id The id of the exec
+	 * @param id
+	 *            The id of the exec
 	 */
 	public void setId(String id) {
 		TLTExec.logger.trace("setId(" + id + ")");
 		this.id = id;
 	}
-	
+
 	/**
 	 * 
-	 * @param value The observer to run
+	 * @param value
+	 *            The observer to run
 	 */
 	public void setValue(String value) {
 		TLTExec.logger.trace("setValue(" + value + ")");
 		this.value = value;
 	}
-	
+
 	/**
 	 * 
-	 * @param value The observer to run
+	 * @param value
+	 *            The observer to run
 	 */
 	public void setType(String type) {
 		TLTExec.logger.trace("setType(" + type + ")");
 		this.type = type;
 	}
-	
+
 	/**
 	 * 
-	 * @param param The parameter of the exec
+	 * @param param
+	 *            The parameter of the exec
 	 */
 	public void setParam(ParamType param) {
 		TLTExec.logger.trace("setParam(" + param + ")");
 		this.param = param;
 	}
-	
+
 	/**
 	 * 
 	 * @return The id of the exec
@@ -104,7 +120,7 @@
 		TLTExec.logger.trace("getId()");
 		return id;
 	}
-	
+
 	/**
 	 * 
 	 * @return The observer or subtask to run
@@ -113,8 +129,7 @@
 		TLTExec.logger.trace("getValue()");
 		return value;
 	}
-	
-	
+
 	/**
 	 * 
 	 * @return The type of execution Observer or subtask
@@ -123,7 +138,7 @@
 		TLTExec.logger.trace("getType()");
 		return type;
 	}
-	
+
 	/**
 	 * 
 	 * @return The parameter of the exec
@@ -132,8 +147,10 @@
 		TLTExec.logger.trace("getParam()");
 		return param;
 	}
-	
-	public String toString(){
-		return "TLTExec{id: "+this.id+", value: "+this.value+", type: "+this.getType()+", param: "+this.param+"}";
+
+	@Override
+	public String toString() {
+		return "TLTExec{id: " + this.id + ", value: " + this.value + ", type: "
+				+ this.getType() + ", param: " + this.param + "}";
 	}
 }

Index: EnumCondType.java
===================================================================
RCS file: /sources/public/2006/unicorn/org/w3c/unicorn/tasklisttree/EnumCondType.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- EnumCondType.java	22 Jul 2008 12:21:24 -0000	1.2
+++ EnumCondType.java	11 Aug 2009 13:43:02 -0000	1.3
@@ -13,5 +13,5 @@
 	public final String value() {
 		return this.sValue;
 	}
-	
+
 }
\ No newline at end of file

Index: TLTCond.java
===================================================================
RCS file: /sources/public/2006/unicorn/org/w3c/unicorn/tasklisttree/TLTCond.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- TLTCond.java	25 Sep 2008 17:37:44 -0000	1.5
+++ TLTCond.java	11 Aug 2009 13:43:02 -0000	1.6
@@ -5,100 +5,116 @@
 import org.w3c.unicorn.contract.Observer;
 
 /**
- * Class made to manage the XML type condType of the tasklist.
- * Included in a TLTIf, it will decide of the next node to be
- * executed. 
+ * Class made to manage the XML type condType of the tasklist. Included in a
+ * TLTIf, it will decide of the next node to be executed.
  * 
  * @author Barouh Jonathan & Batard Florent
- *
+ * 
  */
 public class TLTCond {
-	
+
 	private String id;
+
 	private Observer observer;
-	private EnumCondType type; 
+
+	private EnumCondType type;
+
 	private boolean result;
+
 	private String value;
-	private static final Log logger = LogFactory.getLog("org.w3c.unicorn.tasklisttree");
-	
-	
+
+	private static final Log logger = LogFactory
+			.getLog("org.w3c.unicorn.tasklisttree");
+
 	/**
 	 * Advanced constructor for a TLTCond.
-	 * @param id 
-	 * @param observer The name of the observer corresponding to the condition
-	 * @param type The type of the condition
+	 * 
+	 * @param id
+	 * @param observer
+	 *            The name of the observer corresponding to the condition
+	 * @param type
+	 *            The type of the condition
 	 */
 	public TLTCond(String id, Observer observer, EnumCondType type, String value) {
-		TLTCond.logger.trace("constructor(" + id + ", " + observer + ", " + type.value() + ")");
+		TLTCond.logger.trace("constructor(" + id + ", " + observer + ", "
+				+ type.value() + ")");
 		this.id = id;
 		this.observer = observer;
 		this.type = type;
 	}
-	
+
 	/**
 	 * Default constructor for a TLTCond.
-	 *
+	 * 
 	 */
 	public TLTCond() {
 		TLTCond.logger.trace("constructor()");
 	}
-	
+
 	/**
 	 * 
-	 * @param id The id of the condition
+	 * @param id
+	 *            The id of the condition
 	 */
 	public void setId(String id) {
 		TLTCond.logger.trace("setId(" + id + ")");
 		this.id = id;
 	}
-	
+
 	/**
 	 * 
-	 * @param observer The observer the condition depends on
+	 * @param observer
+	 *            The observer the condition depends on
 	 */
 	public void setObserver(Observer observer) {
 		TLTCond.logger.trace("setObserver(" + observer + ")");
 		this.observer = observer;
 	}
-	
+
 	/**
 	 * 
-	 * @param result The result of the test
+	 * @param result
+	 *            The result of the test
 	 */
 	public void setResult(boolean result) {
 		TLTCond.logger.trace("setResult(" + result + ")");
 		this.result = result;
 	}
+
 	/**
 	 * 
-	 * @param type The type of the condition
+	 * @param type
+	 *            The type of the condition
 	 */
-	public void setType(EnumCondType type){ 
+	public void setType(EnumCondType type) {
 		TLTCond.logger.trace("setType(" + type.value() + ")");
 		this.type = type;
-		}
-	
-	
+	}
+
 	/**
 	 * 
-	 * @param type The type of the condition
+	 * @param type
+	 *            The type of the condition
 	 */
-	public void setType(String type){ 
+	public void setType(String type) {
 		TLTCond.logger.trace("setType(" + type + ")");
-		for(EnumCondType val : EnumCondType.values()){
-			if(val.value().equals(type))this.type=val;
-		}
+		for (EnumCondType val : EnumCondType.values()) {
+			if (val.value().equals(type)) {
+				this.type = val;
+			}
 		}
-	
+	}
+
 	/**
 	 * 
-	 * @param value value of the condition
+	 * @param value
+	 *            value of the condition
 	 */
-	public void setValue(String value){
+	public void setValue(String value) {
 		TLTCond.logger.trace("setValue(" + value + ")");
-		this.value=value;
+		this.value = value;
 	}
-	
+
 	/**
 	 * @return The id of the condition
 	 */
@@ -106,7 +122,7 @@
 		TLTCond.logger.trace("getId()");
 		return id;
 	}
-	
+
 	/**
 	 * 
 	 * @return The observer the condition depends on
@@ -115,7 +131,7 @@
 		TLTCond.logger.trace("getObserver()");
 		return observer;
 	}
-	
+
 	/**
 	 * 
 	 * @return The result of the test
@@ -124,30 +140,33 @@
 		TLTCond.logger.trace("getResult()");
 		return result;
 	}
-	
+
 	/**
 	 * 
 	 * @return The type of the condition
 	 */
-	public EnumCondType getType(){ 
+	public EnumCondType getType() {
 		TLTCond.logger.trace("getType()");
-		return type;	
+		return type;
 	}
-	
+
 	/**
 	 * 
 	 * @return The value of the condition
 	 */
-	public String getValue(){ 
+	public String getValue() {
 		TLTCond.logger.trace("getValue()");
-		return value;	
+		return value;
 	}
-	
-	public String toString(){
-      if(this.observer != null) {
-          return new String("TLTCond{id: "+this.id+", observer: "+this.observer.getID()+", value: "+this.value+"}");
-      }
-      return new String("TLTCond{id: "+this.id+", value: "+this.value+"}");
+
+	@Override
+	public String toString() {
+		if (this.observer != null) {
+			return new String("TLTCond{id: " + this.id + ", observer: "
+					+ this.observer.getID() + ", value: " + this.value + "}");
+		}
+		return new String("TLTCond{id: " + this.id + ", value: " + this.value
+				+ "}");
 	}
-	
+
 }

Index: TLTIf.java
===================================================================
RCS file: /sources/public/2006/unicorn/org/w3c/unicorn/tasklisttree/TLTIf.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- TLTIf.java	22 Jul 2008 12:21:24 -0000	1.2
+++ TLTIf.java	11 Aug 2009 13:43:02 -0000	1.3
@@ -6,23 +6,27 @@
 import org.apache.commons.logging.LogFactory;
 
 /**
- * Class made to manage the XML type : ifType in the tasklist.
- * Included in a TLTNode, it contains a condition and two child
- * nodes : one if the condition passed and the other if it failed.
+ * Class made to manage the XML type : ifType in the tasklist. Included in a
+ * TLTNode, it contains a condition and two child nodes : one if the condition
+ * passed and the other if it failed.
  * 
  * @author Barouh Jonathan & Batard Florent
- *
+ * 
  */
 public class TLTIf {
 
 	private ArrayList<TLTCond> cond;
+
 	private TLTNode ifOk;
+
 	private TLTNode ifNotOk;
-	private static final Log logger = LogFactory.getLog("org.w3c.unicorn.tasklisttree");
-	
+
+	private static final Log logger = LogFactory
+			.getLog("org.w3c.unicorn.tasklisttree");
+
 	/**
 	 * Default constructor for a TLTIf.
-	 *
+	 * 
 	 */
 	public TLTIf() {
 		TLTIf.logger.trace("Constructor");
@@ -30,12 +34,15 @@
 		this.ifOk = new TLTNode();
 		this.ifNotOk = new TLTNode();
 	}
-	
+
 	/**
 	 * Constructor for a TLTIf with only an ifOk node.
+	 * 
 	 * @param id
-	 * @param cond The condition to check
-	 * @param ifOK The next node if the condition is ok
+	 * @param cond
+	 *            The condition to check
+	 * @param ifOK
+	 *            The next node if the condition is ok
 	 */
 	public TLTIf(ArrayList<TLTCond> cond, TLTNode ifOk) {
 		TLTIf.logger.trace("Constructor");
@@ -44,13 +51,17 @@
 		this.ifOk = ifOk;
 		this.ifNotOk = new TLTNode();
 	}
-	
+
 	/**
 	 * Complete constructor for a TLTif.
+	 * 
 	 * @param id
-	 * @param cond The condition to check
-	 * @param ifOk The next node if the condition is ok
-	 * @param ifNotOK The next node if the condition is not ok
+	 * @param cond
+	 *            The condition to check
+	 * @param ifOk
+	 *            The next node if the condition is ok
+	 * @param ifNotOK
+	 *            The next node if the condition is not ok
 	 */
 	public TLTIf(ArrayList<TLTCond> cond, TLTNode ifOk, TLTNode ifNotOK) {
 		TLTIf.logger.trace("Constructor");
@@ -59,9 +70,10 @@
 		this.ifOk = ifOk;
 		this.ifNotOk = ifNotOK;
 	}
-	
+
 	/**
 	 * Sets the child node corresponding to the "ok" case
+	 * 
 	 * @param ifOk
 	 */
 	public void setIfOk(TLTNode ifOk) {
@@ -71,22 +83,24 @@
 
 	/**
 	 * Sets the child node corresponding to the "notOk" case
+	 * 
 	 * @param ifNotOk
 	 */
 	public void setIfNotOk(TLTNode ifNotOk) {
 		TLTIf.logger.trace("setIfNotOk");
 		this.ifNotOk = ifNotOk;
 	}
-	
+
 	/**
 	 * Sets the condition to check.
+	 * 
 	 * @param cond
 	 */
 	public void addCond(TLTCond cond) {
 		TLTIf.logger.trace("addCond : " + cond.getId());
 		this.cond.add(cond);
 	}
-	
+
 	/**
 	 * 
 	 * @return The child node corresponding to the "ok" case
@@ -95,7 +109,7 @@
 		TLTIf.logger.trace("getIfOk");
 		return ifOk;
 	}
-	
+
 	/**
 	 * 
 	 * @return The child node corresponding to the "notOk" case
@@ -104,7 +118,7 @@
 		TLTIf.logger.trace("getIfNotOk");
 		return ifNotOk;
 	}
-	
+
 	/**
 	 * 
 	 * @return The condition
@@ -113,12 +127,14 @@
 		TLTIf.logger.trace("getCond");
 		return cond;
 	}
-	
-	public String toString(){
-		String res=new String("TLTIf ");
-			for(TLTCond conds : this.cond)
-				res+=conds.toString();
+
+	@Override
+	public String toString() {
+		String res = new String("TLTIf ");
+		for (TLTCond conds : this.cond) {
+			res += conds.toString();
+		}
 		return res;
 	}
-	
+
 }

Received on Tuesday, 11 August 2009 13:43:17 UTC