private void InsertChildNode(BPTreeNode <TKey, TData> node, TKey key, TData data) { _data[key] = data; node.Parent = this; var keyIndex = _data.IndexOfKey(key); var grandChildKey = node.Data.Keys.FirstOrDefault(); if (_comparer.Compare(grandChildKey, key) < 0) { node.MaxKey = _comparer.Decrement(key); if (keyIndex > 0) { node.MinKey = _data.Keys.ElementAt(--keyIndex); } else { node.MinKey = _comparer.MinKey; } } else { node.MinKey = key; if (keyIndex < _data.Count - 1) { node.MaxKey = _comparer.Decrement(_data.Keys.ElementAt(++keyIndex)); } else { node.MaxKey = FindMyMaxKey(node); } } _children.Add(node); if (IsFull) { SplitNode(); } }
public ParameterCompareResult ComparerParameters(IList <IParameter> originalParameters, IList <IParameter> methodParameters) { if (methodParameters.Count != originalParameters.Count) { return(ParameterCompareResult.CreateFailDifferentLength()); } var parameterResults = new CompareResult[methodParameters.Count]; for (var i = 0; i < methodParameters.Count; i++) { var parameter = methodParameters[i]; var originalParameter = originalParameters[i]; parameterResults[i] = new CompareResult { From = originalParameter.Type, To = parameter.Type, Action = typeComparer.Compare(originalParameter.Type, parameter.Type), }; } return(ParameterCompareResult.Create(parameterResults)); }
public int Compare(TKey one, TKey two) { return(_specificComparer.Compare(one, two)); }