class StepMilestone extends Milestone {

  @Override
  public boolean isOccurring(RouteProgress previousRouteProgress, RouteProgress routeProgress) {

    // Determine if the step index has changed and set called accordingly. This prevents multiple calls to
    // onMilestoneEvent per Step.
    if (previousRouteProgress.currentLegProgress().stepIndex()
      != routeProgress.currentLegProgress().stepIndex()) {
      called = false;
    }
    // If milestone's been called already on current step, no need to check triggers.
    if (called) {
      return false;
    }
    if (builder.getTrigger().isOccurring(
      TriggerProperty.getSparseArray(previousRouteProgress, routeProgress))) {
      called = true;
      return true;
    }
    return false;
  }

  private  StepMilestone(Builder builder);

}