public void chordInit() { myChord[1] = new cChord(1, 3, 5, "C", 0, 7); myChord[2] = new cChord(2, 4, 6, "Dm", 0, 2); myChord[3] = new cChord(3, 5, 7, "Em", 0, 3); myChord[4] = new cChord(4, 6, 1, "F", 0, 5); myChord[5] = new cChord(5, 7, 2, "G", 0, 6); myChord[6] = new cChord(6, 1, 3, "Am", 0, 4); myChord[7] = new cChord(7, 2, 4, "G7", 0, 1); //cChord(int a, int b, int c, String name, int counter, int priority) }
//定义比较规则 public int CompareTo(object obj) { cChord p = obj as cChord; if (p == null) { throw new NotImplementedException(); } if (this.counter < p.counter) // More counter is better { return(1); } else if (this.counter == p.counter) { /* * if (this.freq > p.freq)// less freqency * return 1; * else if (this.freq == p.freq) * { * if (this.priority < p.priority) // higher priority * return 1; * else * return -1; * } * else * return -1; * } * else * return -1; */ if (this.priority < p.priority) // higher priority { return(1); } else { return(-1); } } else { return(-1); } }
public void auxChordInit() { auxiliaryChord[1][1] = new cChord(1, 4, 5, "Csus4", 0, 3); auxiliaryChord[1][2] = new cChord(5, 1, 3, "C6", 0, 2); auxiliaryChord[1][3] = new cChord(3, 5, 1, "C4", 0, 1); }