public int Compare(WordInfo other) { int p = string.Compare(Pinyin, other.Pinyin); if (p == 0) { int w = string.Compare(Word, other.Word); if (w == 0) { int c = Count - other.Count; if (c == 0) return 0; else if (c > 0) return 1; else return -1; } else if (w > 0) return 2; else return -2; } else if (p > 0) return 3; else return -3; }
public bool SameWord(WordInfo other) { var compare = Compare(other); return compare >= -1 && compare <= 1; }
public void AddWord(WordInfo word) { wordList1.Add(word); }