Class TradeRouteMapper

java.lang.Object
org.episteme.social.history.TradeRouteMapper

public final class TradeRouteMapper extends Object
Maps and models historical trade routes, connecting distant trading posts. Provides tools for distance calculation, travel time estimation, and network centrality analysis.
Since:
1.0
Version:
1.1
Author:
Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
  • Method Details

    • loadHistoricalData

      public static void loadHistoricalData()
      Initializes the database with major historical trade routes.
    • getActiveRoutes

      public static List<TradeRouteMapper.TradeRoute> getActiveRoutes(int year)
      Retrieves all recorded routes that were active in a specific year.
      Parameters:
      year - historical year
      Returns:
      unmodifiable list of active trade routes
    • calculateRouteDistance

      public static Real calculateRouteDistance(TradeRouteMapper.TradeRoute route)
      Calculates the total distance of a trade route in kilometers using haversine formula.
      Parameters:
      route - the trade route
      Returns:
      total distance as a Real number
      Throws:
      NullPointerException - if route is null
    • estimateTravelDays

      public static int estimateTravelDays(TradeRouteMapper.TradeRoute route)
      Estimates the number of travel days for a route based on transport mode.
      Parameters:
      route - the trade route
      Returns:
      estimated duration in days
      Throws:
      NullPointerException - if route is null
    • findByGoods

      public static List<TradeRouteMapper.TradingPost> findByGoods(String commodity)
      Searches for trading posts associated with a specific commodity.
      Parameters:
      commodity - commodity name
      Returns:
      unmodifiable list of trading posts dealing in that commodity
      Throws:
      NullPointerException - if commodity is null
    • calculateCentrality

      public static Map<String,Real> calculateCentrality()
      Calculates the network centrality of trading posts based on route connectivity.
      Returns:
      unmodifiable map of trading post names to centrality score (0.0 to 1.0)