concordia-library/concordia/tm_matches.hpp
rjawor 3a03b01f42 std vectors
Former-commit-id: 5816e87c856f7edc242cc707851a0e2ad05aeb38
2015-04-15 10:55:26 +02:00

77 lines
1.7 KiB
C++

#ifndef TM_MATCHES_HDR
#define TM_MATCHES_HDR
#include <string>
#include <vector>
#include "concordia/common/config.hpp"
#include "concordia/interval.hpp"
#include <boost/ptr_container/ptr_map.hpp>
/*!
Class used within Anubis search algorithm to store partial results.
*/
using namespace std;
class TmMatches {
public:
explicit TmMatches(const SUFFIX_MARKER_TYPE exampleId,
const unsigned char exampleSize,
const unsigned char patternSize);
/*! Destructor.
*/
virtual ~TmMatches();
double getScore() const {
return _score;
}
vector<Interval> getExampleIntervals() const {
return _exampleMatchedRegions;
}
vector<Interval> getPatternIntervals() const {
return _patternMatchedRegions;
}
SUFFIX_MARKER_TYPE getExampleId() const {
return _exampleId;
}
void calculateSimpleScore();
void calculateScore();
void addExampleInterval(int start, int end);
void addPatternInterval(int start, int end);
private:
bool _alreadyIntersects(const vector<Interval> & intervalList,
int start, int end);
double _getLogarithmicOverlay(const vector<Interval> & intervalList,
unsigned char sentenceSize,
double k);
SUFFIX_MARKER_TYPE _exampleId;
vector<Interval> _exampleMatchedRegions;
vector<Interval> _patternMatchedRegions;
unsigned char _patternSize;
unsigned char _exampleSize;
double _score;
};
typedef boost::ptr_map<SUFFIX_MARKER_TYPE, TmMatches> TmMatchesMap;
typedef TmMatchesMap::iterator TmMatchesMapIterator;
#endif