Exemple #1
0
 public static void Insert <TKey, TValue>(this IGistRecords <TKey, TValue> r,
                                          IList <KeyValuePair <TKey, TValue> > records)
 {
     foreach (var kv in records)
     {
         r.Insert(kv);
     }
 }
Exemple #2
0
 protected INode <TKey, TValue> CreateNode <TV>(IGistRecords <TKey, TV> recs)
 {
     if (recs is IGistIndexRecords <TKey> )
     {
         return(new InteriorNode <TKey, TValue>(Config, (IGistIndexRecords <TKey>)recs));
     }
     if (recs is IGistLeafRecords <TKey, TValue> )
     {
         return(new LeafNode <TKey, TValue>(Config, (IGistLeafRecords <TKey, TValue>)recs));
     }
     throw new ApplicationException("Bad records");
 }
Exemple #3
0
 protected byte[] SaveRecords <V>(IGistRecords <TKey, V> records)
 {
     using (var stream = new MemoryStream())
     {
         using (var writer = new BinaryWriter(stream))
         {
             WriteBlockHeader(writer, CreateBlockHeader());
             records.Write(writer);
             return(stream.ToArray());
         }
     }
 }