private IList<IOverlayNode> AssignResponsibleNodes(QueryNode qn) { var responsibleNodes = new List<IOverlayNode>(); if (qn is QueryConditionNode) { var qnc = qn as QueryConditionNode; if (qnc.LValue.Name.StartsWith("__")) { // we cannot process non-attribute based l-values - just ignore them? return null; } else { var queryNodeKey = OverlayHashKeyPrv.GetHashKey(OverlayHelper.GetHashArgument(qnc.LValue.Name)); var arg = new GetOverlayNodeByKeyArg(queryNodeKey); var responsibleNode = MainOverlaySrv.GetNodeByKey(arg.CopyStatistics(qn)); qn.CopyStatistics(arg); responsibleNodes.Add(responsibleNode); qnc.ResponsibleNode = responsibleNode; qnc.Id = Guid.NewGuid().ToString(); return responsibleNodes; } } else if (qn is QueryGroupNode) { var qng = qn as QueryGroupNode; foreach (var innerQn in qng.Nodes) { responsibleNodes.AddRange(AssignResponsibleNodes(innerQn.CopyStatistics(qn))); } qn.AggregateStatistics(qng.Nodes.ToArray()); return responsibleNodes; } else { throw new NotImplementedException(); } }
public IOverlayNode GetNodeByKey(GetOverlayNodeByKeyArg key) { var result = FindKeySuccessor(new FindKeySuccessorArg(key.Key, true).CopyStatistics(key)); key = key.CopyStatistics(result); return result.Node; }