List of usage examples for org.joda.time DateTime getDayOfWeek
public int getDayOfWeek()
From source file:ai.events.CodeRedNurserAI2.java
License:Open Source License
@Override protected void handleSpawned() { DateTime now = DateTime.now(); int currentDay = now.getDayOfWeek(); switch (getNpcId()) { case 831435: //Jorpine (MON-THU) case 831436: //Yennu (MON-THU) case 831441: //Hylian (MON-THU) case 831442: {//Rordah (MON-THU) if (currentDay >= 1 && currentDay <= 4) { super.handleSpawned(); } else if (!isAlreadyDead()) { getOwner().getController().onDelete(); }// w ww .j a v a 2 s . c om break; } case 831437: //Dalloren (FRI-SAT) case 831518: //Dalliea (FRI-SAT) case 831443: //Mazka (FRI-SAT) case 831524: { //Deshna (FRI-SAT) if (currentDay >= 5 && currentDay <= 7) { super.handleSpawned(); } else if (!isAlreadyDead()) { getOwner().getController().onDelete(); } break; } } }
From source file:ai.events.SnakeColorsAI2.java
License:Open Source License
@Override protected void handleSpawned() { DateTime now = DateTime.now(); int currentDay = now.getDayOfWeek(); switch (getNpcId()) { case 832975:/* ww w. j a va 2 s . c om*/ case 832964: { if (currentDay >= 1 && currentDay <= 4) { super.handleSpawned(); } else if (!isAlreadyDead()) { getOwner().getController().onDelete(); } break; } case 832974: case 832963: { if (currentDay >= 5 && currentDay <= 7) { super.handleSpawned(); } else if (!isAlreadyDead()) { getOwner().getController().onDelete(); } break; } } }
From source file:au.com.scds.chats.dom.attendance.Attend.java
License:Apache License
@Action() public Attend updateDatesAndTimes(@ParameterLayout(named = "Start Date Time") DateTime start, @ParameterLayout(named = "End Date Time") DateTime end) { if (start != null && end != null) { if (end.isBefore(start)) { container.warnUser("end date & time is earlier than start date & time"); return this; }//from w ww . j a va 2 s . c o m if (end.getDayOfWeek() != start.getDayOfWeek()) { container.warnUser("end date and start date are different days of the week"); return this; } Period period = new Period(start.toLocalDateTime(), end.toLocalDateTime()); Float hours = ((float) period.toStandardMinutes().getMinutes()) / 60; if (hours > 12.0) { container.warnUser("end date & time and start date & time are not in the same 12 hour period"); return this; } setStartDateTime(start); setEndDateTime(end); setAttended(true); } return this; }
From source file:au.com.scds.chats.dom.volunteer.VolunteeredTime.java
License:Apache License
@Action() @MemberOrder(name = "enddatetime", sequence = "1") public VolunteeredTime updateDatesAndTimes(@ParameterLayout(named = "Start Date Time") DateTime start, @ParameterLayout(named = "End Date Time") DateTime end) { if (start != null && end != null) { if (end.isBefore(start)) { container.warnUser("end date & time is earlier than start date & time"); return this; }// w w w . j a v a 2 s . c om if (end.getDayOfWeek() != start.getDayOfWeek()) { container.warnUser("end date and start date are different days of the week"); return this; } Period period = new Period(start.toLocalDateTime(), end.toLocalDateTime()); Float hours = ((float) period.toStandardMinutes().getMinutes()) / 60; if (hours > 12.0) { container.warnUser("end date & time and start date & time are not in the same 12 hour period"); return this; } setStartDateTime(start); setEndDateTime(end); } return this; }
From source file:br.edu.utfpr.cm.JGitMinerWeb.services.metric.auxiliary.AuxCoChangeMetrics.java
private Integer getDayOfWeek(DateTime dateFile) { return dateFile.getDayOfWeek(); }
From source file:br.edu.utfpr.cm.JGitMinerWeb.services.metric.social.TimeMetric.java
public void calculateMetric(AuxAllMetrics pairOfFile, DateTime being, DateTime end) { List<AuxCountTimeMetrics> timeMetricsList = new ArrayList<>(); // if (result.containsKey(pairOfFiles.getAuxPairOfFiles())) { // timeMetricsList = result.get(pairOfFiles.getAuxPairOfFiles()); // } else { // timeMetricsList = new ArrayList<>(); // }//from w ww .j a va2s.c om PeriodOfDayCount periodOfDayCount = new PeriodOfDayCount(); DayOfWeekCount dayOfWeekCount = new DayOfWeekCount(); DayOfMonthCount dayOfMonthCount = new DayOfMonthCount(); MonthCount monthCount = new MonthCount(); // if (isBetweenDate(pairOfFiles.getDateFile1(), being, end)) { if (!pairOfFile.getRepoCommits_idList().isEmpty()) { for (EntityRepositoryCommit repoCommit : pairOfFile.getRepoCommits()) { DateTime repoCommitDate = new DateTime(repoCommit.getCommit().getAuthor().getDateCommitUser(), DateTimeZone.UTC); if (isBetweenDate(repoCommitDate, being, end)) { periodOfDayCount.countPeriodOfDay(getPeriodOfDay(repoCommitDate)); dayOfWeekCount.countDayOfWeek(repoCommitDate.getDayOfWeek()); dayOfMonthCount.countDayOfMonth(repoCommitDate.getDayOfMonth()); monthCount.countMonth(repoCommitDate.getMonthOfYear()); } } } // periodOfDayCount.countPeriodOfDay(pairOfFiles.getPedriodOfDayFile1()); // dayOfWeekCount.countDayOfWeek(pairOfFiles.getDayOfWeekFile1()); // dayOfMonthCount.countDayOfMonth(pairOfFiles.getDayOfMonthFile1()); // monthCount.countMonth(pairOfFiles.getMonthOfModFile1()); AuxCountTimeMetrics timeMetrics = new AuxCountTimeMetrics(periodOfDayCount, dayOfWeekCount, dayOfMonthCount, monthCount); timeMetricsList.add(timeMetrics); // } result.put(pairOfFile.getId(), timeMetricsList); }
From source file:ca.farrelltonsolar.classic.CalendarAdapter.java
License:Apache License
public void refreshDays(DateTime month) { this.month = month; // clear items items.clear();//from w w w . j a v a 2 s . c o m lastDayOfMonth = month.dayOfMonth().withMaximumValue().getDayOfMonth(); firstDayOfFirstWeek = month.getDayOfWeek(); // figure size of the array if (firstDayOfFirstWeek == 0) { days = new String[lastDayOfMonth]; } else { days = new String[lastDayOfMonth + firstDayOfFirstWeek]; } // populate empty days before first real day if (firstDayOfFirstWeek > 0) { for (int j = 0; j < firstDayOfFirstWeek; j++) { days[j] = ""; } } // populate days int dayNumber = 1; for (int i = firstDayOfFirstWeek; i < days.length; i++) { days[i] = "" + dayNumber; dayNumber++; } }
From source file:calculadora.JanelaTrabalho.java
License:Apache License
@Override public boolean estaDentro(DateTime data) { if (data.getDayOfWeek() != DateTimeConstants.SATURDAY && data.getDayOfWeek() != DateTimeConstants.SUNDAY) { int h = data.getHourOfDay(); for (Periodo p : periodos) { if (h >= p.getInicial() && h < p.getFinall()) { return true; }/*from w w w . ja v a2 s.co m*/ } } return false; }
From source file:com.aionemu.gameserver.dataholders.InstanceCooltimeData.java
License:Open Source License
private long getUpdateHours(String[] days, int hour) { DateTime now = DateTime.now(); DateTime repeatDate = new DateTime(now.getYear(), now.getMonthOfYear(), now.getDayOfMonth(), hour, 0, 0); int curentDay = now.getDayOfWeek(); for (String name : days) { int day = getDay(name); if (day < curentDay) { continue; }// w w w. ja va2 s . co m if (day == curentDay) { if (now.isBefore(repeatDate)) { return repeatDate.getMillis(); } } else { repeatDate = repeatDate.plusDays(day - curentDay); return repeatDate.getMillis(); } } return repeatDate.plusDays((7 - curentDay) + getDay(days[0])).getMillis(); }
From source file:com.aionemu.gameserver.services.HousingBidService.java
License:Open Source License
public boolean isBiddingAllowed() { DateTime now = DateTime.now(); DateTime auctionEnd = new DateTime(((long) getRunTime() + timeProlonged * 60) * 1000); if (now.getDayOfWeek() == auctionEnd.getDayOfWeek() && auctionEnd.minusDays(1).isAfterNow()) { // Auction is unavailable from Sunday 12 PM to Monday return false; }/*from ww w. j a v a2 s . c om*/ return true; }