- From: Jonathan Barouh via cvs-syncmail <cvsmail@w3.org>
- Date: Fri, 11 Jul 2008 12:26:09 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/2006/unicorn/org/w3c/unicorn/tasklisttree
In directory hutz:/tmp/cvs-serv1111/org/w3c/unicorn/tasklisttree
Added Files:
TLTIf.java TLTNode.java TLTCond.java TLTExec.java
EnumCondType.java
Log Message:
The tasklisttree package.
--- NEW FILE: TLTNode.java ---
package org.w3c.unicorn.tasklisttree;
import java.util.ArrayList;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* 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 level;
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");
/**
* Default constructor for a node.
*
*/
public TLTNode() {
TLTNode.logger.trace("Constructor");
level = 1;
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
*/
public TLTNode(int level,ArrayList<TLTExec> executionList, ArrayList<TLTIf> ifList) {
TLTNode.logger.trace("Constructor");
TLTNode.logger.trace("Level : " + level);
TLTNode.logger.trace("Number of executions : " + executionList.size());
TLTNode.logger.trace("Number of ifs : " + ifList.size());
this.level = level;
this.executionList = executionList;
this.ifList = ifList;
}
/**
*
* @param level The level of execution
*/
public void setLevel(int level) {
TLTNode.logger.trace("setLevel : " + level);
this.level = level;
}
/**
* Adds an "exec" object to the executionList
* @param exec The "exec" to add
*/
public void addExec(TLTExec exec) {
TLTNode.logger.trace("addExec : " + exec.getId());
if (!executionList.contains(exec))
executionList.add(exec);
}
/**
* Adds an "if" object to the ifList.
* @param tltIf The "if" to add
*/
public void addIf(TLTIf tltIf) {
TLTNode.logger.trace("addIf : " + tltIf.getId());
ifList.add(tltIf);
}
/**
*
* @return The list of executions
*/
public ArrayList<TLTExec> getExecutionList() {
TLTNode.logger.trace("getExecutionList");
return executionList;
}
/**
*
* @return The list of "ifs"
*/
public ArrayList<TLTIf> getIfList() {
TLTNode.logger.trace("getIfList");
return ifList;
}
/**
*
* @return The level of execution
*/
public int getLevel() {
TLTNode.logger.trace("getLevel");
return level;
}
}
--- NEW FILE: TLTExec.java ---
package org.w3c.unicorn.tasklisttree;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.w3.unicorn.tasklist.impl.ParamTypeImpl;
import org.w3.unicorn.tasklist.impl.ValueTypeImpl;
/**
* 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 ValueTypeImpl value;
private ParamTypeImpl param;
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
*/
public TLTExec(String id, ValueTypeImpl value, ParamTypeImpl param) {
TLTExec.logger.trace("Constructor");
TLTExec.logger.trace("Id : " + id);
TLTExec.logger.trace("Value : " + value);
TLTExec.logger.trace("Param : " + param);
this.id = id;
this.value = value;
this.param = param;
}
/**
*
* @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
*/
public void setValue(ValueTypeImpl value) {
TLTExec.logger.trace("setValue : " + value);
this.value = value;
}
/**
*
* @param param The parameter of the exec
*/
public void setParam(ParamTypeImpl param) {
TLTExec.logger.trace("setParam : " + param);
this.param = param;
}
/**
*
* @return The id of the exec
*/
public String getId() {
TLTExec.logger.trace("getId");
return id;
}
/**
*
* @return The observer to run
*/
public ValueTypeImpl getValue() {
TLTExec.logger.trace("getValue");
return value;
}
/**
*
* @return The parameter of the exec
*/
public ParamTypeImpl getParam() {
TLTExec.logger.trace("getParam");
return param;
}
}
--- NEW FILE: EnumCondType.java ---
package org.w3c.unicorn.tasklisttree;
public enum EnumCondType {
XPATH("uri"), MIMETYPE("mimetype");
private final String sValue;
private EnumCondType(final String sValue) {
this.sValue = sValue;
}
public final String value() {
return this.sValue;
}
}
--- NEW FILE: TLTCond.java ---
package org.w3c.unicorn.tasklisttree;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.w3.unicorn.tasklist.TUi.Enum;
/**
* 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 String observer;
private EnumCondType type;
private boolean result;
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
*/
public TLTCond(String id, String observer, EnumCondType type) {
TLTCond.logger.trace("Constructor");
TLTCond.logger.trace("Id : " + id);
TLTCond.logger.trace("Observer : " + observer);
TLTCond.logger.trace("Type : " + 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
*/
public void setId(String id) {
TLTCond.logger.trace("setId : " + id);
this.id = id;
}
/**
*
* @param observer The observer the condition depends on
*/
public void setObserver(String observer) {
TLTCond.logger.trace("setObserver : " + observer);
this.observer = observer;
}
/**
*
* @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
*/
public void setType(EnumCondType type){
TLTCond.logger.trace("setType : " + type.value());
this.type = type;
}
/**
* @return The id of the condition
*/
public String getId() {
TLTCond.logger.trace("getId");
return id;
}
/**
*
* @return The observer the condition depends on
*/
public String getObserver() {
TLTCond.logger.trace("getObserver");
return observer;
}
/**
*
* @return The result of the test
*/
public boolean getResult() {
TLTCond.logger.trace("getResult");
return result;
}
/**
*
* @return The type of the condition
*/
public EnumCondType getType(){
TLTCond.logger.trace("getType");
return type;
}
}
--- NEW FILE: TLTIf.java ---
package org.w3c.unicorn.tasklisttree;
import org.apache.commons.logging.Log;
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.
*
* @author Barouh Jonathan & Batard Florent
*
*/
public class TLTIf {
private String id;
private TLTCond cond;
private TLTNode ifOk;
private TLTNode ifNotOk;
private static final Log logger = LogFactory.getLog("org.w3c.unicorn.tasklisttree");
/**
* Default constructor for a TLTIf.
*
*/
public TLTIf() {
TLTIf.logger.trace("Constructor");
this.id = "defaultIf";
this.cond = new TLTCond();
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
*/
public TLTIf(String id, TLTCond cond, TLTNode ifOk) {
TLTIf.logger.trace("Constructor");
TLTIf.logger.trace("Id : " + id);
TLTIf.logger.trace("Cond : " + cond.getId());
this.id = id;
this.cond = cond;
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
*/
public TLTIf(String id,TLTCond cond, TLTNode ifOk, TLTNode ifNotOK) {
TLTIf.logger.trace("Constructor");
TLTIf.logger.trace("Id : " + id);
TLTIf.logger.trace("Cond : " + cond.getId());
this.id = id;
this.cond = cond;
this.ifOk = ifOk;
this.ifNotOk = ifNotOK;
}
/**
*
* @param id
*/
public void setId(String id) {
TLTIf.logger.trace("setId : " + id);
this.id = id;
}
/**
* Sets the child node corresponding to the "ok" case
* @param ifOk
*/
public void setIfOk(TLTNode ifOk) {
TLTIf.logger.trace("setIfOk");
this.ifOk = ifOk;
}
/**
* 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 setCond(TLTCond cond) {
TLTIf.logger.trace("setCond : " + cond.getId());
this.cond = cond;
}
/**
*
* @return The child node corresponding to the "ok" case
*/
public TLTNode getIfOk() {
TLTIf.logger.trace("getIfOk");
return ifOk;
}
/**
*
* @return The child node corresponding to the "notOk" case
*/
public TLTNode getIfNotOk() {
TLTIf.logger.trace("getIfNotOk");
return ifNotOk;
}
/**
*
* @return The condition
*/
public TLTCond getCond() {
TLTIf.logger.trace("getCond");
return cond;
}
public String getId() {
TLTIf.logger.trace("getId");
return id;
}
}
Received on Friday, 11 July 2008 12:26:43 UTC