synchronized Weight getMinimumFinish ( ) { if ( calcMinFinish == null ) { // Find the shortest distance from a finish to time zero. Weight result = WeightFactory . POS_INFINITY ; if ( shortestDistancesFromTimeZeroDestination == null ) { shortestDistancesFromTimeZeroDestination = BellmanFord . calcShortestDistances ( timeZero , directedGraph , BellmanFord . Mode . DESTINATION ) ; if ( shortestDistancesFromTimeZeroDestination == null ) { throw new IllegalStateException ( "Negative cycle detected!" ) ; } } for ( int i = 0 , n = intervals . size ( ) ; i < n ; i ++ ) { Object finish = intervals . get ( i ) . getFinish ( ) ; result = Weight . min ( result , ( Weight ) shortestDistancesFromTimeZeroDestination . get ( finish ) ) ; } calcMinFinish = result . invertSign ( ) ; } return calcMinFinish ; }
Calculates and returns the minimum path from time zero to the finish of an interval .