/** exit's the application */
  public void exit() {
    // saves posts
    posts.saveFile();

    // saves users and techs in one file
    PersonList pl = new PersonList("Pessoas.dat", Person.PersonTypes.ALL);

    for (int i = 0; i < users.size(); i++) pl.add(users.get(i));
    for (int i = 0; i < techs.size(); i++) pl.add(techs.get(i));
    pl.saveFile();

    tickets.saveFile();

    System.exit(0);
  }
 /** displayList */
 public void displayList(String code) {
   // 入力された職種をもつ従業員のレコードだけを
   // selectedListに取り出す
   selectedList = plist.searchByTypes(work);
   listsize = selectedList.size();
   if (listsize <= 0) System.out.println("従業員が存在しません。");
   else {
     if (code.equals(" ") && next_start_id == 0) {
       System.out.println("最初のページを表示");
       int rows = listsize >= 3 ? 3 : listsize;
       for (int i = 0; i < rows; i++) {
         System.out.println(selectedList.getRecord(i).toString());
       }
       start_id = next_start_id;
       next_start_id = rows;
     } else if (code.equals("N")) {
       if (listsize > next_start_id) {
         System.out.println("次のページを表示");
         int rows = listsize - next_start_id >= 3 ? 3 : listsize - next_start_id;
         for (int i = next_start_id; i < next_start_id + rows; i++) {
           System.out.println(selectedList.getRecord(i).toString());
         }
         start_id = next_start_id;
         next_start_id += rows;
       } else {
         System.out.println("最後まで表示して頭に戻りました");
         int rows = listsize >= 3 ? 3 : listsize;
         for (int i = 0; i < rows; i++) {
           System.out.println(selectedList.getRecord(i).toString());
         }
         start_id = 0;
         next_start_id = rows;
       }
     } else if (code.equals("P")) {
       System.out.println("next_start_id:" + next_start_id);
       System.out.println("start_id: " + start_id);
       if (start_id >= 3) {
         System.out.println("前のページを表示");
         if (next_start_id >= 6) {
           next_start_id = start_id - 3;
         } else {
           next_start_id = 0;
         }
         for (int i = next_start_id; i < next_start_id + 3; i++) {
           System.out.println(selectedList.getRecord(i).toString());
         }
         start_id = next_start_id;
         next_start_id += 3;
       } else {
         System.out.println("末尾の3件を表示");
         next_start_id = listsize >= 3 ? listsize - 3 : 0;
         for (int i = next_start_id; i < listsize; i++) {
           System.out.println(selectedList.getRecord(i).toString());
         }
         start_id = next_start_id;
         next_start_id = listsize;
       }
     }
   }
 }