public boolean matches(String taskId, long startMs, long endMs, TaskStateType state) {
        if ((!taskIds.isEmpty()) && (!taskIds.contains(taskId))) {
            return false;
        }
        if ((firstStartMs > 0) && (startMs < firstStartMs)) {
            return false;
        }
        if ((lastStartMs > 0) && ((startMs < 0) || (startMs > lastStartMs))) {
            return false;
        }
        if ((firstEndMs > 0) && (endMs < firstEndMs)) {
            return false;
        }
        if ((lastEndMs > 0) && ((endMs < 0) || (endMs > lastEndMs))) {
            return false;
        }

        if (this.state.isPresent() && !this.state.get().equals(state)) {
            return false;
        }

        return true;
    }
Determine if this TaskRequest should return a particular task.

@param taskId    The task ID.
@param startMs   The task start time, or -1 if the task hasn't started.
@param endMs     The task end time, or -1 if the task hasn't ended.
@return          True if information about the task should be returned.
trogdor/src/main/java/org/apache/kafka/trogdor/rest/TasksRequest.java