class ChordSelector implements IChordSelector {

    public List<HiveChord> getChordCandidatesTwoBarsPrior(HiveChord currentChord, List<HiveChord> hiveChordInDatabase) {

        List<HiveChord> chordCandidates = new ArrayList<HiveChord>();

        for (int i = 0; i < hiveChordInDatabase.size(); i++) {

            if (i > 1 && hiveChordInDatabase.get(i).isEqual(currentChord)) {
                // has a chord match make sure none of the chords are "empty slots"
                if (!hiveChordInDatabase.get(i - 2).getChordName().equalsIgnoreCase(appConfigs.CHORD_BREAK) && !hiveChordInDatabase.get(i - 1).getChordName().equalsIgnoreCase(appConfigs.CHORD_BREAK)) {
                    //now get the chord 2 bars prior ..
                    chordCandidates.add(hiveChordInDatabase.get(i - 2));
                }
            }
        }

        if (chordCandidates == null || chordCandidates.size() == 0) {
            return null;
        }

        return chordCandidates;
    }

}