/**
   * The nid is cross referenced with the subjects that have already been added to the attendee
   * list. If the subject has already been added an notification message is displayed. Otherwise the
   * subject nid is matched with a subject in either attendance list (primary or reserve). If found
   * the subject is added to the attendee list, otherwise an error notification message is displayed
   * and false is returned.
   *
   * @param nid String Subjects NID
   * @return boolean true is the nid has been matched to a subject in the attendance list, otherwise
   *     false
   */
  private boolean addSubjectToAttendeeList(String nid) {
    // The subject with the NID given has already been added to the attendee list
    Subject subject = experimenter.getSubjectFromAttendeeList(nid);
    if (subject != null) {
      Subject remo = new Subject();
      remo.setEmail("*****@*****.**");
      remo.setNID(Long.toString(Math.round(Math.random())));
      remo.setFirstName("Test");
      remo.setLastName("Subject");
      remo.setPriority(ListPriority.RESERVE.toString());
      remo.setID("3");
      remo.setParticipation("Arrived");
      experimenter.addSubjectToAttendeeList(remo);
      return true;
      //				card.showMessageDialog("The attendance for " + subject.getFirstName() + " " +
      // subject.getLastName() + " has already been recorded.", "Subject Attendance Recorded",
      // JOptionPane.WARNING_MESSAGE);
      //				return false;
    }

    subject = experimenter.getSubjectFromAttendanceList(nid);
    if (subject == null) {
      card.showMessageDialog(
          "An attendee with the nid given was not found to be registered for this experiment.",
          "Attendee not found",
          JOptionPane.ERROR_MESSAGE);
      return false;
    }

    experimenter.addSubjectToAttendeeList(subject);
    return true;
  }
  @Override
  public void keyTyped(KeyEvent e) {
    Character c = e.getKeyChar();

    if (c.equals('\n') && charsRead == ID_LENGTH && !this.nid.equals("")) {
      nid = nid.substring(1, 9);

      addSubjectToAttendeeList(nid);
      card.updateModelViews();
    }

    if (c.equals(START_CHAR)) {
      enableRecorder();
      return;
    }

    // Not Recording Key Entries
    if (!this.recordingKeyEntry) {
      return;
    }

    // Error: ID too short
    if (c.equals(END_CHAR) && charsRead < ID_LENGTH) {
      disableRecroder();
      return;
    }

    // Error: id too long
    if (charsRead > ID_LENGTH) {
      disableRecroder();
      return;
    }

    // Valid: end valid length ID string
    if (c.equals(END_CHAR) && charsRead == ID_LENGTH) {
      disableRecroder();
      System.out.println(this.nid);
      // System.out.println(e.getSource().toString());
    }

    if (this.recordingKeyEntry) {
      this.nid = this.nid + c;
      ++charsRead;
    }
  }