Logo Search packages:      
Sourcecode: pcalendar version File versions  Download package

Date net::sf::linuxorg::pcal::engine::Engine::getMensPeriodEndDate ( final Date  periodStartDate ) [inline, private]

This method locates the menstrual period end date

Parameters:
periodStartDate- period start date
Returns:
end date or null if periodStartDate does not start a valid period

Definition at line 488 of file Engine.java.

References dateDiff(), and dateTypes.

Referenced by getDayInfoRecorded().

                                                                    {
            Date periodEndDate = null;

            if(periodStartDate == null) return periodEndDate;
            if(dateTypes.get(periodStartDate) == null) return periodEndDate; 

            Date date_pointer = startDates.higher(periodStartDate);

            while(date_pointer != null) {
                  int pointer_date_type = dateTypes.get(date_pointer);

                  if((pointer_date_type == PCAL_TYPE_BIRTH) || 
                              (pointer_date_type == PCAL_TYPE_PREGNANCY_INT)) {
                        // the last period has ended, the new period was not started
                        break;
                  } else 
                        if((pointer_date_type == PCAL_TYPE_MENS) || 
                                    (pointer_date_type == PCAL_TYPE_PREGNANCY)) {
                              int periodLength = dateDiff(periodStartDate, date_pointer);
                              if((periodLength < enginePreferences.regularMinLength) ||
                                          (periodLength > enginePreferences.regularMaxLength)) {
                                    periodEndDate = date_pointer;
                              }                       
                              break;
                        }
                        else {
                              // lets look for the earlier recorded date
                              date_pointer = startDates.higher(date_pointer);
                        }
            }
            return periodEndDate; 
      }

Here is the call graph for this function:

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index