+
+ * PointerVec ?
+
* PCursor -> Pointer_cursor / PointerCursor ?
* efficient copy cons for List
* use template handle in handle.hh for strings.
- * Restricted cursor/list: make sublist from a list, and use rcursor
-as if list is as big as the sublist.
-
* move towards gnu or STL?
parsestream.h
assert(max >= min);
return max-min;
}
+
void
Interval::unite(Interval h)
{
+ compare(h, *this );
if (h.min<min)
min = h.min;
if (h.max>max)
max = h.max;
}
+
void
Interval::intersect(Interval h)
{
min = MAX(h.min, min);
max = MIN(h.max, max);
}
+
Interval
intersection(Interval a, Interval const&b)
{
return a;
}
+
int
Interval::compare(const Interval&a,Interval const&b)
{
return x;
}
-
-Interval::operator String() const
+String
+Interval::str() const
{
if (empty())
return "[empty]";
struct Interval {
Real min, max;
+ /****************/
+
+ Real center() { return (min + max) /2;}
void translate(Real t) {
min += t;
max += t;
}
void unite(Interval h) ;
+ /**
+ PRE
+ *this and h are comparable
+ */
void intersect(Interval h);
Real length() const;
return *this;
}
bool elt_q(Real r);
- operator String() const;
+ String str() const;
/// partial ordering
static compare(const Interval&,Interval const&);
+ /**
+ inclusion ordering. Crash if not comparable.
+ */
};
/**
- this represents the closed interval [min,max]
+ this represents the closed interval [min,max].
+ No invariants
*/
Interval intersection(Interval, Interval const&);
instantiate_compare(Interval&, Interval::compare);
+
+inline
+Interval operator +(double a,Interval i )
+{
+ i += a;
+ return i;
+}
+
+inline
+Interval operator +(Interval i,double a ){
+ return a+i;
+}
+
#endif // INTERVAL_HH