using System; using System.Collections.Generic; using System.Linq; using System.Text; using Studyzy.IMEWLConverter.Helpers; namespace Studyzy.IMEWLConverter.Entities { public class Code:List> { public Code(IEnumerable> code) { foreach (var c in code) { this.Add(c); } } /// /// /// /// /// 是否是单拼音这样的一字一码,如果不是则表示为一词多码 public Code(IList code,bool is1Char1Code) { if (is1Char1Code) { foreach (var py in code) { this.Add(new List {py}); } } else { this.Add(code); } } /// /// /// /// 五笔这种一词一码类型 public Code(string code) { this.Add(new List(){code}); } public Code() { } /// /// 取得每个字的编码的第一个编码 /// /// public IList GetDefaultCode() { var result = new List(); foreach (var row in this) { result.Add(row[0]); } return result; } public IList ToCodeString(string codeSplit="", BuildType buildType=BuildType.None) { return CollectionHelper.CartesianProduct(this, codeSplit, buildType); } /// /// 取得第一行第一列编码 /// /// public string GetTop1Code() { return this[0][0]; } } }