Class StatisticResult

java.lang.Object
com.targomo.client.api.response.statistics.StatisticResult

public class StatisticResult extends Object
  • Constructor Details

    • StatisticResult

      public StatisticResult(TravelOptions options, org.json.JSONObject jsonResult)
      Parameters:
      options - Travel configuration
      jsonResult - Result as json object
  • Method Details

    • parseReachableStatisticsResult

      public Map<Integer,Map<Integer,Double>> parseReachableStatisticsResult(org.json.JSONObject result)
      Parameters:
      result - result as json object
      Returns:
      Map of targets with reachability and statistics
    • getAggregationToMinute

      public OptionalDouble getAggregationToMinute(Integer statisticId, Integer endMinute, java.util.function.ToDoubleFunction<java.util.stream.DoubleStream> aggregatorFunction)
      This method returns the aggragtion value for all values for the specified statistic and the given minute (starting from 0). So you can use this method to generate the sum or the average of the reachable "targets" for a statistic and minute.
      Parameters:
      statisticId - the id of the statistic
      endMinute - - the minute to which we want to aggregate (inclusive)
      aggregatorFunction - the function that we want to use to aggregate the found values
      Returns:
      the result of the aggregation
      Throws:
      NullPointerException - if no statistics have been set or there are no values for the current statistic id
    • getAggregationToMinute

      public OptionalDouble getAggregationToMinute(Integer statisticId, Integer startMinute, Integer endMinute, java.util.function.ToDoubleFunction<java.util.stream.DoubleStream> aggregatorFunction)
      This method returns the aggragtion value for all values for the specified statistic and the given minute (starting from 0). So you can use this method to generate the sum or the average of the reachable "targets" for a statistic and minute.
      Parameters:
      statisticId - the id of the statistic
      startMinute - - the minute of the interval to start from (inclusive)
      endMinute - - the minute to which we want to aggregate (inclusive)
      aggregatorFunction - the function that we want to use to aggregate the found values
      Returns:
      the result of the aggregation
      Throws:
      NullPointerException - if no statistics have been set or there are no values for the current statistic id
    • getStatistics

      public Map<Integer,Map<Integer,Double>> getStatistics()
    • getReachableTargets

      public Map<Integer,Integer> getReachableTargets()
    • getTargetTravelTimes

      public Map<Integer,Integer> getTargetTravelTimes()
    • toString

      public String toString()
      Overrides:
      toString in class Object