コード例 #1
0
  @Override
  public void entryEvent(EntryEvent event, Deviation deviation) {
    DoorEntry entry = (DoorEntry) event.getSource();

    Deviation dev = entry.getDeviation();
    double devval = dev.getDeviationWeight();

    if (Helper.getRandomDouble() > devval) {
      double d = Helper.getRandomDouble();
      if (Helper.getRandomDouble() < devval) {
        if (d < 0.5) {
          entry.setDoorState(DoorState.CLOSED);
        } else {
          entry.setDoorState(DoorState.OPEN);
        }
      }

      MessageFileWriter writer = MessageFileWriter.getInstance();

      String s =
          "Door;" + entry.getExecutionTime() + ";" + entry.getName() + ";" + entry.getDescription();

      writer.bufferString(entry.getExecutionTime(), s);
    }
  }
コード例 #2
0
  public void entryEvent(EntryEvent event) {
    DoorEntry entry = (DoorEntry) event.getSource();

    MessageFileWriter writer = MessageFileWriter.getInstance();

    String s =
        "Door;" + entry.getExecutionTime() + ";" + entry.getName() + ";" + entry.getDescription();

    writer.bufferString(entry.getExecutionTime(), s);
  }