Esempio n. 1
0
  @Override
  public void run() {
    try {
      Messenger.sendEvent(MT.TIMER_SERVICE_CONNECTION, true);

      while (!done) {
        String line = in.readLine();
        log.info("TimerClient reads: " + line);
        if (line.startsWith("DIAL ")) {
          LeftRightDialin d = new LeftRightDialin();
          d.decode(line.substring(5));
          Messenger.sendEvent(MT.TIMER_SERVICE_DIALIN, d);
        } else if (line.startsWith("RUN ")) {
          Run r = new Run();
          r.decode(line.substring(4));
          Messenger.sendEvent(MT.TIMER_SERVICE_RUN, r);
        } else if (line.startsWith("DELETE ")) {
          Run r = new Run();
          r.decode(line.substring(7));
          Messenger.sendEvent(MT.TIMER_SERVICE_DELETE, r);
        }
      }
    } catch (IOException ex) {
      log.log(Level.INFO, "read failure: " + ex, ex);
    }

    try {
      sock.close();
    } catch (IOException ioe) {
    }
    Messenger.sendEvent(MT.TIMER_SERVICE_CONNECTION, false);
  }
Esempio n. 2
0
    public Object getValueAt(int row, int col) {
      Run r = null;
      Run last = null;

      if (data == null) return "";
      r = data.getRun(row + 1);
      if (r == null) return "";

      if (row > 0) last = data.getRun(row);

      switch (col) {
        case 0:
          return df.format(r.getRaw());
        case 2:
          return new String("(" + r.getCones() + "," + r.getGates() + ")");
        case 3:
          return df.format(r.getNet());

        case 1:
          if (r.getRawOrder() == 1) return "*";
          else return "";

        case 4:
          if (r.getNetOrder() <= 2) return r.getNetOrder();
          else return "";
      }
      return null;
    }
Esempio n. 3
0
    public Component getTableCellRendererComponent(
        JTable t, Object o, boolean is, boolean hf, int r, int c) {
      JLabel cell = (JLabel) super.getTableCellRendererComponent(t, o, is, hf, r, c);
      cell.setHorizontalAlignment(JLabel.CENTER);

      EntrantResultModel m = (EntrantResultModel) t.getModel();
      Run run = m.getRun(r);
      if ((run != null) && (run.getNetOrder() == 1)) {
        cell.setFont(bold);
        cell.setBackground(mygray);
      } else {
        cell.setFont(regular);
        cell.setBackground(Color.WHITE);
      }

      return cell;
    }
Esempio n. 4
0
    public void setData(Run[] r) {
      if ((r == null) || (r.length <= 1)) {
        setText("");
        return;
      }

      Run one, two, last;

      one = two = last = r[r.length - 1];
      for (int ii = 0; ii < r.length; ii++) {
        if (r[ii] == null) continue;

        if (r[ii].getNetOrder() == 1) one = r[ii];
        else if (r[ii].getNetOrder() == 2) two = r[ii];

        // if (r[ii].iorder == 1)
        //	raw = r[ii];
      }

      double ndiff, rdiff;

      String txt = "<HTML>";
      if (last.run() != one.run()) {
        ndiff = last.getNet() - one.getNet();
        rdiff = last.getRaw() - one.getRaw();
        if (rdiff < 0) {
          txt +=
              "Run "
                  + last.run()
                  + " raw is "
                  + df.format(-rdiff)
                  + " faster than run "
                  + one.run();
          txt += "<br>However, net is " + df.format(ndiff) + " slower";
        } else {
          txt +=
              "Run " + last.run() + " raw is " + df.format(rdiff) + " slower than run " + one.run();
          if (ndiff != rdiff) txt += "<br>Net is " + df.format(ndiff) + " slower";
        }
      } else {
        ndiff = two.getNet() - last.getNet();
        rdiff = two.getRaw() - last.getRaw();
        if (rdiff < 0) {
          txt +=
              "Run "
                  + last.run()
                  + " raw is "
                  + df.format(-rdiff)
                  + " slower than run "
                  + two.run();
          txt += "<br>However, net is " + df.format(ndiff) + " faster";
        } else {
          txt +=
              "Run " + last.run() + " raw is " + df.format(rdiff) + " faster than run " + two.run();
          if (ndiff != rdiff) txt += "<br>Net is " + df.format(ndiff) + " faster";
        }
      }

      setText(txt);
    }
Esempio n. 5
0
 public boolean deleteRun(Run r) {
   return send(("DELETE " + r.encode() + "\n"));
 }
Esempio n. 6
0
 public boolean sendRun(Run r) {
   return send(("RUN " + r.encode() + "\n"));
 }