Tabnine Logo
ITradeRouteStop
Code IndexAdd Tabnine to your IDE (free)

How to use
ITradeRouteStop
in
ch.sahits.game.openpatrician.model.map

Best Java code snippets using ch.sahits.game.openpatrician.model.map.ITradeRouteStop (Showing top 4 results out of 315)

origin: ch.sahits.game/OpenPatricianClientServerInterface

/**
 * Find trade routes with the <code>city</code> as the second stop.
 * @param city of the second stop of the trade route.
 * @return List of applicable trade routes.
 */
public List<ITradeRoute> findTradeRoutesSecondStop(ICity city) {
  List<ITradeRoute> routes = new ArrayList<>();
  for (ITradeRoute route : map.getTradeRoutes()) {
    List<ITradeRouteStop> stops = new ArrayList<>(route.getTradeStops());
    ICity stopCity = stops.get(1).getTradeStop();
    if (stopCity.equals(city)) {
      routes.add(route);
    }
  }
  return routes;
}
origin: ch.sahits.game/OpenPatricianEngine

  ICity firstCity = ((TradeRouteMissionData) missionData).getTradeRoute().getTradeStops().iterator().next().getTradeStop();
  if (firstCity.equals(city)){
    AggregatesDumpTradeStep dumpStep = createAggregatedDumpStep(vessel, city, loadedWares);
for (Iterator<ITradeRouteStop> iterator = route.getTradeStops().iterator(); iterator.hasNext(); ) {
  ITradeRouteStop routeStop =  iterator.next();
  if (routeStop.getTradeStop().equals(city)){
    stop = routeStop;
    if (iterator.hasNext()) {
      routeStop =  iterator.next();
      nextStop = routeStop.getTradeStop();
    } else {
      nextStop = route.getTradeStops().iterator().next().getTradeStop(); // first
List<IWare> buyWares = new ArrayList<>(stop.getWaresToBuy());
AggregatedCheckedBuyTradeStep buyStepHometown = createAggregatedCheckedBuyTradeStep(vessel, city, buyWares);
append(player, vessel, buyStepHometown);
origin: ch.sahits.game/OpenPatricianClientServerInterface

/**
 * Find trade routes with the <code>city</code> as the first stop.
 * @param city of the first stop of the trade route.
 * @return List of applicable trade routes.
 */
public List<ITradeRoute> findTradeRoutesFirstStop(ICity city) {
   List<ITradeRoute> routes = new ArrayList<>();
  for (ITradeRoute route : map.getTradeRoutes()) {
    ITradeRouteStop stop = route.getTradeStops().iterator().next();
    if (stop.getTradeStop().equals(city)) {
      routes.add(route);
    }
  }
  return routes;
}
/**
origin: ch.sahits.game/OpenPatricianEngine

/**
 * {@inheritDoc}<br>
 * Choose the nearest city from the set defined in the trade route.
 * @param vessel that should travel to a city, so that the trade cycle can be reinitialized
 * @return
 */
@Override
public ICity getCityToRestartTradeCycle(INavigableVessel vessel) {
  ITradeMissionData missionData = ((IAIPlayer)vessel.getOwner()).getTradeMission(vessel);
  ITradeRoute route = ((TradeRouteMissionData)missionData).getTradeRoute();
  double distance = Double.MAX_VALUE;
  ICity destination = null;
  for (ITradeRouteStop stop : route.getTradeStops()) {
    double d = vessel.getLocation().distance(stop.getTradeStop().getCoordinates());
    if (d < distance) {
      distance = d;
      destination = stop.getTradeStop();
    }
  }
  return destination;
}
ch.sahits.game.openpatrician.model.mapITradeRouteStop

Most used methods

  • getTradeStop
  • getWaresToBuy

Popular in Java

  • Making http post requests using okhttp
  • onCreateOptionsMenu (Activity)
  • getExternalFilesDir (Context)
  • runOnUiThread (Activity)
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • Selector (java.nio.channels)
    A controller for the selection of SelectableChannel objects. Selectable channels can be registered w
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • Timer (java.util)
    Timers schedule one-shot or recurring TimerTask for execution. Prefer java.util.concurrent.Scheduled
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • Collectors (java.util.stream)
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now