コード例 #1
0
        private MultiCycle <HyperEquation> FindEquation(Abc shift1, Abc shift2)
        {
            int  k = _k - 1, t = k;
            bool condition = false;

            HyperGeometric2F1.Base.Func <int> nextValue = i => {
                int p = condition ? 2 : 0;
                condition ^= i != (p ^ 2);
                return(i == p ? 1 : p);
            };
            var array = new[] { new[] { shift1, shift2, shift2, shift1 },
                                new[] { -shift1, shift2 - shift1, -shift2, shift1 - shift2 },
                                new[] { shift2 - shift1, -shift1, shift1 - shift2, -shift2 } };
            MultiCycle <HyperEquation> mh, e1, e2;

            do
            {
                e1 = HyperSet.GetEquation(array[t][0], array[t][1]);
                e2 = HyperSet.GetEquation(array[t][2], array[t][3]);
                if ((mh = (e1 == null || e2 == null) ? (e1 ?? e2) :
                          GetMask(e2.Data) > GetMask(e1.Data) ? e2 : e1) != null)
                {
                    k = t;
                }
            } while(mh == null && (t = nextValue(t)) + 1 != _k);
            if (mh == null)
            {
                return(null);
            }
            foreach (var node1 in treeViewList.Nodes)
            {
                foreach (var node2 in ((TreeNode)node1).Nodes)
                {
                    foreach (var node3 in ((TreeNode)node2).Nodes)
                    {
                        var nod = node3 as TreeNodeHyperF;
                        if (nod == null || nod.G != mh)
                        {
                            continue;
                        }
                        numericUpDownShift.Value  = k + 1;
                        treeViewList.SelectedNode = nod;
                        treeViewList.Select();
                        return(mh);
                    }
                }
            }
            return(null);
        }