|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.swing.tree.DefaultMutableTreeNode org.shapelogic.logic.BaseTask<T>
public class BaseTask<T>
Base class for Task, very fundamental all other tasks are subclassed from this The majority of task functionalety are placed here.
Field Summary | |
---|---|
protected long |
_endTime
|
protected int |
_failedSubTasksCount
|
protected com.google.inject.Injector |
_injector
|
protected float |
_interest
|
protected LogicState |
_lastSubTaskState
|
protected org.apache.commons.jexl.context.HashMapContext |
_localContext
|
protected com.google.inject.Module |
_localModule
|
protected long |
_pathWork
|
protected float |
_score
|
protected long |
_selfWork
|
protected long |
_selfWorkEstimate
|
protected long |
_startTime
|
protected LogicState |
_state
|
protected int |
_succededSubTasksCount
|
protected T |
_value
|
static java.lang.String |
CONTEXT_CALCULATION_MAP
|
static float |
DEFAULT_INTEREST
|
static float |
DEFAULT_SCORE
|
static java.lang.String |
NAMED_TASKS
|
static long |
WORK_NOT_KNOWN
|
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode |
---|
allowsChildren, children, EMPTY_ENUMERATION, parent, userObject |
Constructor Summary | |
---|---|
BaseTask(BaseTask parent)
|
|
BaseTask(BaseTask parent,
boolean createLocalContext)
|
Method Summary | |
---|---|
java.lang.Object |
calcNextSubTask()
calculate the next sub task If it succeed it will return true and pop the last sub task. |
void |
doPrintOnFail()
|
java.lang.String |
errorOnFail()
|
java.lang.Object |
findEnumValue(java.lang.String name)
If a named value cannot be found for a String key, instead see if the first part of the string is the name of a class set in the context if it is the name of a class that is an emum then try to see if rest is an legal value |
java.lang.Object |
findNamedValue(java.lang.String name)
|
java.lang.Object |
findNamedValueUsingSubTasks(java.lang.String name)
|
org.apache.commons.jexl.JexlContext |
getContext()
Deprecated. |
ContextCalculation |
getContextCalculation(java.lang.String name)
|
java.util.Map<java.lang.String,ContextCalculation> |
getContextCalculationMap()
|
com.google.inject.Injector |
getInjector()
|
float |
getInterest()
|
LogicState |
getLastSubTaskState()
|
org.apache.commons.jexl.JexlContext |
getLocalContext()
|
com.google.inject.Module |
getLocalModule()
|
org.apache.commons.jexl.JexlContext |
getLowestContext()
|
java.lang.String |
getName()
|
Task |
getNamedTask(java.lang.String name)
|
java.lang.Object |
getNamedValue(java.lang.String name)
|
Task |
getParentTask()
|
long |
getPathWork()
measured in milliseconds |
float |
getScore()
|
javax.swing.tree.TreeNode |
getSelfTreeNode()
Needed if TreeNode gets taken out of this interface |
long |
getSelfWork()
measured in milliseconds |
long |
getSelfWorkEstimate()
|
LogicState |
getState()
|
T |
getValue()
Starts a lazy calculation. |
java.util.Map |
getVars()
Get map with everything over and including current |
T |
invoke()
|
boolean |
isDirty()
might change into a realy dirty flag |
boolean |
isPrintOnFail()
|
java.util.Iterator<com.google.inject.Module> |
iterator()
|
T |
mainCalc()
|
boolean |
match()
match() should be seen like a unify that can also try to set fields So this can be overridden |
void |
postCalc()
|
void |
preCalc()
|
void |
setClassInContext(java.lang.Class klass)
|
void |
setClassInContext(java.lang.Class[] classes)
|
void |
setClassInContext(java.util.Collection<java.lang.Class> classes)
|
void |
setContextCalculation(java.lang.String name,
ContextCalculation contextCalculation)
|
void |
setInterest(float interest)
|
void |
setName(java.lang.String name)
|
void |
setNamedTask(java.lang.String name,
Task task)
|
void |
setNamedValue(java.lang.String name,
java.lang.Object value)
|
void |
setPrintOnFail(boolean printOnFail)
|
void |
setState(LogicState state)
|
void |
setup()
Currently not super well define used for 2 purposes: Reset: called from the outside if you want to reuse it init: Called from the inside when calculation start to have everything setup maybe the semantic could work for both? TODO: This should be separated better. |
void |
setVars(java.util.Map vars)
|
Methods inherited from class javax.swing.tree.DefaultMutableTreeNode |
---|
add, breadthFirstEnumeration, children, clone, depthFirstEnumeration, getAllowsChildren, getChildAfter, getChildAt, getChildBefore, getChildCount, getDepth, getFirstChild, getFirstLeaf, getIndex, getLastChild, getLastLeaf, getLeafCount, getLevel, getNextLeaf, getNextNode, getNextSibling, getParent, getPath, getPathToRoot, getPreviousLeaf, getPreviousNode, getPreviousSibling, getRoot, getSharedAncestor, getSiblingCount, getUserObject, getUserObjectPath, insert, isLeaf, isNodeAncestor, isNodeChild, isNodeDescendant, isNodeRelated, isNodeSibling, isRoot, pathFromAncestorEnumeration, postorderEnumeration, preorderEnumeration, remove, remove, removeAllChildren, removeFromParent, setAllowsChildren, setParent, setUserObject, toString |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface javax.swing.tree.TreeNode |
---|
children, getAllowsChildren, getChildAt, getChildCount, getIndex, getParent, isLeaf |
Field Detail |
---|
public static final java.lang.String NAMED_TASKS
public static final java.lang.String CONTEXT_CALCULATION_MAP
public static long WORK_NOT_KNOWN
public static float DEFAULT_INTEREST
public static float DEFAULT_SCORE
protected LogicState _state
protected long _pathWork
protected long _selfWork
protected long _selfWorkEstimate
protected long _startTime
protected long _endTime
protected float _interest
protected float _score
protected org.apache.commons.jexl.context.HashMapContext _localContext
protected com.google.inject.Module _localModule
protected com.google.inject.Injector _injector
protected T _value
protected LogicState _lastSubTaskState
protected int _succededSubTasksCount
protected int _failedSubTasksCount
Constructor Detail |
---|
public BaseTask(BaseTask parent, boolean createLocalContext)
public BaseTask(BaseTask parent)
Method Detail |
---|
public boolean isDirty()
isDirty
in interface LazyCalc<T>
public float getInterest()
getInterest
in interface Task<T>
public long getPathWork()
Task
getPathWork
in interface Task<T>
public float getScore()
getScore
in interface Task<T>
public long getSelfWork()
Task
getSelfWork
in interface Task<T>
public long getSelfWorkEstimate()
getSelfWorkEstimate
in interface Task<T>
public LogicState getState()
getState
in interface Task<T>
public void setInterest(float interest)
setInterest
in interface Task<T>
public void setState(LogicState state)
setState
in interface Task<T>
@Deprecated public org.apache.commons.jexl.JexlContext getContext()
getContext
in interface Task<T>
public org.apache.commons.jexl.JexlContext getLowestContext()
getLowestContext
in interface Task<T>
public org.apache.commons.jexl.JexlContext getLocalContext()
getLocalContext
in interface Task<T>
public java.util.Map getVars()
getVars
in interface org.apache.commons.jexl.JexlContext
public void setVars(java.util.Map vars)
setVars
in interface org.apache.commons.jexl.JexlContext
public void preCalc()
preCalc
in interface Task<T>
public void postCalc()
postCalc
in interface Task<T>
public T invoke()
invoke
in interface Calc0<T>
public Task getParentTask()
getParentTask
in interface Task<T>
public javax.swing.tree.TreeNode getSelfTreeNode()
Task
getSelfTreeNode
in interface Task<T>
public T mainCalc()
mainCalc
in interface Task<T>
public boolean match() throws java.lang.Exception
match
in interface Task<T>
java.lang.Exception
public void setup()
LazyCalc
setup
in interface LazyCalc<T>
public com.google.inject.Module getLocalModule()
getLocalModule
in interface Task<T>
public java.util.Iterator<com.google.inject.Module> iterator()
iterator
in interface java.lang.Iterable<com.google.inject.Module>
iterator
in interface Task<T>
public com.google.inject.Injector getInjector()
getInjector
in interface Task<T>
public ContextCalculation getContextCalculation(java.lang.String name)
getContextCalculation
in interface Task<T>
public void setContextCalculation(java.lang.String name, ContextCalculation contextCalculation)
setContextCalculation
in interface Task<T>
public java.lang.Object findNamedValue(java.lang.String name)
findNamedValue
in interface Task<T>
public java.lang.Object findEnumValue(java.lang.String name)
name
- input that should be an enum value with the class at first e.g. PointType.T_JUNCTION
public java.lang.Object findNamedValueUsingSubTasks(java.lang.String name)
findNamedValueUsingSubTasks
in interface Task<T>
public java.lang.Object getNamedValue(java.lang.String name)
getNamedValue
in interface Task<T>
public java.util.Map<java.lang.String,ContextCalculation> getContextCalculationMap()
getContextCalculationMap
in interface Task<T>
public java.lang.Object calcNextSubTask()
calcNextSubTask
in interface Task<T>
public Task getNamedTask(java.lang.String name)
getNamedTask
in interface Task<T>
public void setNamedTask(java.lang.String name, Task task)
setNamedTask
in interface Task<T>
public T getValue()
CalcValue
getValue
in interface CalcValue<T>
getValue
in interface Task<T>
public java.lang.String getName()
getName
in interface Task<T>
public void setName(java.lang.String name)
setName
in interface Task<T>
public LogicState getLastSubTaskState()
getLastSubTaskState
in interface Task<T>
public void setNamedValue(java.lang.String name, java.lang.Object value)
setNamedValue
in interface Task<T>
public void setClassInContext(java.lang.Class klass)
setClassInContext
in interface Task<T>
public void setClassInContext(java.util.Collection<java.lang.Class> classes)
setClassInContext
in interface Task<T>
public void setClassInContext(java.lang.Class[] classes)
setClassInContext
in interface Task<T>
public java.lang.String errorOnFail()
errorOnFail
in interface Task<T>
public void doPrintOnFail()
doPrintOnFail
in interface Task<T>
public boolean isPrintOnFail()
isPrintOnFail
in interface Task<T>
public void setPrintOnFail(boolean printOnFail)
setPrintOnFail
in interface Task<T>
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |