当前位置: 首页>>代码示例>>Java>>正文


Java LocalTime.isBefore方法代码示例

本文整理汇总了Java中org.joda.time.LocalTime.isBefore方法的典型用法代码示例。如果您正苦于以下问题:Java LocalTime.isBefore方法的具体用法?Java LocalTime.isBefore怎么用?Java LocalTime.isBefore使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.joda.time.LocalTime的用法示例。


在下文中一共展示了LocalTime.isBefore方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: filterByDateTimeAndDirection

import org.joda.time.LocalTime; //导入方法依赖的package包/类
public static ArrayList<PossibleTrip> filterByDateTimeAndDirection(ArrayList<PossibleTrip> possibleTrips, LocalDateTime dateTime, Boolean arriving) {
  ArrayList<PossibleTrip> possibleTripsFiltered = new ArrayList<>();

  for (PossibleTrip possibleTrip : possibleTrips) {
    LocalTime departureTime = possibleTrip.getDepartureTime();
    LocalTime arrivalTime = possibleTrip.getArrivalTime();

    if (!arriving) {
      if (departureTime.isAfter(dateTime.toLocalTime())) {
        possibleTripsFiltered.add(possibleTrip);
      }
    } else {
      if (arrivalTime.isBefore(dateTime.toLocalTime()) && arrivalTime.isAfter(dateTime.minusHours(3).toLocalTime())) {
        possibleTripsFiltered.add(possibleTrip);
      }
    }
  }

  return possibleTripsFiltered;
}
 
开发者ID:eleith,项目名称:calchoochoo,代码行数:21,代码来源:PossibleTripUtils.java

示例2: setLocation

import org.joda.time.LocalTime; //导入方法依赖的package包/类
public void setLocation(Location location, double qiblaAngle) {
    if (location == null) return;
    mPrayTimes.setCoordinates(location.getLatitude(), location.getLongitude(), 0);
    mQiblaAngle = qiblaAngle;
    mQiblaTime = mPrayTimes.getQiblaTime();
    LocalTime sunrise = LocalTime.parse(mPrayTimes.getTime(Constants.TIMES_SUNRISE));
    LocalTime sunset = LocalTime.parse(mPrayTimes.getTime(Constants.TIMES_SUNSET));
    LocalTime current = LocalTime.now();

    mShowSun = !(sunset.isBefore(current) || sunrise.isAfter(current));

    mSunriseAngle = Math.toDegrees(getAzimuth(sunrise.toDateTimeToday().getMillis(), location.getLatitude(), location.getLongitude())) - qiblaAngle - 90;
    mSunsetAngle = Math.toDegrees(getAzimuth(sunset.toDateTimeToday().getMillis(), location.getLatitude(), location.getLongitude())) - qiblaAngle - 90;
    mCurrentAngle = Math.toDegrees(getAzimuth(current.toDateTimeToday().getMillis(), location.getLatitude(), location.getLongitude())) - qiblaAngle - 90;
}
 
开发者ID:metinkale38,项目名称:prayer-times-android,代码行数:16,代码来源:QiblaTimeView.java

示例3: isBreakOverMidnight

import org.joda.time.LocalTime; //导入方法依赖的package包/类
private boolean isBreakOverMidnight(TimeTrack timeTrack, Break breakToCheck) {
    // if timeTrack is not over midnight, also break can't be over midnight
    DateTime timeTrackStart = timeTrack.getFrom();
    DateTime timeTrackEnd = timeTrack.getTo() == null ? DateTime.now() : timeTrack.getTo();
    if(timeTrackEnd.isBefore(DateTimeUtils.endOfDay(timeTrackStart))) {
        return false;
    }
    // but if timeTrack is over midnight, we have also to check break
    LocalTime breakStart = breakToCheck.getFrom().toLocalTime();
    LocalTime breakEnd = breakToCheck.getTo() == null ? LocalTime.now() : breakToCheck.getTo().toLocalTime();
    if(breakStart.isBefore(breakEnd)) {
        return false;
    }
    return true;
}
 
