aggregator-core/src/main/java/org/arrowhead/wp5/agg/impl/Aggregator.java
private void invalidateFlexOffers() {
		long currentTid = FlexOffer.toFlexOfferTime(new Date());
		
		for(FlexOffer f : this.getAllSimpleFlexOffers()) {
			FlexOfferSchedule sch = f.getFlexOfferSchedule();
			
			/* Two case, when : 1) schedule is availabe; 2) schedule is not available */
			if (sch != null) {
				
				/* Start-time bound has been crossed */				
				if (currentTid >= sch.getStartInterval()) {
					
					/* Stat-time treatment - lock-in the start-time */
					f.setStartAfterInterval(sch.getStartInterval());
					f.setStartBeforeInterval(sch.getStartInterval());
					
					/* Energy amount treatment - lock-in the energy amounts */
					long sliceTid = sch.getStartInterval();					
					for (int i=0; i < f.getSlices().length; i++) {
						FlexOfferSlice s = f.getSlice(i);
						
						if (currentTid >= sliceTid) {
							s.getEnergyConstraint().setLower(sch.getEnergyAmount(i));
							s.getEnergyConstraint().setUpper(sch.getEnergyAmount(i));
						}
						
						sliceTid += s.getDuration();
					}
					
					/* Fix the default schedule */
					f.setDefaultSchedule(new FlexOfferSchedule(sch));
				}				
			} else {
				
			
				/* Start time treatment */
				if (currentTid > f.getStartAfterInterval()) {
					
					/* Fix the EST */
					f.setStartAfterInterval(Math.min(currentTid, f.getStartBeforeInterval()));
				}
			}
		}		
	}
/**
	 *  Invalidate (parts of) flex-offer profiles that were supposed to be executed, i.e., are positioned earlier than the current time 
	 *  */
Invalidate (parts of) flex-offer profiles that were supposed to be executed, i.e., are positioned earlier than the current time
Invalidate ( parts of ) flex - offer profiles that were supposed to be executed i . e . are positioned earlier than the current time
private void invalidateFlexOffers() {
		long currentTid = FlexOffer.toFlexOfferTime(new Date());
		for(FlexOffer f : this.getAllSimpleFlexOffers()) {
			FlexOfferSchedule sch = f.getFlexOfferSchedule();
			/* Two case, when : 1) schedule is availabe; 2) schedule is not available */
			if (sch != null) {
				/* Start-time bound has been crossed */				
				if (currentTid >= sch.getStartInterval()) {
					/* Stat-time treatment - lock-in the start-time */
					f.setStartAfterInterval(sch.getStartInterval());
					f.setStartBeforeInterval(sch.getStartInterval());
					/* Energy amount treatment - lock-in the energy amounts */
					long sliceTid = sch.getStartInterval();					
					for (int i=0; i < f.getSlices().length; i++) {
						FlexOfferSlice s = f.getSlice(i);
						if (currentTid >= sliceTid) {
							s.getEnergyConstraint().setLower(sch.getEnergyAmount(i));
							s.getEnergyConstraint().setUpper(sch.getEnergyAmount(i));
						}
						sliceTid += s.getDuration();
					}
					/* Fix the default schedule */
					f.setDefaultSchedule(new FlexOfferSchedule(sch));
				}				
			} else {
				/* Start time treatment */
				if (currentTid > f.getStartAfterInterval()) {
					/* Fix the EST */
					f.setStartAfterInterval(Math.min(currentTid, f.getStartBeforeInterval()));
				}
			}
		}		
	}
private void invalidateFlexOffers ( ) { long currentTid = FlexOffer . toFlexOfferTime ( new Date ( ) ) ; for ( FlexOffer f : this . getAllSimpleFlexOffers ( ) ) { FlexOfferSchedule sch = f . getFlexOfferSchedule ( ) ; /* Two case, when : 1) schedule is availabe; 2) schedule is not available */ if ( sch != null ) { /* Start-time bound has been crossed */ if ( currentTid >= sch . getStartInterval ( ) ) { /* Stat-time treatment - lock-in the start-time */ f . setStartAfterInterval ( sch . getStartInterval ( ) ) ; f . setStartBeforeInterval ( sch . getStartInterval ( ) ) ; /* Energy amount treatment - lock-in the energy amounts */ long sliceTid = sch . getStartInterval ( ) ; for ( int i = 0 ; i < f . getSlices ( ) . length ; i ++ ) { FlexOfferSlice s = f . getSlice ( i ) ; if ( currentTid >= sliceTid ) { s . getEnergyConstraint ( ) . setLower ( sch . getEnergyAmount ( i ) ) ; s . getEnergyConstraint ( ) . setUpper ( sch . getEnergyAmount ( i ) ) ; } sliceTid += s . getDuration ( ) ; } /* Fix the default schedule */ f . setDefaultSchedule ( new FlexOfferSchedule ( sch ) ) ; } } else { /* Start time treatment */ if ( currentTid > f . getStartAfterInterval ( ) ) { /* Fix the EST */ f . setStartAfterInterval ( Math . min ( currentTid , f . getStartBeforeInterval ( ) ) ) ; } } } }
Invalidate (parts of) flex-offer profiles that were supposed to be executed, i.e., are positioned earlier than the current time
Invalidate ( parts of ) flex - offer profiles that were supposed to be executed i . e . are positioned earlier than the current time