question: private static void addNewSegment ( LinkedList < DNASegment > segments , Event event , HashMap < Integer , DNAStrand > strands , int firstJulianDay , int minStart , int minMinutes ) { if ( event . startDay > event . endDay ) { Log . wtf ( TAG , "Event starts after it ends: " + event . toString ( ) ) ; } if ( event . startDay != event . endDay ) { Event lhs = new Event ( ) ; lhs . color = event . color ; lhs . startDay = event . startDay ; lhs . startTime = event . startTime ; lhs . endDay = lhs . startDay ; lhs . endTime = DAY_IN_MINUTES - 1 ; while ( lhs . startDay != event . endDay ) { addNewSegment ( segments , lhs , strands , firstJulianDay , minStart , minMinutes ) ; lhs . startDay ++ ; lhs . endDay = lhs . startDay ; lhs . startTime = 0 ; minStart = 0 ; } lhs . endTime = event . endTime ; event = lhs ; } DNASegment segment = new DNASegment ( ) ; int dayOffset = ( event . startDay - firstJulianDay ) * DAY_IN_MINUTES ; int endOfDay = dayOffset + DAY_IN_MINUTES - 1 ; segment . startMinute = Math . max ( dayOffset + event . startTime , minStart ) ; int minEnd = Math . min ( segment . startMinute + minMinutes , endOfDay ) ; segment . endMinute = Math . max ( dayOffset + event . endTime , minEnd ) ; if ( segment . endMinute > endOfDay ) { segment . endMinute = endOfDay ; } segment . color = event . color ; segment . day = event . startDay ; segments . add ( segment ) ; DNAStrand strand = getOrCreateStrand ( strands , segment . color ) ; strand . count ++ ; }
target:  Add a new segment based on the event provided. This will handle splitting segments across day boundaries and ensures a minimum size for segments.