public static Interval [ ] [ ] calculateTemporalDistance ( Interval [ ] [ ] constraintMatrix ) { Interval [ ] [ ] result = new Interval [ constraintMatrix . length ] [ ] ; for ( int i = 0 ; i < result . length ; i ++ ) { result [ i ] = new Interval [ constraintMatrix [ i ] . length ] ; for ( int j = 0 ; j < result [ i ] . length ; j ++ ) { result [ i ] [ j ] = constraintMatrix [ i ] [ j ] . clone ( ) ; } } for ( int k = 0 ; k < result . length ; k ++ ) { for ( int i = 0 ; i < result . length ; i ++ ) { for ( int j = 0 ; j < result . length ; j ++ ) { Interval interval = result [ i ] [ k ] . clone ( ) ; interval . add ( result [ k ] [ j ] ) ; result [ i ] [ j ] . intersect ( interval ) ; } } } return result ; }
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 .