samedi 24 octobre 2015

Schedule assignment, Java current time between to times that are parse from a schedule

I'm new here and I already have a question.

I'm making a assignment for school (in Processing with Java), we are loading a schedule from a txt file. And I need to make a visualisation from it, it's going good but I'm stuck at one point.

I want to make a if statement, to see if the current time is between the Start time and end time. I did parse the start time and End time from the txt file and I can call the current time. But i can't find or know the if statement. can someone help?

Parts of my code ( i can't show everything because i have 6 tabs) :

**//From the main tab**
int s = second();  // Values from 0 - 59
int mi = minute();  // Values from 0 - 59
int h = hour();    // Values from 0 - 23
int d = day();     // Values from 1 - 31
int mo = month();  // values from 1 - 12
int y = year();

// searching all data from Table, comparing location with roomsTTH, if its        the same check iff itint(random(20)), 20's free 
for (TableRow singleRow : tableRooster.rows()) {
ParseInfo parse = new ParseInfo(singleRow); 
for (Room roomToCheck : roomsTTH) {
  if (parse.location == roomToCheck.id) {
    if (roomToCheck.available) {

      if ( y == parseInt(parse.year)) {
        if (mo == parseInt(parse.month)) {
          if ( d == parseInt(parse.day)) {
           // if ( isBetween = currentTime.after(parse.startTime) && currantTime.before(parse.endTime)) {

            //  occupied = true; 
            //  Floor.maxRooms ++;
            }
          }
        }
      }
    }
  }
}
 // }

**//From tab Parse**
 //StartTime
 String startTime;


  //EndTime
  String endTime;


  TableRow myTableRow;

  ParseInfo(TableRow tableRow) {
    parseRow(tableRow);
  }
  // Parse data into variables
  void parseRow(TableRow row) {

// Divide the parse location to level and room
this.location = row.getString("Location");
this.level = this.location.substring(5, 6);
this.room = this.location.substring(8, 9);

// Divide the parse start date to year, month, day
this.date = row.getString("Start date");
this.day = this.date.substring(9, 10);
this.month = this.date.substring(6, 7);
this.year = this.date.substring(0, 3);

// Parse Start time & End time 
this.startTime = row.getString("Start time");
this.endTime = row.getString("End time");
  }
}

Aucun commentaire:

Enregistrer un commentaire