Beispiel #1
0
  /**
   * Returns whether the specified event time falls between the start and finish times of the
   * specified action.
   *
   * @param action The action to check.
   * @param eventTime The event time to check.
   * @return {@code true} if the event time falls between the start and finish times of the
   *     specified action.
   */
  public boolean hasActionAtTime(int action, long eventTime) {
    final long startTime = mActionStartMap.get(action);
    final boolean hasStarted = (startTime > 0);
    if (!hasStarted || (startTime > eventTime)) {
      // The action hasn't started, or started after the event.
      return false;
    }

    final long finishTime = mActionFinishMap.get(action);
    final boolean hasFinished = (finishTime >= startTime);
    if (hasFinished && (finishTime < eventTime)) {
      // The action finished before the event.
      return false;
    }

    return true;
  }