src/main/java/com/billybyte/marketdata/futures/ExpiryFromTimeOffsetList.java
private Calendar moveToNthDay(Calendar currDay,int dayToMoveTo,int nThOccurrenceOfThatDay){
		Calendar ret = (Calendar)currDay.clone();
		int direction=0;
		if(nThOccurrenceOfThatDay>0){
			direction = 1;
		}else if(nThOccurrenceOfThatDay<0){
			direction = -1;
		}
		
		// move to first occurrence of dayToMoveTo
		
		for(int i = 0;i<7;i++){
			if(ret.get(Calendar.DAY_OF_WEEK)==dayToMoveTo){
				// found dayToMoveTo
				break;
			}
			ret = Dates.addToCalendar(ret,direction,Calendar.DAY_OF_MONTH,false);
		}
		// now jump forward the number of weeks specified by nThOccurrenceOfThatDay
		// BP bug fix for negative values of nThOccurenceOfThatDay
//		int daysForward = (nThOccurrenceOfThatDay-(1*direction))*7*direction;
		int daysForward = (nThOccurrenceOfThatDay-(1*direction))*7*Math.abs(direction);
		ret = Dates.addToCalendar(ret,daysForward,Calendar.DAY_OF_MONTH,false);
		return ret;
	}
/**
	 * 
	 * @param currDay : day to start from
	 * @param dayToMoveTo : day of week to move to (e.g Calendar.WEDNESDAY)
	 * @param nThOccurrenceOfThatDay : the nth occurrence of the above day to move to
	 * 			If you are moving to the 3rd occurrence of a Wednesday, then this value would be 3.
	 * 			
	 * @return Calendar of day that represents this nth occurrence
	 * 
	 * Example: 
	 * 		currDay = 8/1/2011
	 * 		dayToMoveTo = Calendar.WEDNESDAY
	 * 		nThOccurrenceOfThatDay = 3
	 *   since 8/1/2011 is on a Monday, the 1st Wednesday is the 8/3/2011, and the 3rd Wednesday
	 *        is 8/17/2011
	 *        So, we will return a Calendar object with the date set to 8/17/2011.
	 *   If the currDay that was passed equaled 8/4/2011, then we would return 8/24/2011.
	 */
@param currDay : day to start from
@param dayToMoveTo : day of week to move to
@param nThOccurrenceOfThatDay : the nth occurrence of the above day to move to
If you are moving to the 3rd occurrence of a Wednesday, then this value would be 3.

@return Calendar of day that represents this nth occurrence


@param currDay : day to start from @param dayToMoveTo : day of week to move to @param nThOccurrenceOfThatDay : the nth occurrence of the above day to move to If you are moving to the 3rd occurrence of a Wednesday then this value would be 3 . @return Calendar of day that represents this nth occurrence
private Calendar moveToNthDay(Calendar currDay,int dayToMoveTo,int nThOccurrenceOfThatDay){
		Calendar ret = (Calendar)currDay.clone();
		int direction=0;
		if(nThOccurrenceOfThatDay>0){
			direction = 1;
		}else if(nThOccurrenceOfThatDay<0){
			direction = -1;
		}
		for(int i = 0;i<7;i++){
			if(ret.get(Calendar.DAY_OF_WEEK)==dayToMoveTo){
				break;
			}
			ret = Dates.addToCalendar(ret,direction,Calendar.DAY_OF_MONTH,false);
		}
		int daysForward = (nThOccurrenceOfThatDay-(1*direction))*7*Math.abs(direction);
		ret = Dates.addToCalendar(ret,daysForward,Calendar.DAY_OF_MONTH,false);
		return ret;
	}
private Calendar moveToNthDay ( Calendar currDay , int dayToMoveTo , int nThOccurrenceOfThatDay ) { Calendar ret = ( Calendar ) currDay . clone ( ) ; int direction = 0 ; if ( nThOccurrenceOfThatDay > 0 ) { direction = 1 ; } else if ( nThOccurrenceOfThatDay < 0 ) { direction = - 1 ; } for ( int i = 0 ; i < 7 ; i ++ ) { if ( ret . get ( Calendar . DAY_OF_WEEK ) == dayToMoveTo ) { break ; } ret = Dates . addToCalendar ( ret , direction , Calendar . DAY_OF_MONTH , false ) ; } int daysForward = ( nThOccurrenceOfThatDay - ( 1 * direction ) ) * 7 * Math . abs ( direction ) ; ret = Dates . addToCalendar ( ret , daysForward , Calendar . DAY_OF_MONTH , false ) ; return ret ; }
@param currDay : day to start from
 @param dayToMoveTo : day of week to move to (e.g Calendar.WEDNESDAY)
 @param nThOccurrenceOfThatDay : the nth occurrence of the above day to move to
                      If you are moving to the 3rd occurrence of a Wednesday, then this value would be 3.
@param currDay : day to start from @param dayToMoveTo : day of week to move to ( e . g Calendar . WEDNESDAY ) @param nThOccurrenceOfThatDay : the nth occurrence of the above day to move to If you are moving to the 3rd occurrence of a Wednesday then this value would be 3 .
// move to first occurrence of dayToMoveTo
 // found dayToMoveTo
 // now jump forward the number of weeks specified by nThOccurrenceOfThatDay
 // BP bug fix for negative values of nThOccurenceOfThatDay
 //		int daysForward = (nThOccurrenceOfThatDay-(1*direction))*7*direction;
