/** Suck up tuples from the source file. */
  private Tuple readNextTuple(DataInputStream dis, int slotId) throws NoSuchElementException {
    // if associated bit is not set, read forward to the next tuple, and
    // return null.
    if (!isSlotUsed(slotId)) {
      for (int i = 0; i < td.getSize(); i++) {
        try {
          dis.readByte();
        } catch (IOException e) {
          throw new NoSuchElementException("error reading empty tuple");
        }
      }
      return null;
    }

    // read fields in the tuple
    Tuple t = new Tuple(td);
    RecordId rid = new RecordId(pid, slotId);
    t.setRecordId(rid);
    try {
      for (int j = 0; j < td.numFields(); j++) {
        Field f = td.getFieldType(j).parse(dis);
        t.setField(j, f);
      }
    } catch (java.text.ParseException e) {
      e.printStackTrace();
      throw new NoSuchElementException("parsing error!");
    }

    return t;
  }
  public UpdateAssetGUI() {
    try {
      PluginMgrClient.init();
      mclient = new MasterMgrClient();
      queue = new QueueMgrClient();
      plug = PluginMgrClient.getInstance();
      log = LogMgr.getInstance();

      pAssetManager = new TreeMap<String, AssetInfo>();

      project = "lr";
      charList = new TreeMap<String, String>();
      setsList = new TreeMap<String, String>();
      propsList = new TreeMap<String, String>();

      potentialUpdates = new TreeSet<String>();
      pSubstituteFields = new TreeMap<String, LinkedList<JBooleanField>>();

      /* load the look-and-feel */
      {
        try {
          SynthLookAndFeel synth = new SynthLookAndFeel();
          synth.load(
              LookAndFeelLoader.class.getResourceAsStream("synth.xml"), LookAndFeelLoader.class);
          UIManager.setLookAndFeel(synth);
        } catch (java.text.ParseException ex) {
          log.log(
              LogMgr.Kind.Ops,
              LogMgr.Level.Severe,
              "Unable to parse the look-and-feel XML file (synth.xml):\n" + "  " + ex.getMessage());
          System.exit(1);
        } catch (UnsupportedLookAndFeelException ex) {
          log.log(
              LogMgr.Kind.Ops,
              LogMgr.Level.Severe,
              "Unable to load the Pipeline look-and-feel:\n" + "  " + ex.getMessage());
          System.exit(1);
        }
      }

      /* application wide UI settings */
      {
        JPopupMenu.setDefaultLightWeightPopupEnabled(false);
        ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);
      }
    } catch (PipelineException ex) {
      ex.printStackTrace();
    } // end try/catch
  } // end constructor
  public static Integer durToInteger(String meta, String date, String time) {
    Integer index = 0;
    Long y;
    Integer hh, mm, day, year, mo, interInMinutes;
    String part[] = meta.split(",");

    hh = Integer.valueOf(part[1]);
    mm = Integer.valueOf(part[2]);
    day = Integer.valueOf(part[3]);
    year = Integer.valueOf(part[4]);
    interInMinutes = Integer.valueOf(part[5]);

    Calendar cal = Calendar.getInstance();
    cal.set(Calendar.HOUR_OF_DAY, hh);
    cal.set(Calendar.MINUTE, mm);
    cal.set(Calendar.SECOND, 0);
    cal.set(Calendar.DAY_OF_YEAR, day);
    cal.set(Calendar.YEAR, year);

    Date d1 = cal.getTime();

    Date t = new Date();
    SimpleDateFormat tf = new SimpleDateFormat("hh:mm a");
    SimpleDateFormat pf = new SimpleDateFormat("HH:mm");
    try {
      t = tf.parse(time);
    } catch (java.text.ParseException e) {
      e.printStackTrace();
    }
    String[] strs = pf.format(t).split(":");

    hh = Integer.valueOf(strs[0]);
    mm = Integer.valueOf(strs[1]);

    String[] spl = date.split(", ");
    String[] spl2 = spl[0].split(" ");

    day = Integer.valueOf(spl2[0]);
    mo = Integer.valueOf(spl2[1]);
    year = Integer.valueOf(spl2[2]);
    Calendar cal2 = Calendar.getInstance();

    cal2.set(Calendar.HOUR_OF_DAY, hh);
    cal2.set(Calendar.MINUTE, mm);
    cal2.set(Calendar.SECOND, 0);
    cal2.set(Calendar.DATE, day);
    cal2.set(Calendar.MONTH, mo - 1);
    cal2.set(Calendar.YEAR, year);

    Date d2 = cal2.getTime();

    date = spl2[0] + " " + new DateFormatSymbols().getMonths()[mo - 1] + ", " + spl[1];
    Map<TimeUnit, Long> DiffMap = Utility.computeDiff(d1, d2);

    y =
        DiffMap.get(TimeUnit.DAYS) * 24 * 60
            + DiffMap.get(TimeUnit.HOURS) * 60
            + DiffMap.get(TimeUnit.MINUTES);
    y = y / interInMinutes + 1;
    index = (int) (long) y;
    return index;
  }