示例#1
0
  public void printEvents(List<TimedEvent> events) {
    DateTimeFormatter isoLocalDate = DateTimeFormatter.ISO_LOCAL_DATE;
    DateTimeFormatter isoLocalTime = DateTimeFormatter.ISO_LOCAL_TIME;

    ZonedDateTime lastEventTime = ZonedDateTime.of(LocalDateTime.MIN, timeZone);

    for (Iterator<TimedEvent> iterator = events.iterator(); iterator.hasNext(); ) {
      TimedEvent timedEvent = (TimedEvent) iterator.next();
      ZonedDateTime timeCreated = timedEvent.getTimeCreated();

      // print a marker for each new day
      if (!timedEvent.isSameDay(lastEventTime)) {
        ps.print("------------ ");
        ps.print(timeCreated.format(isoLocalDate));
        ps.println(" ------------ ");
      }
      lastEventTime = timeCreated;

      ExtendedEventRecord eventRecord = timedEvent.getEventRecord();
      EventTypes eventType = EventTypes.fromInt(eventRecord.getEventId());
      String formattedTime = timeCreated.format(isoLocalTime);

      ps.println(String.format("%s: %s", formattedTime, eventType));
    }
  }
示例#2
0
  private void inscriptXMLeventTimed(TimedEvent inscriptible, Node specs)
      throws XPathExpressionException {
    String eventname = this.xp.evaluate("./" + EVENTNAME, specs);
    String volmod = this.xp.evaluate("./" + VOLMOD, specs);
    String pitchmod = this.xp.evaluate("./" + PITCHMOD, specs);
    String delaystart = this.xp.evaluate("./" + DELAYSTART, specs);
    String delaymin = this.xp.evaluate("./" + DELAYMIN, specs);
    String delaymax = this.xp.evaluate("./" + DELAYMAX, specs);

    if (eventname != null) {
      inscriptible.event = eventname;
    }

    if (volmod != null) {
      inscriptible.volMod = Float.parseFloat(volmod);
    }

    if (pitchmod != null) {
      inscriptible.pitchMod = Float.parseFloat(pitchmod);
    }

    if (delaystart != null) {
      inscriptible.delayStart = Float.parseFloat(delaystart);
    }

    if (delaymin != null) {
      inscriptible.delayMin = Float.parseFloat(delaymin);
    }

    if (delaymax != null) {
      inscriptible.delayMax = Float.parseFloat(delaymax);
    }
  }