本文整理匯總了C++中Interval::getEnd方法的典型用法代碼示例。如果您正苦於以下問題:C++ Interval::getEnd方法的具體用法?C++ Interval::getEnd怎麽用?C++ Interval::getEnd使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Interval
的用法示例。
在下文中一共展示了Interval::getEnd方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: testIntersect
void testIntersect()
{
SequenceInterval int1("foo", 1, 100);
SequenceInterval int2("foo", 80, 1000);
SequenceInterval int3(int1);
SequenceInterval int4(int2);
SequenceInterval int5(int1);
SequenceInterval int6("foo", 101, 1000);
SequenceInterval int7("foo", 200, 1000);
CPPUNIT_ASSERT(int1.intersects(int2));
Interval int12 = int1.intersect(int2);
CPPUNIT_ASSERT_EQUAL(80, int12.getStart());
CPPUNIT_ASSERT_EQUAL(100, int12.getEnd());
int3 += int4;
CPPUNIT_ASSERT_EQUAL(1, int3.getStart());
CPPUNIT_ASSERT_EQUAL(1000, int3.getEnd());
Interval tint = int3 + int4;
CPPUNIT_ASSERT_EQUAL(1, tint.getStart());
CPPUNIT_ASSERT_EQUAL(1000, tint.getEnd());
int5 += int6;
CPPUNIT_ASSERT_EQUAL(1, int5.getStart());
CPPUNIT_ASSERT_EQUAL(1000, int5.getEnd());
CPPUNIT_ASSERT(int1.intersects(int7, 100));
}
示例2: intersects
bool Interval::intersects(Interval & interval) {
return !(_end - 1 < interval.getStart() ||
interval.getEnd() - 1 < _start);
}