Package cross

Source Code of cross.EntryPoint

package cross;

import game_timer.GameTimer;

import java.util.ArrayList;

import logger.Logger;
import map.Map;
import route.Route;
import vehicles.Vehicle;

/**
* Az aut�k kiindul�si pontja; egy olyan keresztez�d�s, melyb�l csak kifel� �gaznak utak.
*
*/

public class EntryPoint extends Cross {
 
  private Map m;
  private ArrayList<Route> inroutes = new ArrayList<Route>();
  private ArrayList<Route> outroutes = new ArrayList<Route>();
  private ArrayList<Vehicle> vehicleInCross = new ArrayList<Vehicle>();

 
  /**
   * az id�l�ptet� f�ggv�ny; megh�vja a megfelel� f�ggv�nyeket adott id�k�z�nk�nt
   */
  public void onTick() {
    Logger.get().addOrdinaryMessage("[EntryPoint.OnTick]: called!");
    Logger.get().addOrdinaryMessage("[EntryPoint.Constructor]: registering to observer...");
    Logger.get().addMethodCall("\t", "GameTimer", "registObserver");
    GameTimer.getInstance().registObserver(this);
    Logger.get().addMethodReturn("\t", "GameTimer", "registObserver");
  }
  /**
   *
   * az entrypointban l�v� aut�t kil�pteti
   */
  public void vehicleOut() {
    Logger.get().addMethodCall("", "EntryPoint", "vehicleOut");
    Route selectedOutRoute = vehicleInCross.get(0).selectRoute(outroutes);
    selectedOutRoute.addVehicle(vehicleInCross.get(0));
    Logger.get().addMethodReturn("", "EntryPoint", "vehicleOut");
  }
  /**
   * az inroutes t�mbh�z hozz�ad egy bemen� utat
   * @param r bemen� �t hozz�ad�sa
   */
  public void addInRoutes(Route r) {//TODO: addInRoute es nem Routes
    Logger.get().addOrdinaryMessage("[EntryPoint.addInRoutes]: Called! and [inRoute added!]");
    inroutes.add(r);
  }
  /**
   * az outroutes t�mbh�z hozz�ad egy bemen� utat
   * @param r kimen� �t hozz�ad�sa
   */
  public void addOutRoutes(Route r) {//TODO: addOutRoute es nem Routes
    Logger.get().addOrdinaryMessage("[EntryPoint.addOutRoutes]: Called! and [outRoute added!]");
    outroutes.add(r);
  }
  /**
   * Aut�t tesz az entrypointba
   * @param v a entrypointba teend� aut�
   */
  public void addVehicleToCross(Vehicle v) {
    Logger.get().addMethodCall("", "EntryPoint", "addVehicleToCross");
    vehicleInCross.add(v);
  }

}
TOP

Related Classes of cross.EntryPoint

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.