|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r64291 - in sandbox/itl: boost/itl boost/itl/detail boost/itl/type_traits boost/itl_xt boost/itl_xt/detail boost/validate/gentor libs/itl/example/boost_party_ libs/itl/example/interval_ libs/itl/example/interval_container_ libs/itl/example/man_power_ libs/itl_xt/example/history_ libs/validate/example/labat_single_
From: afojgo_at_[hidden]
Date: 2010-07-23 07:00:20
Author: jofaber
Date: 2010-07-23 07:00:17 EDT (Fri, 23 Jul 2010)
New Revision: 64291
URL: http://svn.boost.org/trac/boost/changeset/64291
Log:
Changes and refactorings for the implementation of intervals with static and dynamic interval borders.
Text files modified:
sandbox/itl/boost/itl/detail/design_config.hpp | 29 +++++--
sandbox/itl/boost/itl/detail/element_iterator.hpp | 12 +-
sandbox/itl/boost/itl/detail/interval_morphism.hpp | 2
sandbox/itl/boost/itl/discrete_interval.hpp | 18 +++-
sandbox/itl/boost/itl/interval.hpp | 10 +-
sandbox/itl/boost/itl/interval_bounds.hpp | 11 ++
sandbox/itl/boost/itl/interval_functions.hpp | 142 +++++++++++++++++++++++++++++++++++----
sandbox/itl/boost/itl/interval_set.hpp | 2
sandbox/itl/boost/itl/rightopen_interval.hpp | 16 ++++
sandbox/itl/boost/itl/type_traits/interval_type_of.hpp | 7 +
sandbox/itl/boost/itl/type_traits/is_asymmetric_interval.hpp | 28 +++++++
sandbox/itl/boost/itl/type_traits/is_interval.hpp | 26 +++++++
sandbox/itl/boost/itl_xt/detail/bit_element_iterator.hpp | 10 +-
sandbox/itl/boost/itl_xt/interval_bitset.hpp | 2
sandbox/itl/boost/itl_xt/typed_episode.hpp | 6 +
sandbox/itl/boost/validate/gentor/randomgentor.hpp | 14 +++
sandbox/itl/libs/itl/example/boost_party_/boost_party.cpp | 26 ++++---
sandbox/itl/libs/itl/example/interval_/interval.cpp | 58 +++++++++-------
sandbox/itl/libs/itl/example/interval_container_/interval_container.cpp | 16 +++-
sandbox/itl/libs/itl/example/man_power_/man_power.cpp | 27 ++++---
sandbox/itl/libs/itl_xt/example/history_/history.cpp | 16 +++-
sandbox/itl/libs/validate/example/labat_single_/labat_single.cpp | 17 ++++
22 files changed, 382 insertions(+), 113 deletions(-)
Modified: sandbox/itl/boost/itl/detail/design_config.hpp
==============================================================================
--- sandbox/itl/boost/itl/detail/design_config.hpp (original)
+++ sandbox/itl/boost/itl/detail/design_config.hpp 2010-07-23 07:00:17 EDT (Fri, 23 Jul 2010)
@@ -1,6 +1,6 @@
/*-----------------------------------------------------------------------------+
Author: Joachim Faulhaber
-Copyright (c) 2009-2009: Joachim Faulhaber
+Copyright (c) 2009-2010: Joachim Faulhaber
+------------------------------------------------------------------------------+
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENCE.txt or copy at
@@ -15,7 +15,18 @@
#ifndef BOOST_ITL_DESIGN_CONFIG_HPP_JOFA_090214
#define BOOST_ITL_DESIGN_CONFIG_HPP_JOFA_090214
-//#define ITL_NEW_INTERVAL_IMPL
+// For an interim period, it will be possible to swith between the old and new
+// implementation for intervals.
+#define ITL_NEW_INTERVAL_IMPL //JODO remove for the final release.
+
+// If this macro is defined, rightopen_interval with static interval borders
+// will be used as default for all interval containers.
+// ITL_USE_STATIC_INTERVAL_BORDER_DEFAULTS should be defined in the application
+// before other includes from the ITL
+//#define ITL_USE_STATIC_INTERVAL_BORDER_DEFAULTS
+// If ITL_USE_STATIC_INTERVAL_BORDER_DEFAULTS is NOT defined, ITL uses intervals
+// with dynamic borders as default.
+
//------------------------------------------------------------------------------
// Auxiliary macros for denoting template signatures.
@@ -99,10 +110,10 @@
//------------------------------------------------------------------------------
-//#define ITL_INTERVAL_DEFAULT itl::rightopen_interval
-//#define ITL_INTERVAL_DEFAULT itl::continuous_interval
+//CL #define ITL_INTERVAL_DEFAULT itl::rightopen_interval
+//CL #define ITL_INTERVAL_DEFAULT itl::continuous_interval
-#ifdef NEW_INTERVAL_IMPL
+#ifdef ITL_NEW_INTERVAL_IMPL
# define ITL_INTERVAL_DEFAULT itl::interval_type_of
#else
# define ITL_INTERVAL_DEFAULT boost::itl::interval
@@ -110,9 +121,11 @@
//------------------------------------------------------------------------------
//JODO find proper solution here
-#ifdef NEW_INTERVAL_IMPL
-# define ITL_discrt_INTERVAL_DEF itl::discrete_interval
-# define ITL_contin_INTERVAL_DEF itl::continuous_interval
+#ifdef ITL_NEW_INTERVAL_IMPL
+//# define ITL_discrt_INTERVAL_DEF itl::discrete_interval
+//# define ITL_contin_INTERVAL_DEF itl::continuous_interval
+# define ITL_discrt_INTERVAL_DEF itl::rightopen_interval
+# define ITL_contin_INTERVAL_DEF itl::rightopen_interval
#else
# define ITL_discrt_INTERVAL_DEF itl::interval
# define ITL_contin_INTERVAL_DEF itl::interval
Modified: sandbox/itl/boost/itl/detail/element_iterator.hpp
==============================================================================
--- sandbox/itl/boost/itl/detail/element_iterator.hpp (original)
+++ sandbox/itl/boost/itl/detail/element_iterator.hpp 2010-07-23 07:00:17 EDT (Fri, 23 Jul 2010)
@@ -199,13 +199,13 @@
static domain_type first (const SegmentIteratorT& leaper){ return leaper->first(); }
static domain_type last (const SegmentIteratorT& leaper){ return leaper->last(); }
- static domain_difference_type length(const SegmentIteratorT& leaper){ return leaper->length();}
+ static domain_difference_type length(const SegmentIteratorT& leaper){ return itl::length(*leaper);}
static transit_type transient_element(domain_type& inter_pos, const SegmentIteratorT& leaper,
const domain_difference_type& sneaker)
{
- inter_pos = is_reverse<SegmentIteratorT>::value ? leaper->last() - sneaker
- : leaper->first() + sneaker;
+ inter_pos = is_reverse<SegmentIteratorT>::value ? itl::last(*leaper) - sneaker
+ : itl::first(*leaper) + sneaker;
return inter_pos;
}
};
@@ -223,13 +223,13 @@
static domain_type first (const SegmentIteratorT& leaper){ return leaper->first.first(); }
static domain_type last (const SegmentIteratorT& leaper){ return leaper->first.last(); }
- static domain_difference_type length(const SegmentIteratorT& leaper){ return leaper->first.length();}
+ static domain_difference_type length(const SegmentIteratorT& leaper){ return itl::length(leaper->first);}
static transit_type transient_element(domain_type& inter_pos, const SegmentIteratorT& leaper,
const domain_difference_type& sneaker)
{
- inter_pos = is_reverse<SegmentIteratorT>::value ? leaper->first.last() - sneaker
- : leaper->first.first() + sneaker;
+ inter_pos = is_reverse<SegmentIteratorT>::value ? itl::last(leaper->first) - sneaker
+ : itl::first(leaper->first) + sneaker;
return transit_type(inter_pos, leaper->second);
}
};
Modified: sandbox/itl/boost/itl/detail/interval_morphism.hpp
==============================================================================
--- sandbox/itl/boost/itl/detail/interval_morphism.hpp (original)
+++ sandbox/itl/boost/itl/detail/interval_morphism.hpp 2010-07-23 07:00:17 EDT (Fri, 23 Jul 2010)
@@ -21,7 +21,7 @@
const typename IntervalContainerT::key_type& itv = IntervalContainerT::key_value(itv_);
typename IntervalContainerT::codomain_type coval = IntervalContainerT::codomain_value(itv_);
- for(typename IntervalContainerT::domain_type element = itv.first(); element <= itv.last(); ++element)
+ for(typename IntervalContainerT::domain_type element = first(itv); element <= last(itv); ++element)
{
result.insert(ElementContainerT::make_element(element, coval));
}
Modified: sandbox/itl/boost/itl/discrete_interval.hpp
==============================================================================
--- sandbox/itl/boost/itl/discrete_interval.hpp (original)
+++ sandbox/itl/boost/itl/discrete_interval.hpp 2010-07-23 07:00:17 EDT (Fri, 23 Jul 2010)
@@ -9,6 +9,7 @@
#define BOOST_ITL_DISCRETE_INTERVAL_HPP_JOFA_100403
#include <boost/static_assert.hpp>
+#include <boost/itl/type_traits/succ_pred.hpp>
#include <boost/itl/type_traits/value_size.hpp>
#include <boost/itl/type_traits/type_to_string.hpp>
#include <boost/itl/type_traits/is_continuous.hpp>
@@ -51,7 +52,7 @@
{
BOOST_CONCEPT_ASSERT((DefaultConstructibleConcept<DomainT>));
BOOST_CONCEPT_ASSERT((LessThanComparableConcept<DomainT>));
- BOOST_STATIC_ASSERT((itl::is_continuous<DomainT>::value)); //JODO
+ //JODO BOOST_STATIC_ASSERT((itl::is_continuous<DomainT>::value)); //JODO
}
/** Interval from <tt>low</tt> to <tt>up</tt> with bounds <tt>bounds</tt> */
@@ -62,21 +63,28 @@
{
BOOST_CONCEPT_ASSERT((DefaultConstructibleConcept<DomainT>));
BOOST_CONCEPT_ASSERT((LessThanComparableConcept<DomainT>));
- JODO BOOST_STATIC_ASSERT((!itl::is_continuous<DomainT>::value));
+ //JODO BOOST_STATIC_ASSERT((!itl::is_continuous<DomainT>::value));
}
domain_type lower()const { return _lwb; }
domain_type upper()const { return _upb; }
interval_bounds bounds()const{ return _bounds; }
- domain_type first()const{ return _lwb; }
+ domain_type first()const
+ {
+ return _bounds.left().bits()==2 ? _lwb : succ(_lwb);
+ }
DomainT last()const
{
- BOOST_STATIC_ASSERT((!itl::is_continuous<DomainT>::value));
- return pred(_upb);
+ return _bounds.right().bits()==1 ? _upb : pred(_upb);
}
+ static discrete_interval open (const DomainT& lo, const DomainT& up){ return discrete_interval(lo, up, interval_bounds::open()); }
+ static discrete_interval rightopen(const DomainT& lo, const DomainT& up){ return discrete_interval(lo, up, interval_bounds::right_open());}
+ static discrete_interval leftopen (const DomainT& lo, const DomainT& up){ return discrete_interval(lo, up, interval_bounds::left_open()); }
+ static discrete_interval closed (const DomainT& lo, const DomainT& up){ return discrete_interval(lo, up, interval_bounds::closed()); }
+
private:
domain_type _lwb;
domain_type _upb;
Modified: sandbox/itl/boost/itl/interval.hpp
==============================================================================
--- sandbox/itl/boost/itl/interval.hpp (original)
+++ sandbox/itl/boost/itl/interval.hpp 2010-07-23 07:00:17 EDT (Fri, 23 Jul 2010)
@@ -548,20 +548,20 @@
static typename IntervalT::size_type
cardinality(const IntervalT& x)
{
- return x.empty()? itl::neutron<typename IntervalT::size_type>::value()
- : static_cast<typename IntervalT::size_type>(succ(x.last() - x.first()));
+ return itl::is_empty(x)? itl::neutron<typename IntervalT::size_type>::value()
+ : static_cast<typename IntervalT::size_type>(succ(last(x) - first(x)));
}
static typename IntervalT::difference_type length(const IntervalT& x)
{
- return x.empty() ? itl::neutron<typename IntervalT::difference_type>::value()
- : static_cast<typename IntervalT::difference_type>(succ(x.last() - x.first()));
+ return itl::is_empty(x) ? itl::neutron<typename IntervalT::difference_type>::value()
+ : static_cast<typename IntervalT::difference_type>(succ(last(x) - first(x)));
}
static typename IntervalT::difference_type
distance(const IntervalT& x1, const IntervalT& x2)
{
- if(x1.empty() || x2.empty())
+ if(itl::is_empty(x1) || itl::is_empty(x2))
return itl::neutron<typename IntervalT::difference_type>::value();
else if(IntervalT::domain_less(x1.last(), x2.first()))
return static_cast<typename IntervalT::difference_type>(pred(x2.first() - x1.last()));
Modified: sandbox/itl/boost/itl/interval_bounds.hpp
==============================================================================
--- sandbox/itl/boost/itl/interval_bounds.hpp (original)
+++ sandbox/itl/boost/itl/interval_bounds.hpp 2010-07-23 07:00:17 EDT (Fri, 23 Jul 2010)
@@ -9,6 +9,7 @@
#define BOOST_ITL_INTERVAL_BOUNDS_HPP_JOFA_100330
#include <boost/utility/enable_if.hpp>
+#include <boost/itl/detail/design_config.hpp>
#include <boost/itl/type_traits/has_dynamic_bounds.hpp>
namespace boost{namespace itl
@@ -114,11 +115,17 @@
inline bool is_complementary(interval_bounds x1)
{ return x1 == interval_bounds::right_open() || x1 == interval_bounds::left_open(); }
+inline bool is_left_closed(interval_bounds bounds)
+{ return bounds.left().bits()==2; }
+
+inline bool is_right_closed(interval_bounds bounds)
+{ return bounds.right().bits()==1; }
+
inline std::string left_bracket(interval_bounds bounds)
-{ return bounds.left().bits()==2 ? "[" : "("; }
+{ return is_left_closed(bounds) ? "[" : "("; }
inline std::string right_bracket(interval_bounds bounds)
-{ return bounds.right().bits()==1 ? "]" : ")"; }
+{ return is_right_closed(bounds) ? "]" : ")"; }
template<class CharType, class CharTraits>
std::basic_ostream<CharType, CharTraits>& operator <<
Modified: sandbox/itl/boost/itl/interval_functions.hpp
==============================================================================
--- sandbox/itl/boost/itl/interval_functions.hpp (original)
+++ sandbox/itl/boost/itl/interval_functions.hpp 2010-07-23 07:00:17 EDT (Fri, 23 Jul 2010)
@@ -9,7 +9,9 @@
#define BOOST_ITL_INTERVAL_FUNCTIONS_HPP_JOFA_100323
#include <boost/utility/enable_if.hpp>
+#include <boost/mpl/and.hpp>
#include <boost/itl/detail/design_config.hpp>
+#include <boost/itl/type_traits/is_discrete.hpp>
#include <boost/itl/type_traits/is_asymmetric_interval.hpp>
#include <boost/itl/type_traits/is_universal_interval.hpp>
#include <boost/itl/type_traits/is_discrete_interval.hpp>
@@ -90,11 +92,12 @@
//- construct(3) ---------------------------------------------------------------
+
template<class IntervalT>
typename boost::enable_if<is_asymmetric_interval<IntervalT>, IntervalT>::type
construct(const typename IntervalT::domain_type& low, //JODO Parameter passing DomainP
const typename IntervalT::domain_type& up,
- itl::bound_type bounds)
+ interval_bounds bounds = interval_bounds::right_open())
{
return IntervalT(low, up);
}
@@ -103,7 +106,7 @@
typename boost::enable_if<is_universal_interval<IntervalT>, IntervalT>::type
construct(const typename IntervalT::domain_type& low,
const typename IntervalT::domain_type& up,
- interval_bounds bounds)
+ interval_bounds bounds = interval_bounds::right_open())
{
return construct_interval<IntervalT>::apply(low, up, bounds);
}
@@ -112,7 +115,7 @@
typename boost::enable_if<is_discrete_interval<IntervalT>, IntervalT>::type
construct(const typename IntervalT::domain_type& low,
const typename IntervalT::domain_type& up,
- interval_bounds bounds)
+ interval_bounds bounds = interval_bounds::right_open() )
{
return construct_interval<IntervalT>::apply(low, up, bounds);
}
@@ -121,7 +124,7 @@
typename boost::enable_if<is_continuous_interval<IntervalT>, IntervalT>::type
construct(const typename IntervalT::domain_type& low,
const typename IntervalT::domain_type& up,
- interval_bounds bounds)
+ interval_bounds bounds = interval_bounds::right_open())
{
return construct_interval<IntervalT>::apply(low, up, bounds);
}
@@ -148,6 +151,48 @@
//= Selection
//==============================================================================
+//- first ----------------------------------------------------------------------
+template<class IntervalT>
+inline typename
+ boost::enable_if<is_static_rightopen<IntervalT>,
+ typename IntervalT::domain_type>::type
+first(const IntervalT& object)
+{
+ return object.lower();
+}
+
+template<class IntervalT>
+inline typename
+ boost::enable_if<is_discrete_interval<IntervalT>,
+ typename IntervalT::domain_type>::type
+first(const IntervalT& object)
+{
+ return is_left_closed(object.bounds()) ?
+ object.lower() : succ(object.lower());
+}
+
+//- last -----------------------------------------------------------------------
+template<class IntervalT>
+inline typename
+boost::enable_if<mpl::and_<is_static_rightopen<IntervalT>,
+ is_discrete<typename IntervalT::domain_type> >,
+ typename IntervalT::domain_type>::type
+last(const IntervalT& object)
+{
+ return pred(object.upper());
+}
+
+template<class IntervalT>
+inline typename
+ boost::enable_if<is_discrete_interval<IntervalT>,
+ typename IntervalT::domain_type>::type
+last(const IntervalT& object)
+{
+ return is_right_closed(object.bounds()) ? object.upper() : pred(object.upper());
+}
+
+
+//------------------------------------------------------------------------------
template<class IntervalT>
typename boost::enable_if<has_dynamic_bounds<IntervalT>,
typename IntervalT::bounded_domain_type>::type
@@ -208,7 +253,7 @@
typename boost::enable_if<is_discrete_interval<IntervalT>, bool>::type
is_empty(const IntervalT& object)
{
- return IntervalT::domain_less(object.last(), object.first());
+ return IntervalT::domain_less(last(object), first(object));
}
template<class IntervalT>
@@ -269,7 +314,7 @@
typename boost::enable_if<is_discrete_interval<IntervalT>, bool>::type
exclusive_less(const IntervalT& left, const IntervalT& right)
{
- return IntervalT::domain_less(left.last(), right.first());
+ return IntervalT::domain_less(last(left), first(right));
}
template<class IntervalT>
@@ -300,7 +345,7 @@
typename boost::enable_if<is_discrete_interval<IntervalT>, bool>::type
lower_less(const IntervalT& left, const IntervalT& right)
{
- return IntervalT::domain_less(left.first(), right.first());
+ return IntervalT::domain_less(first(left), first(right));
}
template<class IntervalT>
@@ -333,7 +378,7 @@
typename boost::enable_if<is_discrete_interval<IntervalT>, bool>::type
upper_less(const IntervalT& left, const IntervalT& right)
{
- return IntervalT::domain_less(left.last(), right.last());
+ return IntervalT::domain_less(last(left), last(right));
}
template<class IntervalT>
@@ -402,7 +447,7 @@
typename boost::enable_if<is_discrete_interval<IntervalT>, bool>::type
lower_equal(const IntervalT& left, const IntervalT& right)
{
- return IntervalT::domain_equal(left.first(), right.first());
+ return IntervalT::domain_equal(first(left), first(right));
}
template<class IntervalT>
@@ -433,7 +478,7 @@
typename boost::enable_if<is_discrete_interval<IntervalT>, bool>::type
upper_equal(const IntervalT& left, const IntervalT& right)
{
- return IntervalT::domain_equal(left.last(), right.last());
+ return IntervalT::domain_equal(last(left), last(right));
}
template<class IntervalT>
@@ -502,7 +547,7 @@
typename boost::enable_if<is_discrete_interval<IntervalT>, bool>::type
touches(const IntervalT& left, const IntervalT& right)
{
- return IntervalT::domain_equal(succ(left.last()), right.first());
+ return IntervalT::domain_equal(succ(last(left)), first(right));
}
template<class IntervalT>
@@ -518,10 +563,11 @@
//= Size
//==============================================================================
//- cardinality ----------------------------------------------------------------
+
template<class IntervalT>
typename boost::enable_if<is_continuous_interval<IntervalT>,
typename IntervalT::size_type>::type
-cardinality(IntervalT object)
+cardinality(const IntervalT& object)
{
typedef typename IntervalT::size_type SizeT;
if(itl::is_empty(object))
@@ -533,15 +579,81 @@
return infinity<SizeT>::value();
}
-//- size -----------------------------------------------------------------------
template<class IntervalT>
-typename boost::enable_if<is_continuous_interval<IntervalT>,
+typename boost::enable_if<is_discrete_interval<IntervalT>,
+ typename IntervalT::size_type>::type
+cardinality(const IntervalT& object)
+{
+ return (last(object) + itl::unon<IntervalT::size_type>::value()) - first(object);
+}
+
+
+template<class IntervalT>
+typename boost::enable_if<is_continuous_asymmetric<IntervalT>,
+ typename IntervalT::size_type>::type
+cardinality(const IntervalT& object)
+{
+ typedef typename IntervalT::size_type SizeT;
+ if(itl::is_empty(object))
+ return itl::neutron<SizeT>::value();
+ else
+ return infinity<SizeT>::value();
+}
+
+template<class IntervalT>
+typename boost::enable_if<is_discrete_asymmetric<IntervalT>,
typename IntervalT::size_type>::type
-size(IntervalT object)
+cardinality(const IntervalT& object)
+{
+ return (last(object) + itl::unon<IntervalT::size_type>::value()) - first(object);
+}
+
+
+
+
+
+//- size -----------------------------------------------------------------------
+template<class IntervalT>
+inline typename IntervalT::size_type size(const IntervalT& object)
{
return cardinality(object);
}
+//- length ---------------------------------------------------------------------
+template<class IntervalT>
+typename boost::enable_if<is_continuous_interval<IntervalT>,
+ typename IntervalT::difference_type>::type
+length(const IntervalT& object)
+{
+ return object.upper() - object.lower();
+}
+
+template<class IntervalT>
+inline typename boost::enable_if<is_discrete_interval<IntervalT>,
+ typename IntervalT::difference_type>::type
+length(const IntervalT& object)
+{
+ return (last(object) + itl::unon<IntervalT::difference_type>::value())
+ - first(object);
+}
+
+template<class IntervalT>
+typename boost::enable_if<is_continuous_asymmetric<IntervalT>,
+ typename IntervalT::difference_type>::type
+length(const IntervalT& object)
+{
+ return object.upper() - object.lower();
+}
+
+template<class IntervalT>
+inline typename boost::enable_if<is_discrete_asymmetric<IntervalT>,
+ typename IntervalT::difference_type>::type
+length(const IntervalT& object)
+{
+ return (last(object) + itl::unon<IntervalT::difference_type>::value())
+ - first(object);
+}
+
//==============================================================================
//= Addition
//==============================================================================
Modified: sandbox/itl/boost/itl/interval_set.hpp
==============================================================================
--- sandbox/itl/boost/itl/interval_set.hpp (original)
+++ sandbox/itl/boost/itl/interval_set.hpp 2010-07-23 07:00:17 EDT (Fri, 23 Jul 2010)
@@ -254,7 +254,7 @@
typename interval_set<DomainT,Compare,Interval,Alloc>::iterator
interval_set<DomainT,Compare,Interval,Alloc>::add_(iterator prior_, const value_type& addend)
{
- if(itl::is_empty(addend))
+ if(boost::itl::is_empty(addend))
return prior_;
iterator insertion = this->_set.insert(prior_, addend);
Modified: sandbox/itl/boost/itl/rightopen_interval.hpp
==============================================================================
--- sandbox/itl/boost/itl/rightopen_interval.hpp (original)
+++ sandbox/itl/boost/itl/rightopen_interval.hpp 2010-07-23 07:00:17 EDT (Fri, 23 Jul 2010)
@@ -10,6 +10,11 @@
#include <boost/itl/type_traits/value_size.hpp>
#include <boost/itl/type_traits/type_to_string.hpp>
+#include <boost/itl/interval_bounds.hpp> //JODO CL rightopen_interval ought to be independent on this,
+ //but interval_function.hpp depends partially. So we might try to minimize
+ //dependencies here. There's also that point on generation.
+ //Two partitions of interval_functions
+ // (dependen on i_b ( independent on i_b ))
#include <boost/itl/detail/base_interval.hpp>
#include <boost/itl/interval_functions.hpp>
@@ -58,6 +63,7 @@
domain_type lower()const{ return _lwb; }
domain_type upper()const{ return _upb; }
+ /*CL
domain_type first()const{ return _lwb; }
DomainT last()const
@@ -65,6 +71,7 @@
BOOST_STATIC_ASSERT((!itl::is_continuous<DomainT>::value));
return pred(_upb);
}
+ */
private:
domain_type _lwb;
@@ -77,7 +84,7 @@
(std::basic_ostream<CharType, CharTraits> &stream,
rightopen_interval<DomainT,Compare> const& object)
{
- if(itl::is_empty(object))
+ if(boost::itl::is_empty(object))
return stream << "[)";
else
return stream << "[" << object.lower() << "," << object.upper()<< ")";
@@ -108,6 +115,13 @@
BOOST_STATIC_CONSTANT(bool, value = true);
};
+template <class DomainT, ITL_COMPARE Compare>
+struct is_static_rightopen<rightopen_interval<DomainT,Compare> >
+{
+ typedef is_static_rightopen<rightopen_interval<DomainT,Compare> > type;
+ BOOST_STATIC_CONSTANT(bool, value = true);
+};
+
template <class DomainT, ITL_COMPARE Compare>
struct type_to_string<itl::rightopen_interval<DomainT,Compare> >
{
Modified: sandbox/itl/boost/itl/type_traits/interval_type_of.hpp
==============================================================================
--- sandbox/itl/boost/itl/type_traits/interval_type_of.hpp (original)
+++ sandbox/itl/boost/itl/type_traits/interval_type_of.hpp 2010-07-23 07:00:17 EDT (Fri, 23 Jul 2010)
@@ -12,6 +12,7 @@
#include <boost/itl/detail/design_config.hpp>
#include <boost/itl/continuous_interval.hpp>
#include <boost/itl/discrete_interval.hpp>
+#include <boost/itl/rightopen_interval.hpp>
#include <boost/itl/type_traits/is_continuous.hpp>
namespace boost{ namespace itl
@@ -19,10 +20,14 @@
template <class DomainT, ITL_COMPARE Compare = ITL_COMPARE_INSTANCE(std::less, DomainT)>
struct interval_type_of
{
- typedef
+#ifdef ITL_USE_STATIC_INTERVAL_BORDER_DEFAULTS
+ typedef rightopen_interval<DomainT,Compare> type;
+#else
+ typedef
typename mpl::if_< is_continuous<DomainT> //JODO add Traits to choose between static and dynamic intervals
, continuous_interval<DomainT,Compare>
, discrete_interval<DomainT,Compare> >::type type;
+#endif
};
}} // namespace boost itl
Modified: sandbox/itl/boost/itl/type_traits/is_asymmetric_interval.hpp
==============================================================================
--- sandbox/itl/boost/itl/type_traits/is_asymmetric_interval.hpp (original)
+++ sandbox/itl/boost/itl/type_traits/is_asymmetric_interval.hpp 2010-07-23 07:00:17 EDT (Fri, 23 Jul 2010)
@@ -20,8 +20,32 @@
value = (type_traits::ice_and
<
is_interval<Type>::value
- , has_static_bounds<Type>::value
- , has_asymmetric_bounds<Type>::value
+ , has_static_bounds<Type>::value
+ , has_asymmetric_bounds<Type>::value
+ >::value)
+ );
+};
+
+template <class Type> struct is_continuous_asymmetric
+{
+ typedef is_continuous_asymmetric<Type> type;
+ BOOST_STATIC_CONSTANT(bool,
+ value = (type_traits::ice_and
+ <
+ is_asymmetric_interval<Type>::value
+ , is_continuous<typename Type::domain_type>::value
+ >::value)
+ );
+};
+
+template <class Type> struct is_discrete_asymmetric
+{
+ typedef is_discrete_asymmetric<Type> type;
+ BOOST_STATIC_CONSTANT(bool,
+ value = (type_traits::ice_and
+ <
+ is_asymmetric_interval<Type>::value
+ , type_traits::ice_not<is_continuous<typename Type::domain_type>::value>::value
>::value)
);
};
Modified: sandbox/itl/boost/itl/type_traits/is_interval.hpp
==============================================================================
--- sandbox/itl/boost/itl/type_traits/is_interval.hpp (original)
+++ sandbox/itl/boost/itl/type_traits/is_interval.hpp 2010-07-23 07:00:17 EDT (Fri, 23 Jul 2010)
@@ -30,6 +30,32 @@
BOOST_STATIC_CONSTANT(bool, value = false);
};
+template <class Type> struct is_static_rightopen
+{
+ typedef is_static_rightopen<Type> type;
+ BOOST_STATIC_CONSTANT(bool, value = false);
+};
+
+template <class Type> struct is_static_leftopen
+{
+ typedef is_static_leftopen<Type> type;
+ BOOST_STATIC_CONSTANT(bool, value = false);
+};
+
+template <class Type> struct is_static_open
+{
+ typedef is_static_leftopen<Type> type;
+ BOOST_STATIC_CONSTANT(bool, value = false);
+};
+
+template <class Type> struct is_static_closed
+{
+ typedef is_static_leftopen<Type> type;
+ BOOST_STATIC_CONSTANT(bool, value = false);
+};
+
+
+
}} // namespace boost itl
#endif
Modified: sandbox/itl/boost/itl_xt/detail/bit_element_iterator.hpp
==============================================================================
--- sandbox/itl/boost/itl_xt/detail/bit_element_iterator.hpp (original)
+++ sandbox/itl/boost/itl_xt/detail/bit_element_iterator.hpp 2010-07-23 07:00:17 EDT (Fri, 23 Jul 2010)
@@ -124,7 +124,7 @@
next_bit();
if(_on_bit == past)
{ // The current bitset passed the end
- if(_reptator < pred(_saltator->first.length()))
+ if(_reptator < pred(itl::length(_saltator->first)))
{
++_reptator;
_on_bit = ante;
@@ -156,7 +156,7 @@
--_saltator;
// NOW: decrement insecure, because _saltator can (finally) be
// begin here. increment and dereference are secure.
- _reptator = _saltator->first.length();
+ _reptator = itl::length(_saltator->first);
--_reptator;
_on_bit = past;
}
@@ -204,7 +204,7 @@
if(_on_bit == beyond)
{
--_saltator;
- _reptator = _saltator->first.length();
+ _reptator = itl::length(_saltator->first);
--_reptator;
_on_bit = Proceed::last_bit(_saltator->second.word());
}
@@ -461,7 +461,7 @@
{ return forward<word_type,digits>::prev_bit(value, cur_pos); }
static difference_type inter_value(difference_type reptator, const interval_type inter_val)
- { return inter_val.first() + reptator; }
+ { return first(inter_val) + reptator; }
static difference_type inter_base(const iterator& iter)
{ return neutron<difference_type>::value(); }
@@ -498,7 +498,7 @@
{ return forward<word_type,digits>::next_bit(value, cur_pos); }
static difference_type inter_value(difference_type reptator, const interval_type inter_val)
- { return inter_val.last() - reptator; }
+ { return last(inter_val) - reptator; }
};
#ifdef BOOST_MSVC
Modified: sandbox/itl/boost/itl_xt/interval_bitset.hpp
==============================================================================
--- sandbox/itl/boost/itl_xt/interval_bitset.hpp (original)
+++ sandbox/itl/boost/itl_xt/interval_bitset.hpp 2010-07-23 07:00:17 EDT (Fri, 23 Jul 2010)
@@ -380,7 +380,7 @@
{
size_type cardinality = 0;
ITL_const_FORALL(typename interval_bitmap_type, it_, _map)
- cardinality += (it_->second.cardinality() * it_->first.cardinality());
+ cardinality += (it_->second.cardinality() * itl::cardinality(it_->first));
return cardinality;
}
Modified: sandbox/itl/boost/itl_xt/typed_episode.hpp
==============================================================================
--- sandbox/itl/boost/itl_xt/typed_episode.hpp (original)
+++ sandbox/itl/boost/itl_xt/typed_episode.hpp 2010-07-23 07:00:17 EDT (Fri, 23 Jul 2010)
@@ -30,7 +30,8 @@
#ifndef BOOST_ITL_TYPED_EPISODE_HPP_HPP_JOFA_011015
#define BOOST_ITL_TYPED_EPISODE_HPP_HPP_JOFA_011015
-#include <boost/itl/interval.hpp>
+//JODO #include <boost/itl/interval.hpp>
+#include <boost/itl/rightopen_interval.hpp>
#include <boost/itl_xt/ordered_type.hpp>
namespace boost{namespace itl
@@ -53,7 +54,8 @@
virtual ~episode_interface(){}
/// das Intervall der Episode
- virtual itl::interval<TimeT> interval()const=0;
+ //virtual itl::interval<TimeT> interval()const=0; //JODO make IntervalT a template param
+ virtual rightopen_interval<TimeT> interval()const=0;
};
/// typed_episode is an episode that can be ordered wrt. it's type
Modified: sandbox/itl/boost/validate/gentor/randomgentor.hpp
==============================================================================
--- sandbox/itl/boost/validate/gentor/randomgentor.hpp (original)
+++ sandbox/itl/boost/validate/gentor/randomgentor.hpp 2010-07-23 07:00:17 EDT (Fri, 23 Jul 2010)
@@ -403,6 +403,20 @@
}
};
+ template <class NumericT, ITL_COMPARE Compare>
+ struct Calibrater<itl::list< rightopen_interval<NumericT,Compare> >, RandomGentor>
+ {
+ static void apply(RandomGentor< itl::list< rightopen_interval<NumericT,Compare> > >& gentor)
+ {
+ gentor.setRangeOfSampleSize(GentorProfileSgl::it()->range_ContainerSize());
+ ItvGentorT<NumericT, rightopen_interval<NumericT,Compare> >* itvGentor
+ = new ItvGentorT<NumericT, rightopen_interval<NumericT,Compare> >;
+ itvGentor->setRange(GentorProfileSgl_numeric_range<NumericT>::get());
+ itvGentor->setMaxIntervalLength(GentorProfileSgl::it()->maxIntervalLength());
+ gentor.setDomainGentor(itvGentor);
+ }
+ };
+
template <class NumericT>
struct Calibrater<itl::list<NumericT>, RandomGentor>
{
Modified: sandbox/itl/libs/itl/example/boost_party_/boost_party.cpp
==============================================================================
--- sandbox/itl/libs/itl/example/boost_party_/boost_party.cpp (original)
+++ sandbox/itl/libs/itl/example/boost_party_/boost_party.cpp 2010-07-23 07:00:17 EDT (Fri, 23 Jul 2010)
@@ -53,6 +53,11 @@
// and a few lines of adapter code.
#include <boost/itl/ptime.hpp>
+// Prior to other includes for interval containers we define ...
+#define ITL_USE_STATIC_INTERVAL_BORDER_DEFAULTS
+// ... so all interval containers will use rightopen_intervals that
+// has static interval borders.
+
#include <boost/itl/interval_map.hpp>
using namespace std;
@@ -81,21 +86,21 @@
party.add( // add and element
make_pair(
- interval<ptime>::rightopen(
+ rightopen_interval<ptime>(
time_from_string("2008-05-20 19:30"),
time_from_string("2008-05-20 23:00")),
mary_harry));
party += // element addition can also be done via operator +=
make_pair(
- interval<ptime>::rightopen(
+ rightopen_interval<ptime>(
time_from_string("2008-05-20 20:10"),
time_from_string("2008-05-21 00:00")),
diana_susan);
party +=
make_pair(
- interval<ptime>::rightopen(
+ rightopen_interval<ptime>(
time_from_string("2008-05-20 22:15"),
time_from_string("2008-05-21 00:30")),
peter);
@@ -105,11 +110,10 @@
cout << "----- History of party guests -------------------------\n";
while(it != party.end())
{
- interval<ptime> when = it->first;
+ rightopen_interval<ptime> when = it->first;
// Who is at the party within the time interval 'when' ?
GuestSetT who = (*it++).second;
- cout << "[" << when.first() << " - " << when.upper() << ")"
- << ": " << who << endl;
+ cout << when << ": " << who << endl;
}
}
@@ -128,11 +132,11 @@
>> Interval Template Library: Sample boost_party.cpp <<
-------------------------------------------------------
----- History of party guests -------------------------
-[2008-May-20 19:30:00 - 2008-May-20 20:10:00): Harry Mary
-[2008-May-20 20:10:00 - 2008-May-20 22:15:00): Diana Harry Mary Susan
-[2008-May-20 22:15:00 - 2008-May-20 23:00:00): Diana Harry Mary Peter Susan
-[2008-May-20 23:00:00 - 2008-May-21 00:00:00): Diana Peter Susan
-[2008-May-21 00:00:00 - 2008-May-21 00:30:00): Peter
+[2008-May-20 19:30:00, 2008-May-20 20:10:00): Harry Mary
+[2008-May-20 20:10:00, 2008-May-20 22:15:00): Diana Harry Mary Susan
+[2008-May-20 22:15:00, 2008-May-20 23:00:00): Diana Harry Mary Peter Susan
+[2008-May-20 23:00:00, 2008-May-21 00:00:00): Diana Peter Susan
+[2008-May-21 00:00:00, 2008-May-21 00:30:00): Peter
-----------------------------------------------------------------------------*/
//]
Modified: sandbox/itl/libs/itl/example/interval_/interval.cpp
==============================================================================
--- sandbox/itl/libs/itl/example/interval_/interval.cpp (original)
+++ sandbox/itl/libs/itl/example/interval_/interval.cpp 2010-07-23 07:00:17 EDT (Fri, 23 Jul 2010)
@@ -22,7 +22,8 @@
#include <iostream>
#include <string>
#include <math.h>
-#include <boost/itl/interval.hpp>
+#include <boost/itl/discrete_interval.hpp>
+#include <boost/itl/continuous_interval.hpp>
#include "../toytime.hpp"
using namespace std;
@@ -33,34 +34,41 @@
cout << ">> Interval Template Library: Sample interval.cpp <<\n";
cout << "----------------------------------------------------\n";
- interval<int> int_interval = interval<int>::closed(3,7);
- interval<double> sqrt_interval = interval<double>::rightopen(1/sqrt(2.0), sqrt(2.0));
- interval<string> city_interval = interval<string>::leftopen("Barcelona", "Boston");
- interval<Time> time_interval = interval<Time>::open(Time(monday,8,30), Time(monday,17,20));
-
- cout << "Interval<int>: " << int_interval << endl;
- cout << "Interval<double>: " << sqrt_interval << " does "
- << string(sqrt_interval.contains(sqrt(2.0))?"":"NOT")
- << " contain sqrt(2)" << endl;
- cout << "Interval<string>: " << city_interval << " does "
- << string(city_interval.contains("Barcelona")?"":"NOT")
- << " contain 'Barcelona'" << endl;
- cout << "Interval<string>: " << city_interval << " does "
- << string(city_interval.contains("Berlin")?"":"NOT")
- << " contain 'Berlin'" << endl;
- cout << "Interval<Time>: " << time_interval << endl;
+ discrete_interval<int> int_interval
+ = construct<discrete_interval<int> >(3, 7, interval_bounds::closed());
+ continuous_interval<double> sqrt_interval
+ = construct<continuous_interval<double> >(1/sqrt(2.0), sqrt(2.0));
+ //interval_bounds::right_open() is default
+ continuous_interval<string> city_interval
+ = construct<continuous_interval<string> >("Barcelona", "Boston", interval_bounds::left_open());
+
+ discrete_interval<Time> time_interval
+ = construct<discrete_interval<Time> >(Time(monday,8,30), Time(monday,17,20),
+ interval_bounds::open());
+
+ cout << " discrete_interval<int>: " << int_interval << endl;
+ cout << "continuous_interval<double>: " << sqrt_interval << " does "
+ << string(contains(sqrt_interval, sqrt(2.0))?"":"NOT")
+ << " contain sqrt(2)" << endl;
+ cout << "continuous_interval<string>: " << city_interval << " does "
+ << string(contains(city_interval,"Barcelona")?"":"NOT")
+ << " contain 'Barcelona'" << endl;
+ cout << "continuous_interval<string>: " << city_interval << " does "
+ << string(contains(city_interval, "Berlin")?"":"NOT")
+ << " contain 'Berlin'" << endl;
+ cout << " discrete_interval<Time>: " << time_interval << endl;
- return 0;
+ return 0;
}
// Program output:
-// >> Interval Template Library: Sample interval.cpp <<
-// ---------------------------------------------------
-// Interval<int>: [3,7]
-// Interval<double>: [0.707107,1.41421) does NOT contain sqrt(2)
-// Interval<string>: (Barcelona,Boston] does NOT contain 'Barcelona'
-// Interval<string>: (Barcelona,Boston] does contain 'Berlin'
-// Interval<Time>: (mon:08:30,mon:17:20)
+//>> Interval Template Library: Sample interval.cpp <<
+//----------------------------------------------------
+// discrete_interval<int>: [3,7]
+//continuous_interval<double>: [0.707107,1.41421) does NOT contain sqrt(2)
+//continuous_interval<string>: (Barcelona,Boston] does NOT contain 'Barcelona'
+//continuous_interval<string>: (Barcelona,Boston] does contain 'Berlin'
+// discrete_interval<Time>: (mon:08:30,mon:17:20)
//]
Modified: sandbox/itl/libs/itl/example/interval_container_/interval_container.cpp
==============================================================================
--- sandbox/itl/libs/itl/example/interval_container_/interval_container.cpp (original)
+++ sandbox/itl/libs/itl/example/interval_container_/interval_container.cpp 2010-07-23 07:00:17 EDT (Fri, 23 Jul 2010)
@@ -17,6 +17,14 @@
//[example_interval_container
#include <iostream>
+// Prior to other includes for interval containers we define ...
+#define ITL_USE_STATIC_INTERVAL_BORDER_DEFAULTS
+// ... so all interval containers will use rightopen_intervals that
+// has static interval borders.
+
+
+#include <boost/itl/interval_bounds.hpp> //JODO static bounded intervals should be independend of interval_bounds
+#include <boost/itl/rightopen_interval.hpp>
#include <boost/itl/interval_set.hpp>
#include <boost/itl/separate_interval_set.hpp>
#include <boost/itl/split_interval_set.hpp>
@@ -28,10 +36,10 @@
void interval_container_basics()
{
- interval<Time> night_and_day = interval<Time>::rightopen(Time(monday, 20,00), Time(tuesday, 20,00));
- interval<Time> day_and_night = interval<Time>::rightopen(Time(tuesday, 7,00), Time(wednesday, 7,00));
- interval<Time> next_morning = interval<Time>::rightopen(Time(wednesday, 7,00), Time(wednesday,10,00));
- interval<Time> next_evening = interval<Time>::rightopen(Time(wednesday,18,00), Time(wednesday,21,00));
+ rightopen_interval<Time> night_and_day = rightopen_interval<Time>(Time(monday, 20,00), Time(tuesday, 20,00));
+ rightopen_interval<Time> day_and_night = rightopen_interval<Time>(Time(tuesday, 7,00), Time(wednesday, 7,00));
+ rightopen_interval<Time> next_morning = rightopen_interval<Time>(Time(wednesday, 7,00), Time(wednesday,10,00));
+ rightopen_interval<Time> next_evening = rightopen_interval<Time>(Time(wednesday,18,00), Time(wednesday,21,00));
// An interval set of type interval_set joins intervals that that overlap or touch each other.
interval_set<Time> joinedTimes;
Modified: sandbox/itl/libs/itl/example/man_power_/man_power.cpp
==============================================================================
--- sandbox/itl/libs/itl/example/man_power_/man_power.cpp (original)
+++ sandbox/itl/libs/itl/example/man_power_/man_power.cpp 2010-07-23 07:00:17 EDT (Fri, 23 Jul 2010)
@@ -29,6 +29,7 @@
// and a few lines of adapter code.
#include <boost/itl/gregorian.hpp>
+#include <boost/itl/discrete_interval.hpp>
#include <boost/itl/interval_map.hpp>
using namespace std;
@@ -38,7 +39,7 @@
// Function weekends returns the interval_set of weekends that are contained in
// the date interval 'scope'
-interval_set<date> weekends(const interval<date>& scope)
+interval_set<date> weekends(const discrete_interval<date>& scope)
{
interval_set<date> weekends;
@@ -49,7 +50,7 @@
week_iterator week_iter(cur_weekend_sat);
for(; week_iter <= scope.last(); ++week_iter)
- weekends += interval<date>::rightopen(*week_iter, *week_iter + days(2));
+ weekends += discrete_interval<date>::rightopen(*week_iter, *week_iter + days(2));
weekends &= scope; // cut off the surplus
@@ -66,7 +67,7 @@
date someday = from_string("2008-08-01");
date thenday = someday + months(3);
- interval<date> scope = interval<date>::rightopen(someday, thenday);
+ discrete_interval<date> scope = discrete_interval<date>::rightopen(someday, thenday);
// ------------------------------------------------------------------------
// (1) In a first step, the regular working times are computed for the
@@ -79,8 +80,8 @@
worktime -= from_string("2008-10-03"); //German reunification ;)
// company holidays (fictitious ;)
- worktime -= interval<date>::closed(from_string("2008-08-18"),
- from_string("2008-08-22"));
+ worktime -= discrete_interval<date>::closed(from_string("2008-08-18"),
+ from_string("2008-08-22"));
//-------------------------------------------------------------------------
// (2) Now we calculate the individual work times for some employees
@@ -98,10 +99,12 @@
claudias_working_hours &= worktime;
// Yet, in addition Claudia has her own absence times like
- interval<date> claudias_seminar (from_string("2008-09-16"),
- from_string("2008-09-24"));
- interval<date> claudias_vacation(from_string("2008-08-01"),
- from_string("2008-08-14"));
+ discrete_interval<date> claudias_seminar (from_string("2008-09-16"),
+ from_string("2008-09-24"),
+ interval_bounds::closed());
+ discrete_interval<date> claudias_vacation(from_string("2008-08-01"),
+ from_string("2008-08-14"),
+ interval_bounds::closed());
interval_set<date> claudias_absence_times(claudias_seminar);
claudias_absence_times += claudias_vacation;
@@ -121,8 +124,10 @@
bodos_working_hours &= worktime;
// Bodos additional absence times
- interval<date> bodos_flu(from_string("2008-09-19"), from_string("2008-09-29"));
- interval<date> bodos_vacation(from_string("2008-08-15"), from_string("2008-09-03"));
+ discrete_interval<date> bodos_flu(from_string("2008-09-19"), from_string("2008-09-29"),
+ interval_bounds::closed());
+ discrete_interval<date> bodos_vacation(from_string("2008-08-15"), from_string("2008-09-03"),
+ interval_bounds::closed());
interval_set<date> bodos_absence_times(bodos_flu);
bodos_absence_times += bodos_vacation;
Modified: sandbox/itl/libs/itl_xt/example/history_/history.cpp
==============================================================================
--- sandbox/itl/libs/itl_xt/example/history_/history.cpp (original)
+++ sandbox/itl/libs/itl_xt/example/history_/history.cpp 2010-07-23 07:00:17 EDT (Fri, 23 Jul 2010)
@@ -10,6 +10,12 @@
+-----------------------------------------------------------------------------*/
#include <stdio.h>
#include <iostream>
+
+// Prior to other includes for interval containers we define ...
+#define ITL_USE_STATIC_INTERVAL_BORDER_DEFAULTS
+// ... so all interval containers will use rightopen_intervals that
+// has static interval borders.
+
#include <boost/itl/type_traits/to_string.hpp>
#include "../toytime.h"
@@ -121,7 +127,7 @@
// The domain type of intervals used by HospitalEpisodes is (toy)Time
typedef Time ItvDomTD;
// Type of the intervals used by HospitalEpisodes
- typedef boost::itl::interval<Time> IntervalTD;
+ typedef rightopen_interval<Time> IntervalTD;
public:
// Construct an episode from interval and value
@@ -158,7 +164,7 @@
{
public:
DiagnosisEpisode(Time begin, Time end, const std::string& val)
- : HospitalEpisodes(boost::itl::interval<Time>::rightopen(begin,end),val){}
+ : HospitalEpisodes(rightopen_interval<Time>(begin,end),val){}
HospitalTypeDomain::DomainET type()const { return HospitalTypeDomain::diagnosis; }
};
@@ -168,7 +174,7 @@
{
public:
WardEpisode(Time begin, Time end, const std::string& val)
- : HospitalEpisodes(boost::itl::interval<Time>::rightopen(begin,end),val){}
+ : HospitalEpisodes(rightopen_interval<Time>(begin,end),val){}
HospitalTypeDomain::DomainET type()const { return HospitalTypeDomain::ward; }
};
@@ -213,10 +219,10 @@
HospitalProductHistory::iterator it = history.begin();
while(it != history.end())
{
- interval<Time> when = (*it).first;
+ rightopen_interval<Time> when = (*it).first;
HospitalEventTD what = (*it).second;
- cout << when.as_string() << ": " << what.as_string() << endl;
+ cout << when << ": " << what.as_string() << endl;
++it;
}
}
Modified: sandbox/itl/libs/validate/example/labat_single_/labat_single.cpp
==============================================================================
--- sandbox/itl/libs/validate/example/labat_single_/labat_single.cpp (original)
+++ sandbox/itl/libs/validate/example/labat_single_/labat_single.cpp 2010-07-23 07:00:17 EDT (Fri, 23 Jul 2010)
@@ -12,6 +12,7 @@
#include <boost/itl/ptime.hpp>
+#include <boost/itl/rightopen_interval.hpp>
#include <boost/itl/set.hpp>
#include <boost/itl/map.hpp>
#include <boost/itl/detail/interval_morphism.hpp>
@@ -70,10 +71,22 @@
// <interval_map<int,int,partial_enricher>, itl::inplace_plus, itl::inplace_minus> TestLawT;
//LawValidater<TestLawT, RandomGentor> test_law;
- typedef InplaceCommutativity<itl::set<double> > TestLawT;
+ //typedef InplaceCommutativity<itl::set<double> > TestLawT;
+ //LawValidater<TestLawT> test_law;
+
+
+
+ typedef FunctionEquality
+ <
+ itl::list<std::pair<rightopen_interval<double,std::less>,int> >, //SourceT,
+ split_interval_map<double,int,partial_absorber>, //TargetT,
+ base_insertion,
+ hint_insertion
+ >
+ TestLawT;
LawValidater<TestLawT> test_law;
-
+
//-----------------------------------------------------------------------------
int test_count = 10000;
ptime start, stop;
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk