File: BingoObject.cs

package info (click to toggle)
indigo 1.4.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 48,936 kB
  • sloc: ansic: 332,816; cpp: 169,470; python: 20,033; java: 13,701; cs: 9,979; asm: 8,475; sql: 6,743; xml: 6,354; javascript: 1,245; sh: 555; php: 506; makefile: 54
file content (127 lines) | stat: -rw-r--r-- 3,715 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
using System;

namespace com.epam.indigo
{
    /// <summary>
    /// Bingo search object
    /// </summary>
    public unsafe class BingoObject : IDisposable
    {
        private int _id;
        private readonly Indigo _indigo;
        private IDisposable _reference;

        internal BingoObject(int id, Indigo indigo)
        {
            this._id = id;
            this._indigo = indigo;
        }

        /// <summary>
        /// Destructor
        /// </summary>
        ~BingoObject()
        {
            Dispose();
        }
        /// <summary>
        /// </summary>
        public void Dispose()
        {
            if (_id >= 0 && _indigo != null)
            {
                _indigo.setSessionID();
                Bingo.checkResult(BingoLib.bingoEndSearch(_id));
                _id = -1;
            }
        }

        /// <summary>
        /// Close method
        /// </summary>
        public void close()
        {
            Dispose();
        }

        internal int id
        {
            get => _id;
            set => _id = value;
        }

        /// <summary>
        /// Method to move to the next record
        /// </summary>
        /// <returns>True if there are any more records</returns>
        public bool next()
        {
            _indigo.setSessionID();
            return (Bingo.checkResult(BingoLib.bingoNext(_id)) == 1) ? true : false;
        }

        /// <summary>
        /// Method to return current record id. Should be called after next() method.
        /// </summary>
        /// <returns>Record id</returns>
        public int getCurrentId()
        {
            _indigo.setSessionID();
            return Bingo.checkResult(BingoLib.bingoGetCurrentId(_id));
        }

        /// <summary>
        /// Method to return current similarity value. Should be called after next() method.
        /// </summary>
        /// <returns>Similarity value</returns>
        public float getCurrentSimilarityValue()
        {
            _indigo.setSessionID();
            return Bingo.checkResult(BingoLib.bingoGetCurrentSimilarityValue(_id));
        }

        /// <summary>
        /// Returns a shared IndigoObject for the matched target
        /// </summary>
        /// <returns>Shared Indigo object for the current search operation</returns>
        public IndigoObject getIndigoObject()
        {
            _indigo.setSessionID();
            IndigoObject res = new IndigoObject(_indigo, Bingo.checkResult(BingoLib.bingoGetObject(_id)));
            _reference = res;
            return res;
        }

        /// <summary>
        /// Method to estimate remaining hits count
        /// </summary>
        /// <returns>Estimated hits count</returns>
        public int estimateRemainingResultsCount()
        {
            _indigo.setSessionID();
            return Bingo.checkResult(BingoLib.bingoEstimateRemainingResultsCount(_id));
        }

        /// <summary>
        /// Method to estimate remaining hits count error
        /// </summary>
        /// <returns>Estimated hits count error</returns>
        public int estimateRemainingResultsCountError()
        {
            _indigo.setSessionID();
            return Bingo.checkResult(BingoLib.bingoEstimateRemainingResultsCountError(_id));
        }

        /// <summary>
        /// Method to estimate remaining search time
        /// </summary>
        /// <returns>Estimated remainin search time</returns>
        public float estimateRemainingTime()
        {
            float esimated_time;
            _indigo.setSessionID();
            Bingo.checkResult(BingoLib.bingoEstimateRemainingTime(_id, &esimated_time));
            return esimated_time;
        }
    }
}