Beispiel #1
0
  /**
   * Construct a Docking Station object with touch screen, card reader and key issuer interface
   * devices and a connection to a number of docking points.
   *
   * <p>If the instance name is <foo>, then the Docking Points are named <foo>.1 ...
   * <foo>.<numPoints> .
   *
   * @param instanceName
   */
  public DStation(String instanceName, int eastPos, int northPos, int numPoints) {

    // Construct and make connections with interface devices

    this.instanceName = instanceName;
    this.eastPos = eastPos;
    this.northPos = northPos;

    touchScreen = new DSTouchScreen(instanceName + ".ts");
    touchScreen.setObserver(this);
    // Set observers to recognise "view activity" and "find free points" options
    touchScreen.setViewActivityObserver(this);
    touchScreen.setFindFreePointsObserver(this);

    cardReader = new CardReader(instanceName + ".cr");

    keyIssuer = new KeyIssuer(instanceName + ".ki");

    keyReader = new KeyReader(instanceName + ".kr");

    dockingPoints = new ArrayList<DPoint>();

    for (int i = 1; i <= numPoints; i++) {
      DPoint dp = new DPoint(instanceName + "." + i, i - 1);
      dockingPoints.add(dp);
    }
  }