/** * Check if a resource request/response overlaps with the display window. If no end time for the * resource exists, it is treated as Double.MAX_VALUE * * @param resource the resource to check * @param left the left boundary of the window * @param right the right boundary of the window * @return true if some portion of the request falls in the window */ protected boolean isResourceInWindow(NetworkResource resource, double left, double right) { double startTime = resource.getStartTime(); double endTime = resource.getEndTime(); // A version we can use to compare to our left bound double comparableEndTime = endTime; if (Double.isNaN(endTime)) { // We assume the request simply has not terminated, so we set the // comparable version to something big. comparableEndTime = Double.MAX_VALUE; } return (startTime < right && comparableEndTime > left); }