File size: 661 Bytes
fd49381 |
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 |
#pragma once
namespace Moses
{
/**
* Helper class for storing alignment constraints.
*/
class AlignmentConstraint
{
public:
AlignmentConstraint() : m_min(std::numeric_limits<int>::max()), m_max(-1) {}
AlignmentConstraint(int min, int max) : m_min(min), m_max(max) {}
/**
* We are aligned to point => our min cannot be larger, our max cannot be smaller.
*/
void Update(int point) {
if (m_min > point) m_min = point;
if (m_max < point) m_max = point;
}
bool IsSet() const {
return m_max != -1;
}
int GetMin() const {
return m_min;
}
int GetMax() const {
return m_max;
}
private:
int m_min, m_max;
};
}
|