[geos-commits] r2475 - in trunk/source: headers/geos/index/bintree index/bintree

svn_geos at osgeo.org svn_geos at osgeo.org
Wed May 6 12:36:15 EDT 2009


Author: strk
Date: 2009-05-06 12:36:14 -0400 (Wed, 06 May 2009)
New Revision: 2475

Modified:
   trunk/source/headers/geos/index/bintree/Interval.h
   trunk/source/index/bintree/Interval.cpp
Log:
Const-correctness for bintree Interval


Modified: trunk/source/headers/geos/index/bintree/Interval.h
===================================================================
--- trunk/source/headers/geos/index/bintree/Interval.h	2009-05-06 15:47:06 UTC (rev 2474)
+++ trunk/source/headers/geos/index/bintree/Interval.h	2009-05-06 16:36:14 UTC (rev 2475)
@@ -33,27 +33,28 @@
 
 	Interval(double nmin, double nmax);
 
-	Interval(Interval *interval);
+	/// TODO: drop this, rely on copy ctor
+	Interval(const Interval *interval);
 
 	void init(double nmin, double nmax);
 
-	double getMin();
+	double getMin() const;
 
-	double getMax();
+	double getMax() const;
 
-	double getWidth();
+	double getWidth() const;
 
 	void expandToInclude(Interval *interval);
 
-	bool overlaps(Interval *interval);
+	bool overlaps(const Interval *interval) const;
 
-	bool overlaps(double nmin, double nmax);
+	bool overlaps(double nmin, double nmax) const;
 
-	bool contains(Interval *interval);
+	bool contains(const Interval *interval) const;
 
-	bool contains(double nmin, double nmax);
+	bool contains(double nmin, double nmax) const;
 
-	bool contains(double p);
+	bool contains(double p) const;
 };
 
 } // namespace geos::index::bintree

Modified: trunk/source/index/bintree/Interval.cpp
===================================================================
--- trunk/source/index/bintree/Interval.cpp	2009-05-06 15:47:06 UTC (rev 2474)
+++ trunk/source/index/bintree/Interval.cpp	2009-05-06 16:36:14 UTC (rev 2475)
@@ -35,7 +35,7 @@
 {
 }
 
-Interval::Interval(Interval* interval)
+Interval::Interval(const Interval* interval)
 {
 	init(interval->min, interval->max);
 }
@@ -52,19 +52,19 @@
 }
  
 double
-Interval::getMin()
+Interval::getMin() const
 {
 	return min;
 }
 
 double
-Interval::getMax()
+Interval::getMax() const
 {
 	return max;
 }
 
 double
-Interval::getWidth()
+Interval::getWidth() const
 {
 	return max-min;
 }
@@ -77,32 +77,32 @@
 }
  
 bool
-Interval::overlaps(Interval *interval)
+Interval::overlaps(const Interval *interval) const
 {
 	return overlaps(interval->min,interval->max);
 }
  
 bool
-Interval::overlaps(double nmin, double nmax)
+Interval::overlaps(double nmin, double nmax) const
 {
 	if (min>nmax || max<nmin) return false;
 	return true;
 }
  
 bool
-Interval::contains(Interval *interval)
+Interval::contains(const Interval *interval) const
 {
 	return contains(interval->min,interval->max);
 }
 
 bool
-Interval::contains(double nmin, double nmax)
+Interval::contains(double nmin, double nmax) const
 {
 	return (nmin>=min && nmax<=max);
 }
 
 bool
-Interval::contains(double p)
+Interval::contains(double p) const
 {
 	return (p>=min && p<=max);
 }



More information about the geos-commits mailing list