Concordia
matched_pattern_fragment.hpp
1 #ifndef MATCHED_PATTERN_FRAGMENT_HDR
2 #define MATCHED_PATTERN_FRAGMENT_HDR
3 
4 #include "concordia/common/config.hpp"
5 #include "concordia/interval.hpp"
6 #include "concordia/substring_occurence.hpp"
7 #include <vector>
8 #include <iostream>
9 #include <boost/foreach.hpp>
10 
22 public:
27  MatchedPatternFragment(const SUFFIX_MARKER_TYPE & patternOffset,
28  const SUFFIX_MARKER_TYPE & matchedLength);
31  virtual ~MatchedPatternFragment();
32 
36  std::vector<SubstringOccurence> getOccurences() const {
37  return _occurences;
38  }
39 
43  void addOccurence(const SubstringOccurence & occurence);
44 
48  SUFFIX_MARKER_TYPE getPatternOffset() const {
49  return _patternOffset;
50  }
51 
55  SUFFIX_MARKER_TYPE getMatchedLength() const {
56  return _matchedLength;
57  }
58 
62  bool operator > (const MatchedPatternFragment & other) const {
63  return (_matchedLength > other.getMatchedLength());
64  }
65 
66  friend std::ostream & operator << (std::ostream & o,
67  const MatchedPatternFragment & fragment) {
68  o << "fragment(patternOffset=" << fragment.getPatternOffset()
69  << ", matchedLength=" << fragment.getMatchedLength() << ") {"
70  << std::endl;
71  BOOST_FOREACH(SubstringOccurence occurence, fragment.getOccurences()) {
72  o << "\t" << occurence << std::endl;
73  }
74 
75  o << "}";
76  return o;
77  }
78 
79 
80 private:
81  std::vector<SubstringOccurence> _occurences;
82 
83  SUFFIX_MARKER_TYPE _patternOffset;
84 
85  SUFFIX_MARKER_TYPE _matchedLength;
86 };
87 
88 #endif
MatchedPatternFragment(const SUFFIX_MARKER_TYPE &patternOffset, const SUFFIX_MARKER_TYPE &matchedLength)
Definition: matched_pattern_fragment.cpp:3
void addOccurence(const SubstringOccurence &occurence)
Definition: matched_pattern_fragment.cpp:15
SUFFIX_MARKER_TYPE getPatternOffset() const
Definition: matched_pattern_fragment.hpp:48
SUFFIX_MARKER_TYPE getMatchedLength() const
Definition: matched_pattern_fragment.hpp:55
Definition: substring_occurence.hpp:16
Definition: interval.hpp:16
std::vector< SubstringOccurence > getOccurences() const
Definition: matched_pattern_fragment.hpp:36
Definition: matched_pattern_fragment.hpp:21
bool operator>(const MatchedPatternFragment &other) const
Definition: matched_pattern_fragment.hpp:62
virtual ~MatchedPatternFragment()
Definition: matched_pattern_fragment.cpp:12