Examples of Day


Examples of org.apache.myfaces.custom.schedule.model.Day

        float columnWidth = (numberOfDays == 0) ? 100f : (100 / numberOfDays);

        for (Iterator dayIterator = planner.getModel().dayIterator(); dayIterator
                .hasNext();)
        {
            Day day = (Day) dayIterator.next();
            writer.startElement(HTML.TD_ELEM, planner);
            writer.writeAttribute(HTML.CLASS_ATTR, "header", null);
            writer.writeAttribute(HTML.WIDTH_ATTR, String.valueOf(columnWidth)
                    + "%", null);
            writer.writeAttribute(HTML.STYLE_ATTR,
                    "overflow: hidden; height: 31px;", null);
            writer.endElement(HTML.TD_ELEM);
        }

        writer.endElement(HTML.TR_ELEM);

        //header row containing the hours
        writer.startElement(HTML.TR_ELEM, planner);

        for (Iterator dayIterator = planner.getModel().dayIterator(); dayIterator
                .hasNext();)
        {
            Day day = (Day) dayIterator.next();
            writer.startElement(HTML.TD_ELEM, planner);
            writer.writeAttribute(HTML.CLASS_ATTR, "hours", null);
            writer.writeAttribute(HTML.WIDTH_ATTR, String.valueOf(columnWidth)
                    + "%", null);
            writer
View Full Code Here

Examples of org.apache.openmeetings.data.calendar.beans.Day

            Calendar tCal = Calendar.getInstance(timezone);
            tCal.setTimeInMillis(startWeekDay.getTimeInMillis()
                + (z * 86400000L));
           
            Day day = new Day(tCal.getTime());
           
            for (Appointment appointment : appointments) {
              if (appointment
                  .appointmentStartAsCalendar(timezone).get(
                      Calendar.MONTH) == tCal
                  .get(Calendar.MONTH)
                  && appointment.appointmentStartAsCalendar(
                      timezone).get(Calendar.DATE) == tCal
                      .get(Calendar.DATE)) {
                day.getAppointments().add(
                    new AppointmentDTO(appointment,
                        timezone));
              }
            }

View Full Code Here

Examples of org.blync.client.calendar.Day

    public void add(Appointment appointment) {
        String id = appointment.getId();
        delete(id);
        Vector days = new Vector();
        Vector recurrenceDays = new Vector();
        Day startDay = new Day(appointment.getStart());
        Day endDay = new Day(appointment.getEnd());
        for (int i = 0; i < 366; i++) {
            Day occurrence = startDay.add(i);
            if (occurrence.compare(endDay) > 0) {
                break;
            }
            days.addElement(new Integer(occurrence.toInt()));
        }
        if (appointment.getRecurrence() != null) {
            RecurrencePattern recurrence = appointment.getRecurrence();
            int type = recurrence.getType();
            Day repeatUntil = recurrence.getRepeatUntil();
            if (type == RecurrencePattern.REC_DAILY) {
                for (int i = 1; i <= 366; i++) {
                    Day occurrence = startDay.add(i);
                    if (repeatUntil != null && occurrence.compare(repeatUntil) > 0) {
                        break;
                    }
                    if (!recurrence.isException(occurrence)) {
                        recurrenceDays.addElement(new Integer(occurrence.toInt()));
                        days.addElement(new Integer(occurrence.toInt()));
                    }
                }
            }
            else if (type == RecurrencePattern.REC_WEEKLY) {
                for (int i = 1; i <= 105; i++) {
                    Day occurrence = startDay.add(i*7);
                    if (repeatUntil != null && occurrence.compare(repeatUntil) > 0) {
                        break;
                    }
                    if (!recurrence.isException(occurrence)) {
                        recurrenceDays.addElement(new Integer(occurrence.toInt()));
                        days.addElement(new Integer(occurrence.toInt()));
                    }
                }
            }
            else if (type == RecurrencePattern.REC_MONTHLY) {
                CalendarDate startDate = startDay.getCalendarDate();
                for (int i = 1; i <= 24; i++) {
                    Day occurrence = startDate.addMonths(i);
                    if (repeatUntil != null && occurrence.compare(repeatUntil) > 0) {
                        break;
                    }
                    if (!recurrence.isException(occurrence)) {
                        recurrenceDays.addElement(new Integer(occurrence.toInt()));
                        days.addElement(new Integer(occurrence.toInt()));
                    }
                }
            }
            else if (type == RecurrencePattern.REC_YEARLY) {
                CalendarDate startDate = startDay.getCalendarDate();
                for (int i = 1; i <= 5; i++) {
                    Day occurrence = startDate.addYears(i);
                    if (repeatUntil != null && occurrence.compare(repeatUntil) > 0) {
                        break;
                    }
                    if (!recurrence.isException(occurrence)) {
                        recurrenceDays.addElement(new Integer(occurrence.toInt()));
                        days.addElement(new Integer(occurrence.toInt()));
                    }
                }
            }
        }
        idToDaysMap.setValues(id, days);
        idToTitleMap.put(id, appointment.getTitle());
        idToLastModifiedMap.put(id, DateFormatter.dateToICal(new Date()));

        for (int i = 0; i < days.size(); i++) {
            Integer day = (Integer)days.elementAt(i);
            dayToIdsMap.add(day, id);
        }
        save();

        String appointmentId = appointment.getId();
//        alarmIndex.delete(appointmentId);
        if (appointment.getAlarmTime() != null) {
            int startDayNum = new Day(appointment.getStart()).toInt();
            Date alarmTime = appointment.getAlarmTime();
            alarmIndex.add(appointmentId, alarmTime);
            for (int rec = 0; rec < recurrenceDays.size(); rec++) {
                int recDayNum = ((Integer)recurrenceDays.elementAt(rec)).intValue();
                long offset = (recDayNum - startDayNum) * Day.MILISECONDS_IN_DAY;
 
View Full Code Here

Examples of org.boris.expr.function.excel.DAY

        return Integer.parseInt(s);
    }

    private void testDates(double date, int day, int month, int year, int hour,
            int minute, int second, int weekday) throws ExprException {
        assertEquals("testing " + date, eval(new DAY(), date), (double) day);
        assertEquals("testing " + date, eval(new MONTH(), date), (double) month);
        assertEquals("testing " + date, eval(new YEAR(), date), (double) year);
        assertEquals("testing " + date, eval(new HOUR(), date), (double) hour);
        assertEquals("testing " + date, eval(new MINUTE(), date),
                (double) minute);
View Full Code Here

Examples of org.drools.planner.examples.curriculumcourse.domain.Day

                CurriculumCourseSchedule schedule, int dayListSize, int timeslotListSize) throws IOException {
            int periodListSize = dayListSize * timeslotListSize;
            Map<List<Integer>, Period> periodMap = new HashMap<List<Integer>, Period>(periodListSize);
            List<Day> dayList = new ArrayList<Day>(dayListSize);
            for (int i = 0; i < dayListSize; i++) {
                Day day = new Day();
                day.setId((long) i);
                day.setDayIndex(i);
                dayList.add(day);
            }
            schedule.setDayList(dayList);
            List<Timeslot> timeslotList = new ArrayList<Timeslot>(timeslotListSize);
            for (int i = 0; i < timeslotListSize; i++) {
View Full Code Here

Examples of org.drools.planner.examples.travelingtournament.domain.Day

        /**
         * @TODO clean up this code
         */
        private void addDayRotation(List<Move> moveList) {
            for (ListIterator<Day> firstDayIt = dayList.listIterator(); firstDayIt.hasNext();) {
                Day firstDay = firstDayIt.next();
                Map<Team, Match> firstDayTeamMap = dayTeamMap.get(firstDay);
                for (ListIterator<Day> secondDayIt = dayList.listIterator(firstDayIt.nextIndex()); secondDayIt.hasNext();) {
                    Day secondDay = secondDayIt.next();
                    List<Match> clonedFirstDayMatchList = new ArrayList<Match>(firstDayTeamMap.values());
                    while (!clonedFirstDayMatchList.isEmpty()) {
                        List<Match> rotateList = new ArrayList<Match>(4);
                        Match startMatch = clonedFirstDayMatchList.remove(0);
                        boolean otherInFirst = false;
View Full Code Here

Examples of org.drools.planner.examples.travelingtournament.domain.Day

                        List<Match> firstRotateList = new ArrayList<Match>();
                        List<Match> secondRotateList = new ArrayList<Match>();

                        Match firstStartMatch = clonedFirstTeamMatchList.remove(0);
                        Team firstStartTeam = getOtherTeam(firstStartMatch, firstTeam);
                        Day startDay = firstStartMatch.getDay();
                        boolean firstTeamIsHomeTeam = firstStartMatch.getHomeTeam().equals(firstTeam);
                        Match secondStartMatch = teamDayMap.get(secondTeam).get(startDay);
                        if (firstStartMatch.equals(secondStartMatch)) {
                            break;
                        }
                        firstRotateList.add(0, firstStartMatch);
                        secondRotateList.add(secondStartMatch);
                        Map<Team, Match> visitedTeamMap = new HashMap<Team, Match>();

                        Team teamToFind = getOtherTeam(secondStartMatch, secondTeam);

                        while (!teamToFind.equals(firstStartTeam)) {
//                            boolean shortcut = visitedTeamMap.containsKey(teamToFind);
//                            if (shortcut) {
                            Match firstRepairMatch = homeTeamAwayTeamMap
                                    .get(firstTeamIsHomeTeam ? firstTeam : teamToFind)
                                    .get(firstTeamIsHomeTeam ? teamToFind : firstTeam);
                            if (!clonedFirstTeamMatchList.contains(firstRepairMatch)) {
                                if (visitedTeamMap.containsKey(teamToFind)) {
                                    // shortcut splitoff is possible
                                    Match shortcutMatch = visitedTeamMap.get(teamToFind);
                                    int shortcutSize = firstRotateList.indexOf(shortcutMatch) + 1;
                                    int reverseShortcutSize = firstRotateList.size() - shortcutSize;
                                    List<Match> firstShortcutRotateList = new ArrayList<Match>(
                                            firstRotateList.subList(0, shortcutSize));
                                    for (Match match : firstShortcutRotateList) {
                                        visitedTeamMap.remove(getOtherTeam(match, firstTeam));
                                    }
                                    List<Match> secondShortcutRotateList = new ArrayList<Match>(
                                            secondRotateList.subList(reverseShortcutSize, secondRotateList.size()));
                                    firstRotateList = new ArrayList<Match>(
                                            firstRotateList.subList(shortcutSize, firstRotateList.size()));
                                    secondRotateList = new ArrayList<Match>(
                                            secondRotateList.subList(0, reverseShortcutSize));
                                    addTeamRotateMove(moveList, firstShortcutRotateList, secondShortcutRotateList);
                                }
                                firstTeamIsHomeTeam = !firstTeamIsHomeTeam;
//                            Team firstRepairHomeTeam = (firstTeamIsHomeTeam ^ shortcut) ? firstTeam : teamToFind;
//                            Team firstRepairAwayTeam = (firstTeamIsHomeTeam ^ shortcut) ? teamToFind : firstTeam;
//                            Match firstRepairMatch = homeTeamAwayTeamMap
//                                    .get(firstRepairHomeTeam).get(firstRepairAwayTeam);
                                firstRepairMatch = homeTeamAwayTeamMap
                                        .get(firstTeamIsHomeTeam ? firstTeam : teamToFind)
                                        .get(firstTeamIsHomeTeam ? teamToFind : firstTeam);
                            }

                            Day repairDay = firstRepairMatch.getDay();
                            Match secondRepairMatch = teamDayMap.get(secondTeam).get(repairDay);
                            clonedFirstTeamMatchList.remove(firstRepairMatch);
                            visitedTeamMap.put(teamToFind, firstRepairMatch);
                            firstRotateList.add(0, firstRepairMatch);
                            secondRotateList.add(secondRepairMatch);
View Full Code Here

Examples of org.jbpm.cal.Day

   
    return businessCalendar;
  }

  private Day parseDay(Element daysElement, String dayText, DateFormat hourFormat, BusinessCalendar businessCalendar, Parse parse) {
    Day day = new Day();
    day.setBusinessCalendar(businessCalendar);

    Element dayElement = XmlUtil.element(daysElement, dayText);
    if (dayElement!=null) {
      DayPart[] dayParts = null;
      List<Element> partElements = XmlUtil.elements(dayElement, "part");
      if (partElements!=null) {
        dayParts = new DayPart[partElements.size()];
        for (int i=0; i<partElements.size(); i++) {
          dayParts[i] = parseDayPart(partElements.get(i), day, i, hourFormat, parse);
        }
      }
      day.setDayParts(dayParts);
    } else {
      parse.addProblem(dayText+" is not available in business calendar");
    }
    return day;
  }
View Full Code Here

Examples of org.jbpm.pvm.internal.cal.Day

    ProvidedObjectDescriptor descriptor = new ProvidedObjectDescriptor(businessCalendar, true);
    return descriptor;
  }

  private Day parseDay(Element daysElement, String dayText, DateFormat hourFormat, BusinessCalendar businessCalendar, Parse parse) {
    Day day = new Day();
    day.setBusinessCalendar(businessCalendar);

    Element dayElement = XmlUtil.element(daysElement, dayText);
    if (dayElement!=null) {
      List<DayPart> dayParts = new ArrayList<DayPart>();
     
      if (dayElement.hasAttribute("hours")) {
        int dayPartIndex = 0;
        String hours = dayElement.getAttribute("hours");
        for (String part: StringUtil.tokenize(hours, "and")) {
          try {
            int separatorIndex = part.indexOf('-');
            if (separatorIndex==-1) throw new IllegalArgumentException("no dash (-)");
            String fromText = part.substring(0, separatorIndex).trim().toLowerCase();
            String toText = part.substring(separatorIndex+1).trim().toLowerCase();
           
            Date from = hourFormat.parse(fromText);
            Date to = hourFormat.parse(toText);
           
            Calendar calendar = new GregorianCalendar();
            calendar.setTime(from);
            int fromHour = calendar.get(Calendar.HOUR_OF_DAY);
            int fromMinute = calendar.get(Calendar.MINUTE);

            calendar.setTime(to);
            int toHour = calendar.get(Calendar.HOUR_OF_DAY);
            if (toHour==0) {
              toHour=24;
            }
            int toMinute = calendar.get(Calendar.MINUTE);

            DayPart dayPart = new DayPart();
            dayPart.setDay(day);
            dayPart.setIndex(dayPartIndex);
            dayPart.setFromHour(fromHour);
            dayPart.setFromMinute(fromMinute);
            dayPart.setToHour(toHour);
            dayPart.setToMinute(toMinute);
            dayParts.add(dayPart);
           
          } catch(Exception e) {
            parse.addProblem(dayText+" has invalid hours part '"+part+"': "+e.getMessage(), dayElement)
          }
         
          dayPartIndex++;
        }
       
      } else {
        parse.addProblem(dayText+" must have attribute 'hours'", dayElement);
      }
     
      DayPart[] dayPartArray = new DayPart[dayParts.size()];
      dayPartArray = dayParts.toArray(dayPartArray);
      day.setDayParts(dayPartArray);
    }
    return day;
  }
View Full Code Here

Examples of org.jfree.data.time.Day

  {
    if (sampleTimePeriodDataset == null)
    {
      TimePeriodValuesCollection dataset = new TimePeriodValuesCollection();

      Day today = new Day();
      TimePeriodValues series1 = new TimePeriodValues("First");
      TimePeriodValues series2 = new TimePeriodValues("Second");
     
      for (int i = 0; i < 24; i++)
      {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.