Beispiel #1
0
        internal static SortedTreeNodeBase <TKey, TValue> CreateTreeNode <TKey, TValue>(EncodingDefinition encodingMethod, byte level)
            where TKey : SnapTypeBase <TKey>, new()
            where TValue : SnapTypeBase <TValue>, new()
        {
            if ((object)encodingMethod == null)
            {
                throw new ArgumentNullException("encodingMethod");
            }

            if (encodingMethod.IsFixedSizeEncoding)
            {
                return(new FixedSizeNode <TKey, TValue>(level));
            }

            return(new GenericEncodedNode <TKey, TValue>(Encodings.GetEncodingMethod <TKey, TValue>(encodingMethod), level));
        }
Beispiel #2
0
 /// <summary>
 /// Creates a stream encoding from the provided <see cref="encodingMethod"/>.
 /// </summary>
 /// <typeparam name="TKey"></typeparam>
 /// <typeparam name="TValue"></typeparam>
 /// <param name="encodingMethod">the encoding method</param>
 /// <returns></returns>
 internal static StreamEncodingBase <TKey, TValue> CreateStreamEncoding <TKey, TValue>(EncodingDefinition encodingMethod)
     where TKey : SnapTypeBase <TKey>, new()
     where TValue : SnapTypeBase <TValue>, new()
 {
     return(new StreamEncodingGeneric <TKey, TValue>(encodingMethod));
 }