natix.SimilaritySearch.KnrSeqSearch.GetCandidates C# (CSharp) 메소드

GetCandidates() 보호된 메소드

protected GetCandidates ( int qseq, int maxcand ) : IResult
qseq int
maxcand int
리턴 IResult
        protected virtual IResult GetCandidates(int[] qseq, int maxcand)
        {
            var len_qseq = qseq.Length;
            var n = this.DB.Count;
            var A = new Dictionary<int,int>(1024);
            for (int i = 0; i < len_qseq; ++i) {
                var rs = this.SEQ.Unravel (qseq [i]);
                var count1 = rs.Count1;
                for (int j = 1; j <= count1; ++j) {
                    var pos = rs.Select1 (j);
                    var docid = pos / this.K;
                    var internal_pos = pos - docid * this.K;
                    if (internal_pos == i) {
                        int value;
                        if (i == 0) {
                            A [docid] = 1;
                        } else if (A.TryGetValue(docid, out value) && value == i) {
                            A [docid] = value + 1;
                        }
                    }
                }
            }
            var res = new ResultTies (Math.Abs (maxcand));
            foreach (var p in A) {
                res.Push (p.Key, -p.Value);
            }
            return res;
        }