Beispiel #1
0
    private void DataOfIndexInheritance(List <BranchIndex> curBranchIndexes, List <OrganIndex> curOrganIndexes, bool isSameGC = false)
    {
        /*
         * 不同GC的索引匹配
         */
        PairedBranchIndexes = IndexMatch.BranchIndexes(curBranchIndexes, BranchIndexes);
        PairedOrganIndexes  = IndexMatch.OrganIndexes(curOrganIndexes, OrganIndexes);

        //继承枝干索引的数据
        foreach (PairedIndex <BranchIndex> pairedBranchIndex in PairedBranchIndexes)
        {
            pairedBranchIndex.DataInheritance(isSameGC);
        }

        //继承器官索引的数据
        foreach (PairedIndex <OrganIndex> pairedOrganIndex in PairedOrganIndexes)
        {
            pairedOrganIndex.DataInheritance(isSameGC);
        }
    }
Beispiel #2
0
        /// <summary>
        ///   Partitions index based on a key element, and returns an enumerator for element in one
        ///   side of partition in order.</summary>
        /// <param name="item">
        ///   Key element.</param>
        /// <param name="op">
        ///   Operator that determines the partition. See <see cref="IndexMatch"/></param>
        /// <param name="descending">
        ///   True to traverse in descending order</param>
        /// <returns>
        ///   Enumerator</returns>
        public IEnumerable <T> Match(T item, IndexMatch op, bool descending)
        {
            Node first;
            Node last = null;

            switch (op)
            {
            case IndexMatch.EqualTo:
                first = GetFirstEQ(item);
                last  = first == null ? null : GetLastEQ(item);
                break;

            case IndexMatch.GreaterEqual:
                first = GetFirstGE(item);
                if (descending)
                {
                    last = first == null ? null : GetLast();
                }
                break;

            case IndexMatch.GreaterThan:
                first = GetFirstGT(item);
                if (descending)
                {
                    last = first == null ? null : GetLast();
                }
                break;

            case IndexMatch.LessEqual:
                last  = GetLastLE(item);
                first = last == null ? null : GetFirst();
                break;

            case IndexMatch.LessThan:
                last  = GetLastLT(item);
                first = last == null ? null : GetFirst();
                break;

            default:
                yield break;
            }

            if (descending)
            {
                while (true)
                {
                    if (last == null)
                    {
                        yield break;
                    }

                    yield return(last._item);

                    if (last == first)
                    {
                        last = null;
                    }
                    else
                    {
                        last = last.GetPrior();
                    }
                }
            }
            else
            {
                while (true)
                {
                    if (first == null)
                    {
                        yield break;
                    }

                    yield return(first._item);

                    if (first == last)
                    {
                        first = null;
                    }
                    else
                    {
                        first = first.GetNext();
                    }
                }
            }
        }
Beispiel #3
0
 /// <summary>
 ///   Partitions index based on a key element, and returns an enumerator for element in one
 ///   side of partition in order.</summary>
 /// <param name="item">
 ///   Key element.</param>
 /// <param name="op">
 ///   Operator that determines the partition. See <see cref="IndexMatch"/></param>
 /// <returns>
 ///   Enumerator</returns>
 public IEnumerable <T> Match(T item, IndexMatch op)
 {
     return(Match(item, op, false));
 }
Beispiel #4
0
 /// <summary>
 ///   Creates an enumerator to get pairs in a part of dictionary determined by a key in ascending order
 ///   </summary>
 /// <param name="key">
 ///   The key is used for specifying the cut point</param>
 /// <param name="op">
 ///   which part is being required referenced to cut point. Bkz. <see cref="IndexMatch"/></param>
 /// <returns>
 ///   Enumerator gets pairs by required order from specified range </returns>
 public IEnumerable <KeyValuePair <TKey, TValue> > Match(TKey key, IndexMatch op)
 {
     return(Match(key, op, false));
 }
Beispiel #5
0
 public void AddIndexMatch(IndexMatch entity)
 {
     DB.GetDal <IndexMatch>().Add(entity);
 }