public void RemoveNode(object target, MatchingStrategy strategy, bool removeSubsequent)
        {
            IChainRoutingNodeProxy removeProxy = MatchinProxy(target, strategy);
            IChainRoutingNodeProxy nextProxy   = removeSubsequent ? null : removeProxy.NextProxy;

            removeProxy.LastProxy.NextProxy = nextProxy;
        }
示例#2
0
文件: Map.cs 项目: GabitaP/Seguridad
        private string GetCacheKey()
        {
            var keyBuilder = new StringBuilder();

            keyBuilder.AppendFormat("{0}_", GetType().FullName);
            keyBuilder.AppendFormat("{0}_", typeof(TTarget).FullName);
            keyBuilder.AppendFormat("{0}_", typeof(TSource).FullName);
            keyBuilder.AppendFormat("{0}", MatchingStrategy.GetType().FullName);
            return(keyBuilder.ToString());
        }
示例#3
0
        public void InsertNode(object node, object identify, object previous, MatchingStrategy strategy)
        {
            IChainRoutingNodeProxy proxy     = CreateProxy(node, identify);
            IChainRoutingNodeProxy lastProxy = MatchinProxy(previous, strategy);
            IChainRoutingNodeProxy nextProxy = lastProxy.NextProxy;

            lastProxy.NextProxy = proxy;
            proxy.LastProxy     = lastProxy;
            proxy.NextProxy     = nextProxy;
            nextProxy.LastProxy = proxy;
        }
        /// <summary>
        /// 匹配节点
        /// </summary>
        /// <param name="target">匹配目标</param>
        /// <param name="strategy">匹配模式</param>
        /// <returns></returns>
        protected IChainRoutingNodeProxy MatchinProxy(object target, MatchingStrategy strategy)
        {
            if (firstProxy == null)
            {
                return(null);
            }
            IChainRoutingNodeProxy nowProxy = firstProxy;

            switch (strategy)
            {
            case MatchingStrategy.Deep:
                int nowDeep    = 0;
                int targetDeep = (int)target;
                while (firstProxy.NextProxy != null)
                {
                    if (nowDeep == targetDeep)
                    {
                        return(nowProxy);
                    }
                    nowProxy = nowProxy.NextProxy;
                    nowDeep += 1;
                }
                return(nowProxy);

            case MatchingStrategy.Identify:
                while (firstProxy.NextProxy != null)
                {
                    if (nowProxy.ProxyIdentify == target)
                    {
                        return(nowProxy);
                    }
                    nowProxy = nowProxy.NextProxy;
                }
                return(nowProxy);

            case MatchingStrategy.Object:
                while (firstProxy.NextProxy != null)
                {
                    if (nowProxy.ProxyNode == target)
                    {
                        return(nowProxy);
                    }
                    nowProxy = nowProxy.NextProxy;
                }
                return(nowProxy);

            default:
                return(null);
            }
        }
示例#5
0
        /// <summary>
        /// Constructs a record with a name.
        /// </summary>
        /// <param name="name">The name, which will be saved in upper case.</param>
        public PositionRecord(string name)
        {
            // Initialise matcher.
            matcher = new RmsdMatching();

            if (name != null)
            {
                Name = name;
            }
            // Give angles the normal precision.
            for (int i = 0; i < Precision.Length; i++)
            {
                this[i].MaxDiff = Precision[i];
            }
            Standalone = true;
        }
示例#6
0
        public ActionResponse <IEnumerable <TEntity> > Find <TValue>(string fieldName, TValue value, MatchingStrategy strategy, int limit = 100)
        {
            FilterDefinition <TEntity> filter;

            switch (strategy)
            {
            case MatchingStrategy.LessThan:
                filter = FilterBuilder.Lt(fieldName, value);
                break;

            case MatchingStrategy.GreaterThan:
                filter = FilterBuilder.Gt(fieldName, value);
                break;

            default:
                filter = FilterBuilder.Eq(fieldName, value);
                break;
            }

            var hits = Collection.Find(filter).Sort(SortBuilder.Descending(fieldName)).Limit(limit);

            return(new ActionResponse <IEnumerable <TEntity> >
            {
                Code = AppStatusCode.Ok,
                Data = hits.ToList()
            });
        }
示例#7
0
 public void InsertNode(object identify, object previous, MatchingStrategy strategy)
 {
     InsertNode(CreateNode(), identify, previous, strategy);
 }
示例#8
0
 public ActionResponse <IEnumerable <Recipe> > FindRecipes <TValue>(string fieldName, TValue value, MatchingStrategy strategy, int limit = 100)
 {
     return(_recipeRepository.Find(fieldName, value, strategy, limit));
 }
示例#9
0
 /// <summary>
 /// 冒泡路由事件参数
 /// </summary>
 /// <param name="token">事件令牌</param>
 /// <param name="OriginalSource">事件发起源</param>
 /// <param name="matchingStrategy">匹配策略</param>
 /// <param name="matchingParameter">匹配对象</param>
 /// <param name="parameters">匹配对象</param>
 public BubbleEventArgs(string token, object originalSource, MatchingStrategy matchingStrategy, object matchingParameter, params object[] parameters) : base(token, parameters)
 {
     OriginalSource    = originalSource;
     MatchingStrategy  = matchingStrategy;
     MatchingParameter = matchingParameter;
 }