Package org.drools.core.time
Class TimeUtils
- java.lang.Object
-
- org.drools.core.time.TimeUtils
-
public class TimeUtils extends Object
A helper class with utility methods for time related operations.
-
-
Constructor Summary
Constructors Constructor Description TimeUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Interval[][]
calculateTemporalDistance(Interval[][] constraintMatrix)
This method calculates the transitive closure of the given adjacency matrix in order to find the temporal distance between each event represented in the adjacency matrix.static Date
evalDateExpression(TimerExpression expr, Tuple leftTuple, Declaration[] declrs, InternalWorkingMemory wm)
static long
evalTimeExpression(TimerExpression expr, Tuple leftTuple, Declaration[] declrs, InternalWorkingMemory wm)
static long
parseTimeString(String time)
Parses the given time String and returns the corresponding time in milliseconds
-
-
-
Method Detail
-
calculateTemporalDistance
public static Interval[][] calculateTemporalDistance(Interval[][] constraintMatrix)
This method calculates the transitive closure of the given adjacency matrix in order to find the temporal distance between each event represented in the adjacency matrix. For more information on the calculation of the temporal distance, please refer to the paper: "Discarding Unused Temporal Information in a Production System", by Dan Teodosiu and Gunter Pollak. This method also uses an adaptation of the Floyd-Warshall algorithm to calculate the transitive closure of the interval matrix. More information can be found here: http://en.wikipedia.org/wiki/Floyd-Warshall_algorithm The adaptation of the algorithm follows the definition of the path addition and path intersection operations as defined in the paper previously mentioned. The algorithm runs in O(n^3).- Parameters:
constraintMatrix
- the starting adjacency matrix- Returns:
- the resulting temporal distance matrix
-
parseTimeString
public static long parseTimeString(String time)
Parses the given time String and returns the corresponding time in milliseconds- Parameters:
time
-- Returns:
- Throws:
NullPointerException
- if time is null
-
evalTimeExpression
public static long evalTimeExpression(TimerExpression expr, Tuple leftTuple, Declaration[] declrs, InternalWorkingMemory wm)
-
evalDateExpression
public static Date evalDateExpression(TimerExpression expr, Tuple leftTuple, Declaration[] declrs, InternalWorkingMemory wm)
-
-