示例#1
0
  @SuppressWarnings("unchecked")
  @Override
  public void readExternal(ObjectInput arg0) throws IOException, ClassNotFoundException {
    createdDate = (LocalDate) arg0.readObject();
    createdTime = (LocalTime) arg0.readObject();
    user = (User) arg0.readObject();
    serveAtDate = (LocalDate) arg0.readObject();
    serveAtTime = (LocalTime) arg0.readObject();
    active = (boolean) arg0.readObject();
    number = (String) arg0.readObject();
    orderedMeals = (ArrayList<MealAndQuantity>) arg0.readObject();

    sspCreatedDate = new SimpleStringProperty(createdDate.toString());
    sspCreatedTime = new SimpleStringProperty(createdTime.toString());
    sspOrderedMeals = new SimpleStringProperty();
    sspUserName = new SimpleStringProperty(user.getUserName().get());
    sspNumber = new SimpleStringProperty(number.toString());
    sspServeAtDate = new SimpleStringProperty(serveAtDate.toString());
    sspServeAtTime = new SimpleStringProperty(serveAtTime.toString());
    sspPrice = new SimpleStringProperty();

    sspCreatedAtCompact =
        new SimpleStringProperty(createdDate.toString() + " " + createdTime.toString());
    sspServeAtCompact =
        new SimpleStringProperty(serveAtDate.toString() + " " + serveAtTime.toString());
  }
示例#2
0
  public Order(
      User user,
      LocalDate createdAtDate,
      LocalTime createdAtTime,
      LocalDate serveAtDate,
      LocalTime serveAtTime,
      String orderNumber,
      String desc)
      throws NullPointerException {
    this.createdDate = createdAtDate;
    this.createdTime = createdAtTime;
    this.user = user;
    createdTime = LocalTime.now();
    this.serveAtDate = serveAtDate;
    this.serveAtTime = serveAtTime;
    this.description = desc;
    orderedMeals = new ArrayList<>();
    number = orderNumber;

    sspCreatedDate = new SimpleStringProperty(createdDate.toString());
    sspCreatedTime = new SimpleStringProperty(createdTime.toString());
    sspOrderedMeals = new SimpleStringProperty();
    sspUserName = new SimpleStringProperty(this.user.getUserName().get());
    sspNumber = new SimpleStringProperty(number.toString());
    sspServeAtDate = new SimpleStringProperty(serveAtDate.toString());
    sspServeAtTime = new SimpleStringProperty(serveAtTime.toString());
    sspPrice = new SimpleStringProperty();
    sspDescription = new SimpleStringProperty(description);

    sspCreatedAtCompact =
        new SimpleStringProperty(createdDate.toString() + " " + createdTime.toString());
    sspServeAtCompact =
        new SimpleStringProperty(serveAtDate.toString() + " " + serveAtTime.toString());
  }
  /** @param args */
  public Collection<String> search(
      Collection<String> logLines, LocalTime startDate, LocalTime endDate) {

    Collection<String> result = new ArrayList<String>();

    int flag = 0;

    for (String logLine : logLines) {

      String pattern =
          "^((([0-9][0-9][0-9][0-9])[-]([0][1-9]|[1][1-2])[-]([0-2][0-9]|[3][0-1]))(T)(([0-1][0-9]|(2)[0-3])(:)[0-5][0-9](:)[0-5][0-9])(Z))";

      // Create a Pattern object
      Pattern r = Pattern.compile(pattern);

      // Now create matcher object.
      Matcher m = r.matcher(logLine);

      if (m.find()) {

        String logTime = m.group(7);

        // System.out.println(logTime+"     "+startDate.toString()+"    "+endDate.toString());

        int c1 = logTime.compareTo(startDate.toString());
        int c2 = logTime.compareTo(endDate.toString());
        // System.out.println(c1 +" "+c2);

        if (c1 >= 0 && c2 < 0) {

          result.add(logLine);
          flag = 1;
        } else {
          flag = 0;
        }
      } else {

        if (flag == 1) {
          result.add(logLine);
        }
      }
    }

    return result;
  }
示例#4
0
  public Order(User user, LocalDate serveAtDate, LocalTime serveAtTime) {
    createdDate = LocalDate.now();
    createdTime = LocalTime.now();
    this.user = user;
    this.serveAtDate = serveAtDate;
    this.serveAtTime = serveAtTime;
    orderedMeals = new ArrayList<>();
    number = new String(createdDate + "-" + createdTime + "-" + (++user.orderCount));

    sspCreatedDate = new SimpleStringProperty(createdDate.toString());
    sspCreatedTime = new SimpleStringProperty(createdTime.toString());
    sspOrderedMeals = new SimpleStringProperty();
    sspUserName = new SimpleStringProperty(user.getUserName().get());
    sspNumber = new SimpleStringProperty(number.toString());
    sspServeAtDate = new SimpleStringProperty(serveAtDate.toString());
    sspServeAtTime = new SimpleStringProperty(serveAtTime.toString());
    sspPrice = new SimpleStringProperty();

    sspCreatedAtCompact =
        new SimpleStringProperty(createdDate.toString() + " " + createdTime.toString());
    sspServeAtCompact =
        new SimpleStringProperty(serveAtDate.toString() + " " + serveAtTime.toString());
  }
 private static void verify_that_isAfterOrEqual_assertion_fails_and_throws_AssertionError(
     LocalTime timeToCheck, LocalTime reference) {
   try {
     assertThat(timeToCheck).isAfterOrEqualTo(reference);
   } catch (AssertionError e) {
     // AssertionError was expected, test same assertion with String based parameter
     try {
       assertThat(timeToCheck).isAfterOrEqualTo(reference.toString());
     } catch (AssertionError e2) {
       // AssertionError was expected (again)
       return;
     }
   }
   fail("Should have thrown AssertionError");
 }
 @Override
 public String toNonNullValue(LocalTime value) {
   return value.toString();
 }