Esempio n. 1
0
  public List<String> getWaveServerMenu(
      final boolean scnl, final double embargo, final double span, final double maxDays) {
    if (!winston.checkConnect()) {
      return null;
    }

    final List<Channel> sts = channels.getChannels();
    if (sts == null) {
      return null;
    }

    final List<String> list = new ArrayList<String>(sts.size());
    for (final Channel st : sts) {
      final String[] ss = st.getCode().split("\\$");
      final double[] ts = {st.getMinTime(), st.getMaxTime()};

      if (maxDays > 0) {
        ts[0] = Math.max(ts[0], J2kSec.now() - (maxDays * ONE_DAY));
      }

      if (ts != null && ts[0] < ts[1]) {

        if (!scnl && ss.length == 3) {
          list.add(
              " "
                  + st.getSID()
                  + " "
                  + ss[0]
                  + " "
                  + ss[1]
                  + " "
                  + ss[2]
                  + " "
                  + decimalFormat.format(Ew.fromEpoch(J2kSec.asEpoch(ts[0])))
                  + " "
                  + decimalFormat.format(Ew.fromEpoch(J2kSec.asEpoch(ts[1])))
                  + " s4 ");
        } else if (scnl) {
          final String loc = (ss.length == 4 ? ss[3] : "--");
          final String line =
              " "
                  + st.getSID()
                  + " "
                  + ss[0]
                  + " "
                  + ss[1]
                  + " "
                  + ss[2]
                  + " "
                  + loc
                  + " "
                  + decimalFormat.format(Ew.fromEpoch(J2kSec.asEpoch(ts[0])))
                  + " "
                  + decimalFormat.format(Ew.fromEpoch(J2kSec.asEpoch(ts[1])))
                  + " s4 ";
          list.add(line);
        }
      }
    }
    return list;
  }