开发者ID:peerdavid,项目名称:ComeAndGo,代码行数:16,代码来源:CollectiveAgreementImpl.java

示例4: validateBreakInsideTimeTrack

import org.joda.time.LocalTime; //导入方法依赖的package包/类
private void validateBreakInsideTimeTrack(TimeTrack timeTrack, Break toInsert) throws UserException {
   LocalTime timeTrackStart = timeTrack.getFrom().toLocalTime();
   LocalTime timeTrackEnd = timeTrack.getTo().toLocalTime();

   LocalTime breakStart = toInsert.getFrom().toLocalTime();
   LocalTime breakEnd = toInsert.getTo().toLocalTime();

   // we have nightWork, if start of work e.g. 7pm is "after" 6am
   //   we can trust that original start and end times in module TimeTrack.class are validated to be start before end
   //   but above DateTime is parsed to LocalTime, which means we have no date any more
   boolean nightWork = timeTrackStart.isAfter(timeTrackEnd);
   if(nightWork) {
      // e.g. break is between 8pm and midnight and also after begin of work
      if(breakStart.isAfter(timeTrackStart) && breakEnd.isAfter(timeTrackStart)) {
         return;
      }
      // e.g. break is between midnight and 7am
      if(breakStart.isBefore(timeTrackEnd) && breakEnd.isBefore(timeTrackEnd)) {
         return;
      }
      // e.g. break is over midnight
      if(breakStart.isAfter(timeTrackStart) && breakEnd.isBefore(timeTrackEnd)) {
         return;
      }
      // e.g. break and timeTrack is starting or ending at same moment
      if(breakStart.isEqual(timeTrackStart) || breakEnd.isEqual(timeTrackEnd)) {
         return;
      }
      throwBreakNotInsideTimeTrackException();

   } else {
      if(breakStart.isBefore(timeTrackStart) || breakEnd.isAfter(timeTrackEnd)) {
         throwBreakNotInsideTimeTrackException();
      }
   }
}
 
开发者ID:peerdavid,项目名称:ComeAndGo,代码行数:37,代码来源:TimeTrackingValidationImpl.java

示例5: timeConflict

import org.joda.time.LocalTime; //导入方法依赖的package包/类
public static boolean timeConflict(Course c, Course c2){
	String t=c2.getTime().substring(0, c2.getTime().indexOf(':')+3);
	LocalTime courseStart=new LocalTime(Integer.parseInt(t.substring(0, t.indexOf(':'))), Integer.parseInt(t.substring(t.indexOf(':')+1)));
	t=c2.getTime().substring(c2.getTime().indexOf('-')+1);
	t=t.substring(0, t.indexOf(':')+3);
	LocalTime courseEnd=new LocalTime(Integer.parseInt(t.substring(0, t.indexOf(':'))), Integer.parseInt(t.substring(t.indexOf(':')+1)));
	
		t=c.getTime().substring(0, c.getTime().indexOf(':')+3);
		LocalTime cStart=new LocalTime(Integer.parseInt(t.substring(0, t.indexOf(':'))), Integer.parseInt(t.substring(t.indexOf(':')+1)));
		t=c.getTime().substring(c.getTime().indexOf('-')+1);
		t=t.substring(0, t.indexOf(':')+3);
		LocalTime cEnd=new LocalTime(Integer.parseInt(t.substring(0, t.indexOf(':'))), Integer.parseInt(t.substring(t.indexOf(':')+1)));
		
		if(courseStart.equals(cStart) || courseEnd.equals(cEnd)){
			return true;
		}else if(courseStart.isBefore(cStart)){
			if(courseEnd.isAfter(cStart)){
				return true;
			}
		}
		else if(cStart.isBefore(courseStart)){
			if(cEnd.isAfter(courseStart)){
				return true;
			}
		}
	return false;
}
 
开发者ID:mrjones2014,项目名称:FixedIt,代码行数:28,代码来源:Schedule.java


注:本文中的org.joda.time.LocalTime.isBefore方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。