public static Map<String,Object> dayStartCapacityAvailable(GenericValue techDataCalendarWeek,int dayStart){
  Map<String,Object> result=FastMap.newInstance();
  int moveDay=0;
  Double capacity=null;
  Time startTime=null;
  while (capacity == null || capacity.doubleValue() == 0) {
switch (dayStart) {
case Calendar.MONDAY:
      capacity=techDataCalendarWeek.getDouble("mondayCapacity");
    startTime=techDataCalendarWeek.getTime("mondayStartTime");
  break;
case Calendar.TUESDAY:
capacity=techDataCalendarWeek.getDouble("tuesdayCapacity");
startTime=techDataCalendarWeek.getTime("tuesdayStartTime");
break;
case Calendar.WEDNESDAY:
capacity=techDataCalendarWeek.getDouble("wednesdayCapacity");
startTime=techDataCalendarWeek.getTime("wednesdayStartTime");
break;
case Calendar.THURSDAY:
capacity=techDataCalendarWeek.getDouble("thursdayCapacity");
startTime=techDataCalendarWeek.getTime("thursdayStartTime");
break;
case Calendar.FRIDAY:
capacity=techDataCalendarWeek.getDouble("fridayCapacity");
startTime=techDataCalendarWeek.getTime("fridayStartTime");
break;
case Calendar.SATURDAY:
capacity=techDataCalendarWeek.getDouble("saturdayCapacity");
startTime=techDataCalendarWeek.getTime("saturdayStartTime");
break;
case Calendar.SUNDAY:
capacity=techDataCalendarWeek.getDouble("sundayCapacity");
startTime=techDataCalendarWeek.getTime("sundayStartTime");
break;
}
if (capacity == null || capacity.doubleValue() == 0) {
moveDay+=1;
dayStart=(dayStart == 7) ? 1 : dayStart + 1;
}
}
result.put("capacity",capacity);
result.put("startTime",startTime);
result.put("moveDay",Integer.valueOf(moveDay));
return result;
}

public static Map < String , Object > dayStartCapacityAvailable ( GenericValue techDataCalendarWeek , int dayStart ) { Map < String , Object > result = FastMap . newInstance ( ) ; int moveDay = 0 ; Double capacity = null ; Time startTime = null ; while ( capacity == null || capacity . doubleValue ( ) == 0 ) { switch ( dayStart ) { case Calendar . MONDAY : capacity = techDataCalendarWeek . getDouble ( "mondayCapacity" ) ; startTime = techDataCalendarWeek . getTime ( "mondayStartTime" ) ; break ; case Calendar . TUESDAY : capacity = techDataCalendarWeek . getDouble ( "tuesdayCapacity" ) ; startTime = techDataCalendarWeek . getTime ( "tuesdayStartTime" ) ; break ; case Calendar . WEDNESDAY : capacity = techDataCalendarWeek . getDouble ( "wednesdayCapacity" ) ; startTime = techDataCalendarWeek . getTime ( "wednesdayStartTime" ) ; break ; case Calendar . THURSDAY : capacity = techDataCalendarWeek . getDouble ( "thursdayCapacity" ) ; startTime = techDataCalendarWeek . getTime ( "thursdayStartTime" ) ; break ; case Calendar . FRIDAY : capacity = techDataCalendarWeek . getDouble ( "fridayCapacity" ) ; startTime = techDataCalendarWeek . getTime ( "fridayStartTime" ) ; break ; case Calendar . SATURDAY : capacity = techDataCalendarWeek . getDouble ( "saturdayCapacity" ) ; startTime = techDataCalendarWeek . getTime ( "saturdayStartTime" ) ; break ; case Calendar . SUNDAY : capacity = techDataCalendarWeek . getDouble ( "sundayCapacity" ) ; startTime = techDataCalendarWeek . getTime ( "sundayStartTime" ) ; break ; } if ( capacity == null || capacity . doubleValue ( ) == 0 ) { moveDay += 1 ; dayStart = ( dayStart == 7 ) ? 1 : dayStart + 1 ; } } result . put ( "capacity" , capacity ) ; result . put ( "startTime" , startTime ) ; result . put ( "moveDay" , Integer . valueOf ( moveDay ) ) ; return result ; }
used to find the fisrt day in the techdatacalendarweek where capacity ! = 0 , beginning at daystart , daystart included .
