コード例 #1
0
  /** Clears all the ComputerPartErrorEventListeners from errors. */
  public void clearErrorListeners() {
    ComputerPartErrorEvent event = new ComputerPartErrorEvent(this, null);

    for (int i = 0; i < errorListeners.size(); i++)
      ((ComputerPartErrorEventListener) errorListeners.elementAt(i))
          .computerPartErrorOccured(event);
  }
コード例 #2
0
  /**
   * Notifies all the ComputerPartErrorEventListeners on an error that occured in the computer part
   * by creating a ComputerPartErrorEvent (with the error message) and sending it using the
   * computerPartErrorOccured method to all the listeners.
   */
  public void notifyErrorListeners(String errorMessage) {
    ComputerPartErrorEvent event = new ComputerPartErrorEvent(this, errorMessage);

    for (int i = 0; i < errorListeners.size(); i++)
      ((ComputerPartErrorEventListener) errorListeners.elementAt(i))
          .computerPartErrorOccured(event);
  }
コード例 #3
0
ファイル: ROM.java プロジェクト: kingpinzs/nand2tetris-emu
  /**
   * Notifies all the ProgramEventListeners on a change in the ROM's program by creating a
   * ProgramEvent (with the new event type and program's file name) and sending it using the
   * programChanged method to all the listeners.
   */
  protected void notifyProgramListeners(byte eventType, String programFileName) {
    ProgramEvent event = new ProgramEvent(this, eventType, programFileName);

    for (int i = 0; i < listeners.size(); i++) {
      ((ProgramEventListener) listeners.elementAt(i)).programChanged(event);
    }
  }
コード例 #4
0
 public void notifyListeners() {
   ComputerPartEvent event = new ComputerPartEvent(this);
   for (int i = 0; i < listeners.size(); i++) {
     ((ComputerPartEventListener) listeners.elementAt(i)).guiGainedFocus();
   }
 }
コード例 #5
0
 /**
  * Notifies all the ComputerPartEventListeners on a change in the memory by creating a MemoryEvent
  * (with the changed address and value) and sending it using the memoryChanged method to all the
  * listeners.
  */
 public void notifyListeners(int address, short value) {
   ComputerPartEvent event = new ComputerPartEvent(this, address, value);
   for (int i = 0; i < listeners.size(); i++) {
     ((ComputerPartEventListener) listeners.elementAt(i)).valueChanged(event);
   }
 }