Пример #1
0
 /// <summary>
 /// Constructor used to get the codec and map from these things 
 /// </summary>
 /// <param name="baseCodec">The base codec, necessary to get the string cache from</param>
 public ListAndSetHash(AbstractVCFCodec baseCodec)
 {
     this.parentCodec = baseCodec;
     ListAndHash passList = new ListAndHash() { List = new List<string>().AsReadOnly(), Hash = new ImmutableHashSet<string>() };
     _strToListAndHash[VCFConstants.PASSES_FILTERS_v3] = passList;
     _strToListAndHash[VCFConstants.PASSES_FILTERS_v4] = passList;
 }
Пример #2
0
 private ListAndHash createNewCachedFilter(string filterString)
 {
     List<string> fFields=null;
     // otherwise we have to parse and cache the value
     if (filterString.IndexOf(VCFConstants.FILTER_CODE_SEPARATOR) == -1)
     {
         fFields = new List<string>() {filterString};
     }
     else
     {
         fFields = (from x in filterString.Split(VCFConstants.FILTER_CODE_SEPARATOR_CHAR_ARRAY, StringSplitOptions.RemoveEmptyEntries) select parentCodec.GetCachedString(x)).ToList();
     }
     var list = fFields.AsReadOnly();
     var hash = (from x in _strToListAndHash.Values where x.Hash.SetEquals(list) select x.Hash).FirstOrDefault() ??
                ImmutableHashSet.Create<string>().Union(list);
     ListAndHash toAdd = new ListAndHash() { List = list, Hash = hash };
     _strToListAndHash[filterString] = toAdd;
     return toAdd;
 }