private static Date determineStartDate ( VAlarm valarm , ICalComponent parent ) { Trigger trigger = valarm . getTrigger ( ) ; if ( trigger == null ) { return null ; } Date triggerStart = trigger . getDate ( ) ; if ( triggerStart != null ) { return triggerStart ; } Duration triggerDuration = trigger . getDuration ( ) ; if ( triggerDuration == null ) { return null ; } if ( parent == null ) { return null ; } Related related = trigger . getRelated ( ) ; Date date = null ; if ( related == Related . START ) { date = ValuedProperty . getValue ( parent . getProperty ( DateStart . class ) ) ; } else if ( related == Related . END ) { date = ValuedProperty . getValue ( parent . getProperty ( DateEnd . class ) ) ; if ( date == null ) { Date dateStart = ValuedProperty . getValue ( parent . getProperty ( DateStart . class ) ) ; Duration duration = ValuedProperty . getValue ( parent . getProperty ( DurationProperty . class ) ) ; if ( duration != null && dateStart != null ) { date = duration . add ( dateStart ) ; } } } return ( date == null ) ? null : triggerDuration . add ( date ) ; }
Determines what the alarm property s start date should be .