<commit_before>package abc.player;

import java.util.ArrayList;
import java.util.List;

/**
 * Voice represents a melodic line (voice) playing at the
 * same time as other melodic lines (voices).
 */
public class Voice implements Music {
    private final String name;
    private final List<Measure> measures;
    
    /**
     * Make a Voice with a given name identifier and measures.
     * @param name identifies the voice
     * @param measures music for the voice to play
     */
    public Voice(String name, List<Measure> measures){
        this.name = name;
        this.measures = measures;
    }

    @Override
    public Fraction duration() {
        List<Fraction> durations = new ArrayList<Fraction>();
        for (Measure measure : measures){
            durations.add(measure.duration());
        }
        return Fraction.sumAllFractions(durations);
    }
    
    /**
     * Identifies the voice with a String name
     * @return name of the voice
     */
    public String name(){
        return name;
    }
    
    /**
     * Returns the measures that the voice plays
     * @return ArrayList<Measure> of measures played by the voice
     */
    public List<Measure> measures(){
        return new ArrayList<Measure>(measures);
    }

    @Override
    public List<PlayerElement> getPlayerElements(int startTick, int ticksPerBeat, Fraction pieceNoteLength) {
        List<PlayerElement> elements = new ArrayList<PlayerElement>();
        int currentStart = startTick;
        for (Measure measure : measures){
            elements.addAll(measure.getPlayerElements(currentStart, ticksPerBeat, pieceNoteLength));
            
            // calculate the start tick of the next music element
            Fraction numBeats = new Fraction(measure.duration().numerator()*pieceNoteLength.denominator(), measure.duration().denominator()*pieceNoteLength.numerator()).simplify();
            int musicDuration = ticksPerBeat*numBeats.numerator()/numBeats.denominator();
            currentStart = currentStart + musicDuration;
        }
        return elements;
    }

    @Override
    public List<Fraction> getAllDurations() {
        List<Fraction> allDurations = new ArrayList<>();
        for (Music music : measures){
            allDurations.addAll(music.getAllDurations());
        }
        return allDurations;
    }


}<commit_msg>changed Voice to take a list of Music instead of Measure<commit_after>package abc.player;

import java.util.ArrayList;
import java.util.List;

/**
 * Voice represents a melodic line (voice) playing at the
 * same time as other melodic lines (voices).
 */
public class Voice implements Music {
    private final String name;
    private final List<Music> musicElements;
    
    /**
     * Make a Voice with a given name identifier and measures.
     * @param name identifies the voice
     * @param musicElements music for the voice to play
     */
    public Voice(String name, List<Music> musicElements){
        this.name = name;
        this.musicElements = musicElements;
    }

    @Override
    public Fraction duration() {
        List<Fraction> durations = new ArrayList<Fraction>();
        for (Music music : musicElements){
            durations.add(music.duration());
        }
        return Fraction.sumAllFractions(durations);
    }
    
    /**
     * Identifies the voice with a String name
     * @return name of the voice
     */
    public String name(){
        return name;
    }
    
    /**
     * Returns the measures that the voice plays
     * @return ArrayList<Measure> of measures played by the voice
     */
    public List<Music> measures(){
        return new ArrayList<Music>(musicElements);
    }

    @Override
    public List<PlayerElement> getPlayerElements(int startTick, int ticksPerBeat, Fraction pieceNoteLength) {
        List<PlayerElement> elements = new ArrayList<PlayerElement>();
        int currentStart = startTick;
        for (Music music : musicElements){
            elements.addAll(music.getPlayerElements(currentStart, ticksPerBeat, pieceNoteLength));
            
            // calculate the start tick of the next music element
            Fraction numBeats = new Fraction(music.duration().numerator()*pieceNoteLength.denominator(), music.duration().denominator()*pieceNoteLength.numerator()).simplify();
            int musicDuration = ticksPerBeat*numBeats.numerator()/numBeats.denominator();
            currentStart = currentStart + musicDuration;
        }
        return elements;
    }

    @Override
    public List<Fraction> getAllDurations() {
        List<Fraction> allDurations = new ArrayList<>();
        for (Music music : musicElements){
            allDurations.addAll(music.getAllDurations());
        }
        return allDurations;
    }


}
{'fraction_non_alphanumeric': 0.09258483452031839, 'fraction_numerical': 0.0, 'mean_word_length': 2.6534047436878345, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3796749', 'n_tokens_mistral': 1252, 'n_tokens_neox': 1214, 'n_words': 370}