00001 /*========================================================================== 00002 * Copyright (c) 2004 University of Massachusetts. All Rights Reserved. 00003 * 00004 * Use of the Lemur Toolkit for Language Modeling and Information Retrieval 00005 * is subject to the terms of the software license set forth in the LICENSE 00006 * file included with this software, and also available at 00007 * http://www.lemurproject.org/license.html 00008 * 00009 *========================================================================== 00010 */ 00011 00012 00013 // 00014 // Extent 00015 // 00016 // 11 February 2004 -- tds 00017 // 00018 00019 #ifndef INDRI_EXTENT_HPP 00020 #define INDRI_EXTENT_HPP 00021 00022 struct Extent { 00023 int begin; 00024 int end; 00025 00026 Extent() {} 00027 Extent( int b, int e ) : begin(b), end(e) {} 00028 00029 bool contains( const Extent& other ) const { 00030 return begin <= other.begin && end >= other.end; 00031 } 00032 00033 bool before( const Extent& other ) const { 00034 return end <= other.begin; 00035 } 00036 00037 bool beginsBefore( const Extent& other ) const { 00038 return begin <= other.begin; 00039 } 00040 00041 struct begins_before_less { 00042 bool operator() ( const Extent& one, const Extent& two ) const { 00043 return one.beginsBefore( two ); 00044 } 00045 }; 00046 }; 00047 00048 #endif // INDRI_EXTENT_HPP