|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.monad.homerun.rule.Clause
public class Clause
A Clause is a related set of Conditions and Tasks forming part of a Rule. When a clause is applied, if the conditions test to true, the tasks are performed.
Constructor Summary | |
---|---|
Clause()
|
|
Clause(Clause clause)
|
Method Summary | |
---|---|
void |
addCondition(Condition condition)
Adds a condition to the end of the clause's condition list |
void |
addCondition(int index,
Condition condition)
Adds a condition to the clause's condition list at specified index |
void |
addTask(int index,
Task task)
Adds a task to the clause's task list at sepcified index |
void |
addTask(Task task)
Adds a task to the end of the clause's list list |
void |
addTemplateVars(java.util.Map<java.lang.String,java.lang.Object> context)
Adds any new template variables to list in context |
boolean |
apply(java.util.Map<java.lang.String,java.lang.Object> context)
Apply the clause - test conditions and if true, perform tasks |
Condition |
getCondition(int index)
Returns the condition at the specified index |
java.lang.String |
getConditionStr(int index)
Returns a decription of the condition at the specified index |
int |
getNumConditions()
Returns the number of conditions in the clause (may be 0) |
int |
getNumTasks()
Returns the number of the tasks in the clause (must be at least 1 if clause is valid) |
Task |
getTask(int index)
Returns the task at the specified index |
java.lang.String |
getTaskStr(int index)
Returns a decription of the task at the specified index |
boolean |
isStartable(Invoker invoker)
is the clause startable? A clause is startable if it has at least on observable condition. |
boolean |
performActions(java.util.Map<java.lang.String,java.lang.Object> context)
Performs the list of tasks in the clause |
void |
removeCondition(int index)
Removes a condition from the clause's condition list at specified index |
void |
removeTask(int index)
Removes a task at the specified index |
void |
replaceCondition(int index,
Condition condition)
Replaces a condition at the specified index |
void |
replaceTask(int index,
Task task)
Replaces the task at specified index with a new task |
boolean |
testConditions(java.util.Map<java.lang.String,java.lang.Object> context)
Test the clause's conditions |
boolean |
validate(java.util.Map<java.lang.String,java.lang.Object> context)
Tests the clause for validity |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Clause()
public Clause(Clause clause)
Method Detail |
---|
public void addCondition(Condition condition)
condition
- Condition added to end of listpublic void addCondition(int index, Condition condition)
index
- Insertion index into condition listcondition
- Condition added to end of listpublic void removeCondition(int index)
index
- Index at which condition will be removedpublic void replaceCondition(int index, Condition condition)
index
- Index at which condition will be replacedcondition
- Condition to replace existing conditionpublic void addTask(Task task)
task
- Task to be added to task listpublic void addTask(int index, Task task)
index
- Index at which condition will be addedtask
- Task to be added to task list at specified indexpublic void removeTask(int index)
index
- Index at which task will be removedpublic void replaceTask(int index, Task task)
index
- Index at which task will be replacedtask
- Task to replace existing taskpublic boolean isStartable(Invoker invoker)
public boolean validate(java.util.Map<java.lang.String,java.lang.Object> context)
invoker
- callStack
- trace
-
public boolean apply(java.util.Map<java.lang.String,java.lang.Object> context) throws NoResourceException
invoker
- callStack
- trace
-
NoResourceException
public boolean testConditions(java.util.Map<java.lang.String,java.lang.Object> context) throws NoResourceException
invoker
- trace
-
NoResourceException
public boolean performActions(java.util.Map<java.lang.String,java.lang.Object> context)
context
- the invocation context
public void addTemplateVars(java.util.Map<java.lang.String,java.lang.Object> context)
public int getNumConditions()
public int getNumTasks()
public Condition getCondition(int index)
index
- the condition index
public Task getTask(int index)
index
- the task index
public java.lang.String getConditionStr(int index)
index
- the condition index
public java.lang.String getTaskStr(int index)
index
- the task index
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |