|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r60986 - in sandbox/itl: boost/itl boost/itl/detail boost/itl/type_traits boost/itl_xt boost/validate/driver boost/validate/gentor boost/validate/laws libs/itl/doc libs/itl/example/interval_container_ libs/itl/example/itvset_shell_ libs/itl/example/splititvmap_shell_ libs/itl/example/user_groups_ libs/itl/test/test_casual_ libs/itl_xt/test libs/validate/example/labat_collector_ libs/validate/example/labat_itl_set_ libs/validate/example/labat_set_copy_conformity_ libs/validate/example/labat_single_
From: afojgo_at_[hidden]
Date: 2010-04-01 06:41:25
Author: jofaber
Date: 2010-04-01 06:41:20 EDT (Thu, 01 Apr 2010)
New Revision: 60986
URL: http://svn.boost.org/trac/boost/changeset/60986
Log:
Refactoring itl::interval: Started to decompose itl::interval into an interval concept implemented by a set of global functions and statically and dynamically bounded interval classes. The new code is to yet stable for all new features, but the code is stable for the current interface of the itl and all tests pass.
Added:
sandbox/itl/boost/itl/closed_interval.hpp (contents, props changed)
sandbox/itl/boost/itl/continuous_interval.hpp (contents, props changed)
sandbox/itl/boost/itl/detail/base_interval.hpp (contents, props changed)
sandbox/itl/boost/itl/interval_bounds.hpp (contents, props changed)
sandbox/itl/boost/itl/interval_functions.hpp (contents, props changed)
sandbox/itl/boost/itl/rightopen_interval.hpp (contents, props changed)
sandbox/itl/boost/itl/type_traits/has_dynamic_bounds.hpp (contents, props changed)
sandbox/itl/boost/itl/type_traits/is_asymmetric_interval.hpp (contents, props changed)
sandbox/itl/boost/itl/type_traits/is_continuous_interval.hpp (contents, props changed)
sandbox/itl/boost/itl/type_traits/is_discrete_interval.hpp (contents, props changed)
sandbox/itl/boost/itl/type_traits/is_interval.hpp (contents, props changed)
sandbox/itl/boost/itl/type_traits/is_universal_interval.hpp (contents, props changed)
Text files modified:
sandbox/itl/boost/itl/detail/design_config.hpp | 9 +
sandbox/itl/boost/itl/detail/element_comparer.hpp | 8 +-
sandbox/itl/boost/itl/detail/interval_set_algo.hpp | 4
sandbox/itl/boost/itl/detail/interval_subset_comparer.hpp | 28 +++---
sandbox/itl/boost/itl/interval.hpp | 146 +++++++++++++++++++++++----------------
sandbox/itl/boost/itl/interval_base_map.hpp | 64 ++++++++--------
sandbox/itl/boost/itl/interval_base_set.hpp | 30 ++++---
sandbox/itl/boost/itl/interval_map.hpp | 62 ++++++++--------
sandbox/itl/boost/itl/interval_set.hpp | 46 +++++------
sandbox/itl/boost/itl/predicates.hpp | 13 +-
sandbox/itl/boost/itl/separate_interval_set.hpp | 38 ++++-----
sandbox/itl/boost/itl/split_interval_map.hpp | 54 +++++++-------
sandbox/itl/boost/itl/split_interval_set.hpp | 32 ++++----
sandbox/itl/boost/itl/type_traits/is_continuous.hpp | 12 ++-
sandbox/itl/boost/itl_xt/itvgentor.hpp | 9 +
sandbox/itl/boost/itl_xt/map_segment_gentor.hpp | 18 ++--
sandbox/itl/boost/validate/driver/collector_driver.hpp | 4
sandbox/itl/boost/validate/driver/itl_set_driver.hpp | 40 ++++++----
sandbox/itl/boost/validate/driver/map_copy_conformity_driver.hpp | 16 ++--
sandbox/itl/boost/validate/driver/set_copy_conformity_driver.hpp | 8 +-
sandbox/itl/boost/validate/gentor/randomgentor.hpp | 91 +++++++++++++++---------
sandbox/itl/boost/validate/laws/monoid.hpp | 22 +++---
sandbox/itl/boost/validate/laws/pushouts.hpp | 14 +-
sandbox/itl/boost/validate/laws/set_laws.hpp | 32 ++++----
sandbox/itl/boost/validate/laws/symmetric_difference.hpp | 20 ++--
sandbox/itl/libs/itl/doc/acknowledgments.qbk | 5
sandbox/itl/libs/itl/example/interval_container_/interval_container.cpp | 6
sandbox/itl/libs/itl/example/itvset_shell_/itvset_shell.cpp | 10 +-
sandbox/itl/libs/itl/example/splititvmap_shell_/splititvmap_shell.cpp | 10 +-
sandbox/itl/libs/itl/example/user_groups_/user_groups.cpp | 8 +-
sandbox/itl/libs/itl/test/test_casual_/test_casual.cpp | 13 +++
sandbox/itl/libs/itl_xt/test/itvmaptester.h | 68 +++++++++---------
sandbox/itl/libs/itl_xt/test/itvsettester.h | 87 ++++++++++-------------
sandbox/itl/libs/validate/example/labat_collector_/vc9_labat_collector.vcproj | 4 +
sandbox/itl/libs/validate/example/labat_itl_set_/vc9_labat_itl_set.vcproj | 4 +
sandbox/itl/libs/validate/example/labat_set_copy_conformity_/vc9_labat_set_copy_conformity.vcproj | 4 +
sandbox/itl/libs/validate/example/labat_single_/labat_single.cpp | 2
37 files changed, 553 insertions(+), 488 deletions(-)
Added: sandbox/itl/boost/itl/closed_interval.hpp
==============================================================================
--- (empty file)
+++ sandbox/itl/boost/itl/closed_interval.hpp 2010-04-01 06:41:20 EDT (Thu, 01 Apr 2010)
@@ -0,0 +1,180 @@
+/*-----------------------------------------------------------------------------+
+Copyright (c) 2010-2010: Joachim Faulhaber
++------------------------------------------------------------------------------+
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENCE.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
++-----------------------------------------------------------------------------*/
+#ifndef BOOST_ITL_CLOSED_INTERVAL_HPP_JOFA_100324
+#define BOOST_ITL_CLOSED_INTERVAL_HPP_JOFA_100324
+
+#include <boost/itl/detail/base_interval.hpp>
+
+namespace boost{namespace itl
+{
+
+typedef unsigned char bound_type;
+
+template <class SubType, class DomainT,
+ ITL_COMPARE Compare = ITL_COMPARE_INSTANCE(std::less, DomainT)>
+class asymmetric_interval : public base_interval<DomainT,Compare>
+{
+public:
+ typedef base_interval<DomainT,Compare> base_type;
+ typedef asymmetric_interval<SubType,DomainT,Compare> type;
+ typedef SubType sub_type;
+
+public:
+ //==========================================================================
+ //= Construct, copy, destruct
+ //==========================================================================
+ /** Default constructor; yields an empty interval <tt>[0,0)</tt> or <tt>(0,0]</tt> */
+ asymmetric_interval() : _lwb(unon<DomainT>::value()), _upb(neutron<DomainT>::value())
+ {
+ BOOST_CONCEPT_ASSERT((DefaultConstructibleConcept<DomainT>));
+ BOOST_CONCEPT_ASSERT((LessThanComparableConcept<DomainT>));
+ BOOST_STATIC_ASSERT((!itl::is_continuous<DomainT>::value));
+ }
+
+ //NOTE: Compiler generated copy constructor is used
+
+ /** Constructor for a closed singleton interval <tt>[val,val]</tt> */
+ explicit asymmetric_interval(const DomainT& val) :
+ _lwb(val), _upb(val)
+ {
+ BOOST_CONCEPT_ASSERT((DefaultConstructibleConcept<DomainT>));
+ BOOST_CONCEPT_ASSERT((LessThanComparableConcept<DomainT>));
+ BOOST_STATIC_ASSERT((!itl::is_continuous<DomainT>::value));
+ }
+
+ /** Interval from <tt>low</tt> to <tt>up</tt> with bounds <tt>bounds</tt> */
+ asymmetric_interval(const DomainT& low, const DomainT& up) :
+ _lwb(low), _upb(up)
+ {
+ BOOST_CONCEPT_ASSERT((DefaultConstructibleConcept<DomainT>));
+ BOOST_CONCEPT_ASSERT((LessThanComparableConcept<DomainT>));
+ BOOST_STATIC_ASSERT((!itl::is_continuous<DomainT>::value));
+ }
+
+ domain_type lower()const{ return _lwb; }
+ domain_type upper()const{ return _upb; }
+
+ /** Is the interval empty? */
+ bool empty()const{ return domain_less(_upb, _lwb); }
+
+ /** Maximal element of <tt>*this</tt> is less than the minimal element of <tt>x2</tt> */
+ bool exclusive_less(const asymmetric_interval& x2)const
+ { return domain_less(_upb, x2._lwb); }
+
+ /** There is no gap between <tt>*this</tt> and <tt>x2</tt> but they have no element in common */
+ bool touches(const asymmetric_interval& x2)const
+ { return domain_equal(_upb, succ(x2._lwb)); }
+
+ bool is_disjoint(const asymmetric_interval& x2)const //JODO ex
+ { return exclusive_less(x2) || x2.exclusive_less(*this); }
+
+ sub_type& extend(const sub_type& x2) //JODO ex
+ {
+ if (x2.empty()) return *that();
+ else if(empty()) return *that() = x2;
+ else
+ {
+ if(domain_less(x2._lwb, _lwb))
+ _lwb = x2._lwb;
+ if(domain_less(_upb, x2._upb))
+ _upb = x2._upb;
+ return *that();
+ }
+ }
+
+ /** subtract \c left_minuend from the \c *this interval on it's left side.
+ *this becomes the difference: The part of \c *this right of \c left_minuend.
+ \code
+ right_over = *this - left_minuend; //on the left.
+ ... d] : right
+ ...c] : left_minuend
+ [c+1 d] : right_over = *this
+ \endcode
+ */
+ sub_type& left_subtract(const sub_type& left_minuend)
+ {
+ if(!left_minuend.exclusive_less(*this))
+ _lwb = succ(left_minuend._upb);
+ return *that();
+ }
+
+
+ /** subtract \c right_minuend from the \c *this interval on it's right side.
+ *this becomes the difference: The part of \c *this right of \c right_minuend.
+ \code
+ left_over = *this - right_minuend; //on the right side.
+ [a ... : left
+ [b ... : right_minuend
+ [a b-1] : left_over = *this
+ \endcode
+ */
+ sub_type& right_subtract(const sub_type& right_minuend)
+ {
+ if(!exclusive_less(right_minuend))
+ _upb = pred(right_minuend._lwb);
+ return *that();
+ }
+
+ /*JODO
+ [a c]
+ [b d]
+ [a b-1][b c][c+1 d]
+ */
+ sub_type& operator &= (const sub_type& sectant)
+ {
+ _lwb = (std::max)(_lwb, sectant._lwb);
+ _upb = (std::min)(_upb, sectant._upb);
+ return *that();
+ }
+
+ //CL REV -- For representation
+ bool is_left(bound_type bounded)const
+ { return 0 != (bounded & right_open); }
+
+ bool is_right(bound_type bounded)const
+ { return bounded==open_bounded || bounded==right_open; }
+
+ //CL REV -- For the generator
+ void set(DomainP left, DomainP right, bound_type bounds)
+ { _lwb = left; _upb = right; }
+
+ //JODO
+ std::string as_string()const
+ {
+ std::string itvRep("");
+ std::string lwbRep, ubpRep;
+
+ itvRep += is_left(open_bounded) ? "(" : "[" ;
+ itvRep += itl::to_string<DomainT>::apply(_lwb);
+ itvRep += ",";
+ itvRep += itl::to_string<DomainT>::apply(_upb);
+ itvRep += is_right(open_bounded) ? ")" : "]" ;
+
+ return itvRep;
+ }
+
+ bool lower_equal(const sub_type& x2)const{ return _lwb==x2._lwb; }
+ bool upper_equal(const sub_type& x2)const{ return _upb==x2._upb; }
+ bool lower_less (const sub_type& x2)const{ return domain_less(_lwb, x2._lwb); }
+ bool upper_less (const sub_type& x2)const{ return domain_less(_upb, x2._upb); }
+
+
+protected:
+ sub_type* that() { return static_cast< sub_type*>(this); }
+ const sub_type* that()const { return static_cast<const sub_type*>(this); }
+
+private:
+ domain_type _lwb;
+ domain_type _upb;
+};
+
+
+}} // namespace itl boost
+
+#endif
+
Added: sandbox/itl/boost/itl/continuous_interval.hpp
==============================================================================
--- (empty file)
+++ sandbox/itl/boost/itl/continuous_interval.hpp 2010-04-01 06:41:20 EDT (Thu, 01 Apr 2010)
@@ -0,0 +1,135 @@
+/*-----------------------------------------------------------------------------+
+Copyright (c) 2010-2010: Joachim Faulhaber
++------------------------------------------------------------------------------+
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENCE.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
++-----------------------------------------------------------------------------*/
+#ifndef BOOST_ITL_CONTINUOUS_INTERVAL_HPP_JOFA_100327
+#define BOOST_ITL_CONTINUOUS_INTERVAL_HPP_JOFA_100327
+
+#include <boost/itl/detail/base_interval.hpp>
+#include <boost/itl/interval_bounds.hpp>
+#include <boost/itl/interval_functions.hpp>
+
+namespace boost{namespace itl
+{
+
+typedef unsigned char bound_type; //JODO
+
+template <class DomainT,
+ ITL_COMPARE Compare = ITL_COMPARE_INSTANCE(std::less, DomainT)>
+class continuous_interval : public base_interval<DomainT,Compare>
+{
+public:
+ typedef continuous_interval<DomainT,Compare> type;
+ typedef DomainT domain_type;
+
+public:
+ //==========================================================================
+ //= Construct, copy, destruct
+ //==========================================================================
+ /** Default constructor; yields an empty interval <tt>[0,0)</tt>. */
+ continuous_interval()
+ {
+ BOOST_CONCEPT_ASSERT((DefaultConstructibleConcept<DomainT>));
+ BOOST_CONCEPT_ASSERT((LessThanComparableConcept<DomainT>));
+ BOOST_STATIC_ASSERT((itl::is_continuous<DomainT>::value));
+ }
+
+ //NOTE: Compiler generated copy constructor is used
+
+ /** Constructor for a closed singleton interval <tt>[val,val]</tt> */
+ explicit continuous_interval(const DomainT& val)
+ : _lwb(val), _upb(val), _bounds(itl::closed_bounded)
+ {
+ BOOST_CONCEPT_ASSERT((DefaultConstructibleConcept<DomainT>));
+ BOOST_CONCEPT_ASSERT((LessThanComparableConcept<DomainT>));
+ BOOST_STATIC_ASSERT((itl::is_continuous<DomainT>::value));
+ }
+
+ /** Interval from <tt>low</tt> to <tt>up</tt> with bounds <tt>bounds</tt> */
+ continuous_interval(const DomainT& low, const DomainT& up,
+ itl::bound_type bounds = itl::closed_bounded)
+ : _lwb(low), _upb(up), _bounds(bounds)
+ {
+ BOOST_CONCEPT_ASSERT((DefaultConstructibleConcept<DomainT>));
+ BOOST_CONCEPT_ASSERT((LessThanComparableConcept<DomainT>));
+ }
+
+ domain_type lower()const { return _lwb; }
+ domain_type upper()const { return _upb; }
+ bound_type bounds()const{ return _bounds; }
+
+ domain_type first()const{ return _lwb; }
+
+ DomainT last()const
+ {
+ BOOST_STATIC_ASSERT((!itl::is_continuous<DomainT>::value));
+ return pred(_upb);
+ }
+
+private:
+ domain_type _lwb;
+ domain_type _upb;
+ bound_type _bounds;
+};
+
+
+template<class CharType, class CharTraits, class DomainT, ITL_COMPARE Compare>
+std::basic_ostream<CharType, CharTraits>& operator <<
+ (std::basic_ostream<CharType, CharTraits> &stream,
+ continuous_interval<DomainT,Compare> const& object)
+{
+ if(itl::is_empty(object))
+ return stream << "[)";
+ else
+ return stream << "[" << object.lower() << "," << object.upper()<< ")";
+}
+
+
+//==============================================================================
+//= Type traits
+//==============================================================================
+template <class DomainT, ITL_COMPARE Compare>
+struct is_interval<continuous_interval<DomainT,Compare> >
+{
+ typedef is_interval<continuous_interval<DomainT,Compare> > type;
+ BOOST_STATIC_CONSTANT(bool, value = true);
+};
+
+template <class DomainT, ITL_COMPARE Compare>
+struct has_dynamic_bounds<continuous_interval<DomainT,Compare> >
+{
+ typedef has_dynamic_bounds<continuous_interval<DomainT,Compare> > type;
+ BOOST_STATIC_CONSTANT(bool, value = true);
+};
+
+
+/*CL JODO has_domain needed?
+template <class DomainT, ITL_COMPARE Compare>
+struct has_domain<continuous_interval<DomainT,Compare> >
+{
+ typedef has_domain<continuous_interval<DomainT,Compare> > type;
+ BOOST_STATIC_CONSTANT(bool, value = true);
+};
+*/
+
+template <class DomainT, ITL_COMPARE Compare>
+struct type_to_string<itl::continuous_interval<DomainT,Compare> >
+{
+ static std::string apply()
+ { return "[R)<"+ type_to_string<DomainT>::apply() +">"; }
+};
+
+template<class DomainT>
+struct value_size<itl::continuous_interval<DomainT> >
+{
+ static std::size_t apply(const itl::continuous_interval<DomainT>& value)
+ { return 2; }
+};
+
+}} // namespace itl boost
+
+#endif
+
Added: sandbox/itl/boost/itl/detail/base_interval.hpp
==============================================================================
--- (empty file)
+++ sandbox/itl/boost/itl/detail/base_interval.hpp 2010-04-01 06:41:20 EDT (Thu, 01 Apr 2010)
@@ -0,0 +1,78 @@
+/*-----------------------------------------------------------------------------+
+Copyright (c) 2007-2010: Joachim Faulhaber
++------------------------------------------------------------------------------+
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENCE.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
++-----------------------------------------------------------------------------*/
+#ifndef BOOST_ITL_BASE_INTERVAL_HPP_JOFA_100323
+#define BOOST_ITL_BASE_INTERVAL_HPP_JOFA_100323
+
+#include <functional>
+#include <boost/call_traits.hpp>
+#include <boost/concept_check.hpp>
+#include <boost/itl/detail/design_config.hpp>
+#include <boost/itl/type_traits/difference.hpp>
+#include <boost/itl/type_traits/size.hpp>
+
+namespace boost{namespace itl
+{
+
+template <class DomainT, ITL_COMPARE Compare = ITL_COMPARE_INSTANCE(std::less, DomainT)>
+struct base_interval
+{
+ //==========================================================================
+ //= Associated types
+ //==========================================================================
+ typedef base_interval<DomainT,Compare> type;
+
+ //--------------------------------------------------------------------------
+ //- Associated types: Data
+ //--------------------------------------------------------------------------
+ /// The domain type of the interval
+ typedef DomainT domain_type;
+ /// The codomaintype is the same as domain_type
+ typedef DomainT codomain_type;
+ /// The element type of the interval
+ typedef DomainT element_type;
+ /// The segment type is the interval's type
+ typedef type segment_type;
+ /// The interval type is the interval's type
+ typedef type interval_type;
+
+ //--------------------------------------------------------------------------
+ //- Associated types: Implementation and stl related
+ //--------------------------------------------------------------------------
+ typedef DomainT key_type;
+ typedef DomainT data_type;
+ typedef DomainT value_type;
+
+ /// Compare order on the data
+ typedef ITL_COMPARE_DOMAIN(Compare,DomainT) domain_compare;
+ typedef domain_compare key_compare;
+
+ /// The difference type of an interval which is sometimes different form the domain_type
+ typedef typename itl::difference<DomainT>::type difference_type;
+
+ /// The size type of an interval which is mostly std::size_t
+ typedef typename itl::size<DomainT>::type size_type;
+
+ typedef typename boost::call_traits<DomainT>::param_type DomainP;
+
+ /** Less compare of interval elements. */
+ inline static bool domain_less(DomainP left, DomainP right)
+ { return domain_compare()(left, right) ;}
+
+ /** Less or equal compare of interval elements. */
+ inline static bool domain_less_equal(DomainP left, DomainP right)
+ { return !domain_compare()(right, left );}
+
+ /** Equality compare of interval elements. */
+ inline static bool domain_equal(DomainP left, DomainP right)
+ { return !domain_compare()(left, right) && !domain_compare()(right, left);}
+};
+
+}} // namespace itl boost
+
+#endif
+
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-04-01 06:41:20 EDT (Thu, 01 Apr 2010)
@@ -41,12 +41,12 @@
# define ITL_COMPARE template<class>class
# define ITL_COMPARE_DOMAIN(itl_compare, domain_type) itl_compare<domain_type>
# define ITL_COMPARE_INSTANCE(compare_instance, domain_type) compare_instance
-# define ITL_EXCLUSIVE_LESS(interval_type) exclusive_less
+# define ITL_EXCLUSIVE_LESS(interval_type) exclusive_less_than
#else//ITL_USE_COMPARE_TEMPLATE_TYPE
# define ITL_COMPARE class
# define ITL_COMPARE_DOMAIN(itl_compare, domain_type) itl_compare
# define ITL_COMPARE_INSTANCE(compare_instance, domain_type) compare_instance<domain_type>
-# define ITL_EXCLUSIVE_LESS(interval_type) exclusive_less<interval_type>
+# define ITL_EXCLUSIVE_LESS(interval_type) exclusive_less_than<interval_type>
#endif
//------------------------------------------------------------------------------
@@ -74,6 +74,11 @@
#endif
//------------------------------------------------------------------------------
+//#define ITL_INTERVAL_DEFAULT itl::rightopen_interval
+#define ITL_INTERVAL_DEFAULT itl::interval
+//#define ITL_INTERVAL_DEFAULT itl::continuous_interval
+
+//------------------------------------------------------------------------------
#define ITL_ALLOC template<class>class
//------------------------------------------------------------------------------
Modified: sandbox/itl/boost/itl/detail/element_comparer.hpp
==============================================================================
--- sandbox/itl/boost/itl/detail/element_comparer.hpp (original)
+++ sandbox/itl/boost/itl/detail/element_comparer.hpp 2010-04-01 06:41:20 EDT (Thu, 01 Apr 2010)
@@ -60,13 +60,13 @@
int proceed(LeftIterT& left, RightIterT& right)
{
- if(LeftT::key_value(left).upper_less(RightT::key_value(right)))
+ if(upper_less(LeftT::key_value(left), RightT::key_value(right)))
{
_prior_left = left;
++left;
return nextleft;
}
- else if(RightT::key_value(right).upper_less(LeftT::key_value(left)))
+ else if(upper_less(RightT::key_value(right), LeftT::key_value(left)))
{
_prior_right = right;
++right;
@@ -96,14 +96,14 @@
}
// The starting intervals have to begin equally
- if(LeftT::key_value(left).lower_less(RightT::key_value(right)))
+ if(lower_less(LeftT::key_value(left), RightT::key_value(right)))
{ // left: same A... = sameA...
// right:same B.. = sameB...
_result = less;
return stop;
}
- if(LeftT::key_value(right).lower_less(RightT::key_value(left)))
+ if(lower_less(LeftT::key_value(right), RightT::key_value(left)))
{ // left: same B.. = sameB...
// right:same A... = sameA...
_result = greater;
Modified: sandbox/itl/boost/itl/detail/interval_set_algo.hpp
==============================================================================
--- sandbox/itl/boost/itl/detail/interval_set_algo.hpp (original)
+++ sandbox/itl/boost/itl/detail/interval_set_algo.hpp 2010-04-01 06:41:20 EDT (Thu, 01 Apr 2010)
@@ -29,7 +29,7 @@
size_type interval_size;
ITL_const_FORALL(typename IntervalContainerT, it, object)
{
- interval_size = continuous_interval<interval_type>::cardinality(IntervalContainerT::key_value(it));
+ interval_size = continuous_interval_<interval_type>::cardinality(IntervalContainerT::key_value(it));
if(interval_size == infinity<size_type>::value())
return interval_size;
else
@@ -46,7 +46,7 @@
size_type size = neutron<size_type>::value();
ITL_const_FORALL(typename IntervalContainerT, it, object)
- size += discrete_interval<interval_type>::cardinality(IntervalContainerT::key_value(it));
+ size += discrete_interval_<interval_type>::cardinality(IntervalContainerT::key_value(it));
return size;
}
Modified: sandbox/itl/boost/itl/detail/interval_subset_comparer.hpp
==============================================================================
--- sandbox/itl/boost/itl/detail/interval_subset_comparer.hpp (original)
+++ sandbox/itl/boost/itl/detail/interval_subset_comparer.hpp 2010-04-01 06:41:20 EDT (Thu, 01 Apr 2010)
@@ -133,14 +133,14 @@
int proceed(LeftIterT& left, RightIterT& right)
{
- if(LeftT::key_value(left).upper_less(RightT::key_value(right)))
+ if(upper_less(LeftT::key_value(left), RightT::key_value(right)))
{ // left ..)
// right .....)
_prior_left = left;
++left;
return nextleft;
}
- else if(RightT::key_value(right).upper_less(LeftT::key_value(left)))
+ else if(upper_less(RightT::key_value(right), LeftT::key_value(left)))
{ // left .....)
// right ..)
_prior_right = right;
@@ -172,7 +172,7 @@
restrict_result(superset);
return stop;
}
- else if(LeftT::key_value(left).exclusive_less(RightT::key_value(right)))
+ else if(exclusive_less(LeftT::key_value(left), RightT::key_value(right)))
{ // left: [..) . . .[---) left could be superset
// right: [..).... if [---) exists
restrict_result(superset);
@@ -193,7 +193,7 @@
}
}
}
- else if(RightT::key_value(right).exclusive_less(LeftT::key_value(left)))
+ else if(exclusive_less(RightT::key_value(right), LeftT::key_value(left)))
{ // left: [.. left could be subset
// right:....) . . .[---) if [---) exists
restrict_result(subset);
@@ -221,13 +221,13 @@
return stop;
// examine left borders only. Right borders are checked in proceed
- if(LeftT::key_value(left).lower_less(RightT::key_value(right)))
+ if(lower_less(LeftT::key_value(left), RightT::key_value(right)))
{ // left: ....[... left could be superset
// right:.... [..
if(unrelated == restrict_result(superset))
return stop;
}
- else if(RightT::key_value(right).lower_less(LeftT::key_value(left)))
+ else if(lower_less(RightT::key_value(right), LeftT::key_value(left)))
{ // left: .... [.. left can be subset
// right:....[...
if(unrelated == restrict_result(subset))
@@ -249,10 +249,10 @@
restrict_result(subset);
return stop;
}
- else if(!LeftT::key_value(_prior_left).touches(LeftT::key_value(left)))
+ else if(!touches(LeftT::key_value(_prior_left), LeftT::key_value(left)))
{ // left: ..) [..
// right:.........)
- if(RightT::key_value(right).lower_less(LeftT::key_value(left)))
+ if(lower_less(RightT::key_value(right), LeftT::key_value(left)))
{ // ..) [.. left could be subset
// ..........)
if(unrelated == restrict_result(subset))
@@ -260,14 +260,14 @@
}
//else ..) [...
// [..
- if(_compare_codomain && !LeftT::key_value(left).is_disjoint(RightT::key_value(right)) )
+ if(_compare_codomain && intersects(LeftT::key_value(left),RightT::key_value(right)) )
if(unrelated == restrict_result(co_compare(left,right)))
return stop;
}
else
{ // left: ..)[.. left could be subset
// right:.......)
- if(_compare_codomain && !LeftT::key_value(left).is_disjoint(RightT::key_value(right)) )
+ if(_compare_codomain && intersects(LeftT::key_value(left), RightT::key_value(right)) )
if(unrelated == restrict_result(co_compare(left,right)))
return stop;
}
@@ -284,10 +284,10 @@
restrict_result(superset);
return stop;
}
- else if(!RightT::key_value(_prior_right).touches(RightT::key_value(right)))
+ else if(!touches(RightT::key_value(_prior_right), RightT::key_value(right)))
{ // left: .........)
// right:..) [..
- if(LeftT::key_value(left).lower_less(RightT::key_value(right)))
+ if(lower_less(LeftT::key_value(left), RightT::key_value(right)))
{ // [....) left could be superset
// ..) [..
if(unrelated == restrict_result(superset))
@@ -295,13 +295,13 @@
}
//else [....)
// ..) [..
- if(_compare_codomain && !LeftT::key_value(left).is_disjoint(RightT::key_value(right)) )
+ if(_compare_codomain && intersects(LeftT::key_value(left), RightT::key_value(right)) )
if(unrelated == restrict_result(co_compare(left,right)))
return stop;
}
else
{
- if(_compare_codomain && !LeftT::key_value(left).is_disjoint(RightT::key_value(right)) )
+ if(_compare_codomain && intersects(LeftT::key_value(left), RightT::key_value(right)) )
if(unrelated == restrict_result(co_compare(left,right)))
return stop;
}
Modified: sandbox/itl/boost/itl/interval.hpp
==============================================================================
--- sandbox/itl/boost/itl/interval.hpp (original)
+++ sandbox/itl/boost/itl/interval.hpp 2010-04-01 06:41:20 EDT (Thu, 01 Apr 2010)
@@ -23,6 +23,7 @@
#include <boost/mpl/assert.hpp>
#include <boost/itl/detail/notate.hpp>
#include <boost/itl/detail/design_config.hpp>
+#include <boost/itl/detail/base_interval.hpp>
#include <boost/itl/type_traits/neutron.hpp>
#include <boost/itl/type_traits/unon.hpp>
#include <boost/itl/type_traits/infinity.hpp>
@@ -31,11 +32,15 @@
#include <boost/itl/type_traits/size.hpp>
#include <boost/itl/type_traits/value_size.hpp>
#include <boost/itl/type_traits/to_string.hpp>
+#include <boost/itl/type_traits/is_universal_interval.hpp>
+#include <boost/itl/interval_bounds.hpp>
+#include <boost/itl/interval_functions.hpp>
namespace boost{namespace itl
{
+/*CL
/// Constants for intervalbounds
enum BoundTypes {
/// Both open: <tt>(x,y)</tt>
@@ -47,12 +52,13 @@
/// Both closed: <tt>[x,y]</tt>
closed_bounded = 3
} ;
+*/
typedef unsigned char bound_type;
/** \brief A class template for intervals */
template <class DomainT, ITL_COMPARE Compare = ITL_COMPARE_INSTANCE(std::less, DomainT)>
-class interval
+class interval : public base_interval<DomainT,Compare>
{
public:
//==========================================================================
@@ -269,6 +275,11 @@
/** Intersection with the interval <tt>x2</tt>; assign result to <tt>isec</tt> */
interval& operator &= (const interval& sectant)
{
+ if(empty())
+ return *this;
+ if(sectant.empty())
+ { clear(); return *this; }
+
set_lwb(lwb_max(sectant));
set_upb(upb_min(sectant));
return *this;
@@ -364,20 +375,21 @@
/** Last element of \c *this is equal to the last element of \c x2 */
bool upper_equal(const interval& x2)const;
-public:
- typedef typename boost::call_traits<DomainT>::param_type DomainP;
-
- /** Less compare of interval elements. */
- inline static bool domain_less(DomainP left, DomainP right)
- {return domain_compare()(left, right) ;}
-
- /** Less or equal compare of interval elements. */
- inline static bool domain_less_equal(DomainP left, DomainP right)
- {return !domain_compare()(right, left );}
-
- /** Equality compare of interval elements. */
- inline static bool domain_equal(DomainP left, DomainP right)
- {return !domain_compare()(left, right) && !domain_compare()(right, left);}
+//CL
+//public:
+// typedef typename boost::call_traits<DomainT>::param_type DomainP;
+//
+// /** Less compare of interval elements. */
+// inline static bool domain_less(DomainP left, DomainP right)
+// {return domain_compare()(left, right) ;}
+//
+// /** Less or equal compare of interval elements. */
+// inline static bool domain_less_equal(DomainP left, DomainP right)
+// {return !domain_compare()(right, left );}
+//
+// /** Equality compare of interval elements. */
+// inline static bool domain_equal(DomainP left, DomainP right)
+// {return !domain_compare()(left, right) && !domain_compare()(right, left);}
private:
typedef std::pair<DomainT, bound_type> BoundT;
@@ -469,7 +481,7 @@
}
template<class IntervalT>
-struct continuous_interval
+struct continuous_interval_
{
static typename IntervalT::size_type cardinality(const IntervalT& x)
{
@@ -513,7 +525,7 @@
};
template<class IntervalT>
-struct discrete_interval
+struct discrete_interval_
{
typedef typename IntervalT::domain_type domain_type;
@@ -692,8 +704,8 @@
return
if_<
bool_<is_continuous<DomainT>::value>,
- continuous_interval<interval<DomainT,Compare> >,
- discrete_interval<interval<DomainT,Compare> >
+ continuous_interval_<interval<DomainT,Compare> >,
+ discrete_interval_<interval<DomainT,Compare> >
>
::type::unaligned_lwb_equal(*this, x2);
}
@@ -710,8 +722,8 @@
return
if_<
bool_<is_continuous<DomainT>::value>,
- continuous_interval<interval<DomainT,Compare> >,
- discrete_interval<interval<DomainT,Compare> >
+ continuous_interval_<interval<DomainT,Compare> >,
+ discrete_interval_<interval<DomainT,Compare> >
>
::type::unaligned_upb_equal(*this, x2);
}
@@ -780,8 +792,8 @@
return
if_<
bool_<is_continuous<DomainT>::value>,
- continuous_interval<interval<DomainT,Compare> >,
- discrete_interval<interval<DomainT,Compare> >
+ continuous_interval_<interval<DomainT,Compare> >,
+ discrete_interval_<interval<DomainT,Compare> >
>
::type::has_equal_border_touch(*this, x2);
}
@@ -948,8 +960,8 @@
using namespace boost::mpl;
return if_<
bool_<is_continuous<DomainT>::value>,
- continuous_interval<interval<DomainT,Compare> >,
- discrete_interval<interval<DomainT,Compare> >
+ continuous_interval_<interval<DomainT,Compare> >,
+ discrete_interval_<interval<DomainT,Compare> >
>
::type::cardinality(*this);
}
@@ -960,8 +972,8 @@
using namespace boost::mpl;
return if_<
bool_<is_continuous<DomainT>::value>,
- continuous_interval<interval<DomainT,Compare> >,
- discrete_interval<interval<DomainT,Compare> >
+ continuous_interval_<interval<DomainT,Compare> >,
+ discrete_interval_<interval<DomainT,Compare> >
>
::type::length(*this);
}
@@ -1015,11 +1027,11 @@
/// Comparison functor on intervals implementing an overlap free less
-template <class IntervalType>
-struct exclusive_less {
+template <class IntervalT>
+struct exclusive_less_than {
/** Operator <tt>operator()</tt> implements a strict weak ordering on intervals. */
- bool operator()(const IntervalType& x1, const IntervalType& x2)const
- { return x1.exclusive_less(x2); }
+ bool operator()(const IntervalT& left, const IntervalT& right)const
+ { return exclusive_less(left, right); }
};
@@ -1028,12 +1040,12 @@
//==============================================================================
/** \c hull returns the smallest interval containing \c left and \c right. */
-template <class DomainT, ITL_COMPARE Compare>
-inline interval<DomainT,Compare> hull(interval<DomainT,Compare> left,
- const interval<DomainT,Compare>& right)
-{
- return left.extend(right);
-}
+//CL template <class DomainT, ITL_COMPARE Compare>
+//inline interval<DomainT,Compare> hull(interval<DomainT,Compare> left,
+// const interval<DomainT,Compare>& right)
+//{
+// return left.extend(right);
+//}
//==============================================================================
//= Subtraction
@@ -1048,12 +1060,12 @@
[a b) : left_over
\endcode
*/
-template <class DomainT, ITL_COMPARE Compare, template<class,ITL_COMPARE>class Interval>
-inline Interval<DomainT,Compare> right_subtract(Interval<DomainT,Compare> left,
- const Interval<DomainT,Compare>& right_minuend)
-{
- return left.right_subtract(right_minuend);
-}
+//CL template <class DomainT, ITL_COMPARE Compare, template<class,ITL_COMPARE>class Interval>
+//inline Interval<DomainT,Compare> right_subtract(Interval<DomainT,Compare> left,
+// const Interval<DomainT,Compare>& right_minuend)
+//{
+// return left.right_subtract(right_minuend);
+//}
/** subtract \c left_minuend from the \c right interval on it's left side.
Return the difference: The part of \c right right of \c left_minuend.
@@ -1064,24 +1076,24 @@
[c d) : right_over
\endcode
*/
-template <class DomainT, ITL_COMPARE Compare, template<class,ITL_COMPARE>class Interval>
-inline Interval<DomainT,Compare> left_subtract(Interval<DomainT,Compare> right,
- const Interval<DomainT,Compare>& left_minuend)
-{
- return right.left_subtract(left_minuend);
-}
+//CL template <class DomainT, ITL_COMPARE Compare, template<class,ITL_COMPARE>class Interval>
+//inline Interval<DomainT,Compare> left_subtract(Interval<DomainT,Compare> right,
+// const Interval<DomainT,Compare>& left_minuend)
+//{
+// return right.left_subtract(left_minuend);
+//}
//==============================================================================
//= Intersection
//==============================================================================
/** Returns the intersection of \c left and \c right interval. */
-template <class DomainT, ITL_COMPARE Compare, template<class,ITL_COMPARE>class Interval>
-inline Interval<DomainT,Compare> operator & (Interval<DomainT,Compare> left,
- const Interval<DomainT,Compare>& right)
-{
- return left &= right;
-}
+//CL template <class DomainT, ITL_COMPARE Compare, template<class,ITL_COMPARE>class Interval>
+//inline Interval<DomainT,Compare> operator & (Interval<DomainT,Compare> left,
+// const Interval<DomainT,Compare>& right)
+//{
+// return left &= right;
+//}
/** Returns true if the intersection of \c left and \c right is not empty. */
template <class DomainT, ITL_COMPARE Compare>
@@ -1129,8 +1141,8 @@
using namespace boost::mpl;
return if_<
bool_<is_continuous<DomainT>::value>,
- continuous_interval<interval<DomainT,Compare> >,
- discrete_interval<interval<DomainT,Compare> >
+ continuous_interval_<interval<DomainT,Compare> >,
+ discrete_interval_<interval<DomainT,Compare> >
>
::type::distance(left, right);
}
@@ -1143,8 +1155,8 @@
using namespace boost::mpl;
return if_<
bool_<is_continuous<DomainT>::value>,
- continuous_interval<interval<DomainT,Compare> >,
- discrete_interval<interval<DomainT,Compare> >
+ continuous_interval_<interval<DomainT,Compare> >,
+ discrete_interval_<interval<DomainT,Compare> >
>
::type::length(inter_val);
}
@@ -1156,7 +1168,7 @@
//==============================================================================
template<class CharType, class CharTraits, class DomainT, ITL_COMPARE Compare>
-std::basic_ostream<CharType, CharTraits> &operator<<
+std::basic_ostream<CharType, CharTraits>& operator <<
(std::basic_ostream<CharType, CharTraits> &stream, interval<DomainT,Compare> const& x)
{
if(x.empty())
@@ -1173,6 +1185,20 @@
//==============================================================================
//= Type traits
//==============================================================================
+template <class DomainT, ITL_COMPARE Compare>
+struct is_interval<itl::interval<DomainT,Compare> >
+{
+ typedef is_interval<itl::interval<DomainT,Compare> > type;
+ BOOST_STATIC_CONSTANT(bool, value = true);
+};
+
+template <class DomainT, ITL_COMPARE Compare>
+struct is_universal_interval<itl::interval<DomainT,Compare> >
+{
+ typedef is_universal_interval<itl::interval<DomainT,Compare> > type;
+ BOOST_STATIC_CONSTANT(bool, value = true);
+};
+
template <class DomainT, ITL_COMPARE Compare>
struct type_to_string<itl::interval<DomainT,Compare> >
{
Modified: sandbox/itl/boost/itl/interval_base_map.hpp
==============================================================================
--- sandbox/itl/boost/itl/interval_base_map.hpp (original)
+++ sandbox/itl/boost/itl/interval_base_map.hpp 2010-04-01 06:41:20 EDT (Thu, 01 Apr 2010)
@@ -57,7 +57,7 @@
ITL_COMPARE Compare = ITL_COMPARE_INSTANCE(std::less, DomainT),
ITL_COMBINE Combine = ITL_COMBINE_INSTANCE(itl::inplace_plus, CodomainT),
ITL_SECTION Section = ITL_SECTION_INSTANCE(itl::inter_section, CodomainT),
- template<class,ITL_COMPARE>class Interval = itl::interval,
+ template<class,ITL_COMPARE>class Interval = ITL_INTERVAL_DEFAULT,
ITL_ALLOC Alloc = std::allocator
>
class interval_base_map
@@ -127,10 +127,10 @@
typedef typename inverse<codomain_intersect>::type inverse_codomain_intersect;
/// Comparison functor for intervals which are keys as well
- typedef exclusive_less<interval_type> interval_compare;
+ typedef exclusive_less_than<interval_type> interval_compare;
/// Comparison functor for keys
- typedef exclusive_less<interval_type> key_compare;
+ typedef exclusive_less_than<interval_type> key_compare;
//--------------------------------------------------------------------------
//- Associated types: Implementation and stl related
@@ -237,7 +237,7 @@
/** Does the map contain the interval \c sub_interval ? */
bool contains(const interval_type& sub_interval)const
{
- if(Traits::is_total || sub_interval.empty())
+ if(Traits::is_total || itl::is_empty(sub_interval))
return true;
std::pair<const_iterator, const_iterator> exterior = equal_range(sub_interval);
@@ -622,7 +622,7 @@
type intersection;
add_intersection(intersection, interval_value_pair);
- return !intersection.empty();
+ return !itl::is_empty(intersection);
}
@@ -693,7 +693,7 @@
//==========================================================================
/** Object as string */
- std::string as_string()const;
+ //CL std::string as_string()const;
//==========================================================================
@@ -872,7 +872,7 @@
::segment_type& sub_segment)const
{
interval_type sub_interval = sub_segment.first;
- if(sub_interval.empty())
+ if(itl::is_empty(sub_interval))
return true;
std::pair<const_iterator, const_iterator> exterior = equal_range(sub_interval);
@@ -1000,7 +1000,7 @@
else
{
interval_type sectant_interval = sectant.first;
- if(sectant_interval.empty())
+ if(itl::is_empty(sectant_interval))
return;
const_iterator first_ = _map.lower_bound(sectant_interval);
@@ -1013,7 +1013,7 @@
for(it_=first_; it_ != end_; it_++)
{
interval_type common_interval = it_->first & sectant_interval;
- if(!common_interval.empty())
+ if(!itl::is_empty(common_interval))
{
section.that()->add(value_type(common_interval, it_->second));
section.that()->template _add<codomain_intersect>(value_type(common_interval, sectant.second));
@@ -1023,7 +1023,7 @@
for(it_=first_; it_ != end_; it_++)
{
interval_type common_interval = it_->first & sectant_interval;
- if(!common_interval.empty())
+ if(!itl::is_empty(common_interval))
{
section.that()->add(value_type(common_interval, it_->second) );
section.that()->template _add<codomain_combine>(value_type(common_interval, sectant.second));
@@ -1044,7 +1044,7 @@
const typename interval_base_map<SubType,DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>
::interval_type& sectant_interval)const
{
- if(sectant_interval.empty())
+ if(itl::is_empty(sectant_interval))
return;
typename ImplMapT::const_iterator first_ = _map.lower_bound(sectant_interval);
@@ -1054,7 +1054,7 @@
for(typename ImplMapT::const_iterator it_=first_; it_ != end_; it_++)
{
interval_type common_interval = it_->first & sectant_interval;
- if(!common_interval.empty())
+ if(!itl::is_empty(common_interval))
prior_ = section.that()->gap_insert<codomain_combine>(prior_, common_interval, it_->second );
}
}
@@ -1115,7 +1115,7 @@
//That which is common ...
common_interval = span & covered;
- if(!common_interval.empty())
+ if(!itl::is_empty(common_interval))
{
// ... shall be subtracted
eraser.add(common_interval);
@@ -1134,9 +1134,9 @@
// Because this is a collision free addition I don't have to distinguish codomain_types.
//... d) : span
- //... c) : (*it_); span.left_subtract(*it_);
+ //... c) : covered
// [c d) : span'
- span.left_subtract(covered);
+ span = left_subtract(span, covered);
}
//If span is not empty here, it is not in the set so it shall be added
@@ -1224,7 +1224,7 @@
while(next_ != _map.end())
{
- if( it_->first.touches(next_->first)
+ if( touches(it_->first, next_->first)
&& it_->second == next_->second )
{
iterator fst_mem = it_; // hold the first member
@@ -1232,13 +1232,13 @@
// Go on while touching members are found
it_++; next_++;
while( next_ != _map.end()
- && it_->first.touches(next_->first)
+ && touches(it_->first, next_->first)
&& it_->second == next_->second )
{ it_++; next_++; }
// finally we arrive at the end of a sequence of joinable intervals
// and it points to the last member of that sequence
- const_cast<interval_type&>(it_->first).extend(fst_mem->first);
+ const_cast<interval_type&>(it_->first) = hull(it_->first, fst_mem->first);
_map.erase(fst_mem, it_);
it_++; next_=it_;
@@ -1250,7 +1250,7 @@
return *this;
}
-
+/*CL ::as_string
template
<
class SubType,
@@ -1269,7 +1269,7 @@
}
return res;
}
-
+*/
template
<
@@ -1306,7 +1306,7 @@
inline SubType& interval_base_map<SubType,DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>
::erase(const interval_type& minuend)
{
- if(minuend.empty())
+ if(itl::is_empty(minuend))
return *that();
iterator first_ = _map.lower_bound(minuend);
@@ -1322,14 +1322,14 @@
interval_type right_resid = left_subtract(last_ ->first, minuend);
if(first_ == last_ )
- if(!left_resid.empty())
+ if(!itl::is_empty(left_resid))
{
- const_cast<interval_type&>(first_->first).right_subtract(minuend);
- if(!right_resid.empty())
+ const_cast<interval_type&>(first_->first) = left_resid;
+ if(!itl::is_empty(right_resid))
this->_map.insert(first_, value_type(right_resid, first_->second));
}
- else if(!right_resid.empty())
- const_cast<interval_type&>(first_->first).left_subtract(minuend);
+ else if(!itl::is_empty(right_resid))
+ const_cast<interval_type&>(first_->first) = left_subtract(first_->first, minuend);
else
this->_map.erase(first_);
else
@@ -1337,15 +1337,15 @@
// [left_resid fst) . . . . [lst right_resid)
iterator second_= first_; ++second_;
- iterator start_ = left_resid.empty()? first_: second_;
- iterator stop_ = right_resid.empty()? end_ : last_ ;
+ iterator start_ = itl::is_empty(left_resid)? first_: second_;
+ iterator stop_ = itl::is_empty(right_resid)? end_ : last_ ;
this->_map.erase(start_, stop_); //erase [start_, stop_)
- if(!left_resid.empty())
- const_cast<interval_type&>(first_->first).right_subtract(minuend);
+ if(!itl::is_empty(left_resid))
+ const_cast<interval_type&>(first_->first) = left_resid;
- if(!right_resid.empty())
- const_cast<interval_type&>(last_ ->first).left_subtract(minuend);
+ if(!itl::is_empty(right_resid))
+ const_cast<interval_type&>(last_ ->first) = right_resid;
}
return *that();
}
Modified: sandbox/itl/boost/itl/interval_base_set.hpp
==============================================================================
--- sandbox/itl/boost/itl/interval_base_set.hpp (original)
+++ sandbox/itl/boost/itl/interval_base_set.hpp 2010-04-01 06:41:20 EDT (Thu, 01 Apr 2010)
@@ -13,6 +13,8 @@
#include <boost/itl/detail/interval_set_algo.hpp>
#include <boost/itl/set.hpp>
#include <boost/itl/interval.hpp>
+#include <boost/itl/rightopen_interval.hpp> //JODO inclusion and customization of interval types
+#include <boost/itl/continuous_interval.hpp> //JODO inclusion and customization of interval types
#include <boost/itl/detail/notate.hpp>
#include <boost/itl/detail/element_iterator.hpp>
@@ -29,7 +31,7 @@
typename SubType,
typename DomainT,
ITL_COMPARE Compare = ITL_COMPARE_INSTANCE(std::less, DomainT),
- template<class, ITL_COMPARE>class Interval = itl::interval,
+ template<class, ITL_COMPARE>class Interval = ITL_INTERVAL_DEFAULT,
ITL_ALLOC Alloc = std::allocator
>
class interval_base_set
@@ -84,10 +86,10 @@
/// Comparison functor for domain values
typedef ITL_COMPARE_DOMAIN(Compare,DomainT) domain_compare;
/// Comparison functor for intervals
- typedef exclusive_less<interval_type> interval_compare;
+ typedef exclusive_less_than<interval_type> interval_compare;
/// Comparison functor for keys
- typedef exclusive_less<interval_type> key_compare;
+ typedef exclusive_less_than<interval_type> key_compare;
//--------------------------------------------------------------------------
//- Associated types: Implementation and stl related
@@ -173,7 +175,7 @@
/** Does the container contain the interval \c sub_interval ? */
bool contains(const segment_type& sub_interval)const
{
- if(sub_interval.empty())
+ if(itl::is_empty(sub_interval))
return true;
std::pair<const_iterator, const_iterator> exterior = equal_range(sub_interval);
@@ -450,8 +452,10 @@
//==========================================================================
/** Interval container's string representation */
+ /*CL ::as_string
const std::string as_string()const
{ std::string res(""); const_FOR_IMPL(it_) res += (*it_).as_string(); return res; }
+ */
//==========================================================================
@@ -463,7 +467,7 @@
template<typename IteratorT>
static codomain_type codomain_value(IteratorT value_)
- { return (*value_).empty()? codomain_type() : (*value_).lower(); }
+ { return itl::is_empty(*value_)? codomain_type() : (*value_).lower(); }
template<typename LeftIterT, typename RightIterT>
static bool key_less(LeftIterT lhs_, RightIterT rhs_)
@@ -537,7 +541,7 @@
void interval_base_set<SubType,DomainT,Compare,Interval,Alloc>::add_intersection(interval_base_set& section, const segment_type& inter_val)const
{
// any intersection with the empty intervall is empty
- if(inter_val.empty())
+ if(itl::is_empty(inter_val))
return;
const_iterator first_ = _set.lower_bound(inter_val);
@@ -547,7 +551,7 @@
for(const_iterator it_=first_; it_ != end_; it_++)
{
interval_type common_interval = (*it_) & inter_val;
- if(!common_interval.empty())
+ if(!itl::is_empty(common_interval))
prior_ = section.gap_insert(prior_, common_interval);
}
}
@@ -613,9 +617,9 @@
add(left_over); //That which is not shall be added
//... d) : span
- //... c) : (*it_); span.left_subtract(*it_);
+ //... c) : covered
// [c d) : span'
- span.left_subtract(covered);
+ span = left_subtract(span, covered);
}
//If span is not empty here, it_ is not in the set so it_ shall be added
@@ -670,24 +674,22 @@
return *this;
iterator next_=it_; next_++;
- //if(next_==_set.end())
- // return *this;
while(next_ != _set.end())
{
- if( (*it_).touches(*next_) )
+ if( touches(*it_, *next_) )
{
iterator fst_mem = it_; // hold the first member
// Go on while touching members are found
it_++; next_++;
while( next_ != _set.end()
- && (*it_).touches(*next_) )
+ && touches(*it_, *next_) )
{ it_++; next_++; }
// finally we arrive at the end of a sequence of joinable intervals
// and it points to the last member of that sequence
- const_cast<interval_type&>(*it_).extend(*fst_mem);
+ const_cast<interval_type&>(*it_) = hull(*it_, *fst_mem);
_set.erase(fst_mem, it_);
it_++; next_=it_;
Added: sandbox/itl/boost/itl/interval_bounds.hpp
==============================================================================
--- (empty file)
+++ sandbox/itl/boost/itl/interval_bounds.hpp 2010-04-01 06:41:20 EDT (Thu, 01 Apr 2010)
@@ -0,0 +1,100 @@
+/*-----------------------------------------------------------------------------+
+Copyright (c) 2010-2010: Joachim Faulhaber
++------------------------------------------------------------------------------+
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENCE.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
++-----------------------------------------------------------------------------*/
+#ifndef BOOST_ITL_INTERVAL_BOUNDS_HPP_JOFA_100330
+#define BOOST_ITL_INTERVAL_BOUNDS_HPP_JOFA_100330
+
+#include <boost/itl/detail/base_interval.hpp>
+
+namespace boost{namespace itl
+{
+
+/// Constants for interval bounds
+enum BoundTypes {
+ /// Both open: <tt>(x,y)</tt>
+ open_bounded = 0, // '00'
+ /// Left open right closed: <tt>(x,y]</tt>
+ left_open = 1, // '01'
+ /// Left closed right open: <tt>[x,y)</tt>
+ right_open = 2, // '10'
+ /// Both closed: <tt>[x,y]</tt>
+ closed_bounded = 3 // '11'
+} ;
+
+typedef unsigned char bound_type;
+
+class interval_bounds
+{
+public:
+ explicit interval_bounds(bound_type bounds): _bits(bounds){}
+ interval_bounds left ()const { return interval_bounds(_bits & 1); }
+ interval_bounds right()const { return interval_bounds(_bits & 2); }
+ interval_bounds both ()const { return interval_bounds(_bits & 3); }
+
+public:
+ bound_type _bits;
+};
+
+inline interval_bounds open_() { return interval_bounds(open_bounded); }
+inline interval_bounds left_open_() { return interval_bounds(left_open); }
+inline interval_bounds right_open_(){ return interval_bounds(right_open); }
+inline interval_bounds closed_() { return interval_bounds(closed_bounded);}
+
+inline interval_bounds left(interval_bounds x1)
+{ return interval_bounds(x1._bits & 1); }
+
+inline interval_bounds right(interval_bounds x1)
+{ return interval_bounds(x1._bits & 2); }
+
+inline interval_bounds all(interval_bounds x1)
+{ return interval_bounds(x1._bits & 2); }
+
+inline bool operator == (const interval_bounds x1, const interval_bounds x2)
+{ return x1._bits == x2._bits; }
+
+inline interval_bounds operator & (interval_bounds x1, interval_bounds x2)
+{ return interval_bounds(x1._bits & x2._bits); }
+
+inline interval_bounds operator | (interval_bounds x1, interval_bounds x2)
+{ return interval_bounds(x1._bits | x2._bits); }
+
+// left shift (multiplies by 2^shift)
+inline interval_bounds operator << (interval_bounds bounds, unsigned int shift)
+{ return interval_bounds(bounds._bits << shift); }
+
+// right shift (divides by 2^shift)
+inline interval_bounds operator >> (interval_bounds bounds, unsigned int shift)
+{ return interval_bounds(bounds._bits >> shift); }
+
+inline interval_bounds operator ~ (interval_bounds x1)
+{ return interval_bounds(all(~x1)); }
+
+inline interval_bounds outer_bounds(interval_bounds x1, interval_bounds x2)
+{ return left(x1) | right(x2); }
+
+inline interval_bounds inner_bounds(interval_bounds x1, interval_bounds x2)
+{ return ~(right(x1) | left(x2)); }
+
+inline interval_bounds left_bounds(interval_bounds x1, interval_bounds x2)
+{ return left(x1) | (left(x2) >> 1); }
+
+inline interval_bounds right_bounds(interval_bounds x1, interval_bounds x2)
+{ return (right(x1) <<1 ) | right(x2); }
+
+inline interval_bounds left_subtract_bounds(interval_bounds x1, interval_bounds x2)
+{ return right(x1) | ~(right(x2) << 1); }
+
+inline interval_bounds right_subtract_bounds(interval_bounds x1, interval_bounds x2)
+{ return left(x1) | ~(left(x2) >> 1); }
+
+
+
+
+}} // namespace itl boost
+
+#endif
+
Added: sandbox/itl/boost/itl/interval_functions.hpp
==============================================================================
--- (empty file)
+++ sandbox/itl/boost/itl/interval_functions.hpp 2010-04-01 06:41:20 EDT (Thu, 01 Apr 2010)
@@ -0,0 +1,547 @@
+/*-----------------------------------------------------------------------------+
+Copyright (c) 2007-2010: Joachim Faulhaber
++------------------------------------------------------------------------------+
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENCE.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
++-----------------------------------------------------------------------------*/
+#ifndef BOOST_ITL_INTERVAL_FUNCTIONS_HPP_JOFA_100323
+#define BOOST_ITL_INTERVAL_FUNCTIONS_HPP_JOFA_100323
+
+#include <boost/utility/enable_if.hpp>
+#include <boost/itl/detail/design_config.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>
+#include <boost/itl/type_traits/is_continuous_interval.hpp>
+#include <boost/itl/type_traits/has_dynamic_bounds.hpp>
+
+namespace boost{namespace itl
+{
+typedef unsigned char bound_type; //JODO encapsulation in a small class
+
+
+//==============================================================================
+//= Construct
+//==============================================================================
+
+//- 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)
+{
+ return IntervalT(low, up);
+}
+
+template<class IntervalT>
+typename boost::enable_if<is_universal_interval<IntervalT>, IntervalT>::type
+construct(const typename IntervalT::domain_type& low,
+ const typename IntervalT::domain_type& up,
+ itl::bound_type bounds)
+{
+ return IntervalT(low, up, bounds);
+}
+
+template<class IntervalT>
+typename boost::enable_if<is_continuous_interval<IntervalT>, IntervalT>::type
+construct(const typename IntervalT::domain_type& low,
+ const typename IntervalT::domain_type& up,
+ itl::bound_type bounds)
+{
+ return IntervalT(low, up, bounds);
+}
+
+//- is_empty -------------------------------------------------------------------
+/** Is the interval empty? */
+template<class IntervalT>
+typename boost::enable_if<is_asymmetric_interval<IntervalT>, bool>::type
+is_empty(const IntervalT& object)
+{
+ return IntervalT::domain_less_equal(object.upper(), object.lower());
+}
+
+template<class IntervalT>
+typename boost::enable_if<is_universal_interval<IntervalT>, bool>::type
+is_empty(const IntervalT& object)
+{
+ return object.empty();
+}
+
+template<class IntervalT>
+typename boost::enable_if<is_discrete_interval<IntervalT>, bool>::type
+is_empty(const IntervalT& object)
+{
+ return IntervalT::domain_less(object.last(), object.first());
+}
+
+template<class IntervalT>
+typename boost::enable_if<is_continuous_interval<IntervalT>, bool>::type
+is_empty(const IntervalT& object)
+{
+ if(is_closed(object))
+ return IntervalT::domain_less(object.lower(), object.upper());
+ else
+ return IntervalT::domain_less_equal(object.lower(), object.upper());
+}
+
+//==============================================================================
+//= Selection
+//==============================================================================
+
+/*JODO
+template<class IntervalT>
+typename boost::enable_if<!is_continuous<typename IntervalT::domain_type>,
+ typename IntervalT::domain_type>::type
+first(const IntervalT& object)
+{
+}
+*/
+
+//==============================================================================
+//= Equivalences and Orderings
+//==============================================================================
+//- exclusive_less -------------------------------------------------------------
+/** Maximal element of <tt>left</tt> is less than the minimal element of
+ <tt>right</tt> */
+template<class IntervalT>
+typename boost::enable_if<is_asymmetric_interval<IntervalT>, bool>::type
+exclusive_less(const IntervalT& left, const IntervalT& right)
+{
+ return IntervalT::domain_less_equal(left.upper(), right.lower());
+}
+
+template<class IntervalT>
+typename boost::enable_if<is_universal_interval<IntervalT>, bool>::type
+exclusive_less(const IntervalT& left, const IntervalT& right)
+{
+ return left.exclusive_less(right);
+}
+
+
+template<class IntervalT>
+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());
+}
+
+template<class IntervalT>
+typename boost::enable_if<is_continuous_interval<IntervalT>, bool>::type
+exclusive_less(const IntervalT& left, const IntervalT& right)
+{
+ if(inner_bounds(left,right).is_closed())
+ return IntervalT::domain_less(left.lower(), right.upper());
+ else
+ return IntervalT::domain_less_equal(left.lower(), right.upper());
+}
+
+//------------------------------------------------------------------------------
+template<class IntervalT>
+typename boost::enable_if<is_asymmetric_interval<IntervalT>, bool>::type
+lower_less(const IntervalT& left, const IntervalT& right)
+{
+ return IntervalT::domain_less(left.lower(), right.lower());
+}
+
+template<class IntervalT>
+typename boost::enable_if<is_universal_interval<IntervalT>, bool>::type
+lower_less(const IntervalT& left, const IntervalT& right)
+{
+ return left.lower_less(right);
+}
+
+template<class IntervalT>
+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());
+}
+
+template<class IntervalT>
+typename boost::enable_if<is_continuous_interval<IntervalT>, bool>::type
+lower_less(const IntervalT& left, const IntervalT& right)
+{
+ if(left_bounds(left,right).is_right_open()) //'[(' == 10
+ return IntervalT::domain_less_equal(left.lower(), right.lower());
+ else
+ return IntervalT::domain_less(left.lower(), right.lower());
+}
+
+
+//------------------------------------------------------------------------------
+template<class IntervalT>
+typename boost::enable_if<is_asymmetric_interval<IntervalT>, bool>::type
+upper_less(const IntervalT& left, const IntervalT& right)
+{
+ return IntervalT::domain_less(left.upper(), right.upper());
+}
+
+template<class IntervalT>
+typename boost::enable_if<is_universal_interval<IntervalT>, bool>::type
+upper_less(const IntervalT& left, const IntervalT& right)
+{
+ return left.upper_less(right);
+}
+
+template<class IntervalT>
+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());
+}
+
+template<class IntervalT>
+typename boost::enable_if<is_continuous_interval<IntervalT>, bool>::type
+upper_less(const IntervalT& left, const IntervalT& right)
+{
+ if(right_bounds(left,right).is_left_open())
+ return IntervalT::domain_less_equal(left.upper(), right.upper());
+ else
+ return IntervalT::domain_less(left.upper(), right.upper());
+}
+
+//------------------------------------------------------------------------------
+template<class IntervalT>
+typename boost::enable_if<has_dynamic_bounds<IntervalT>,
+ typename IntervalT::domain_type >::type
+lower_min(const IntervalT& left, const IntervalT& right)
+{
+ return lower_less(left, right) ? left.lower() : right.lower();
+}
+
+//------------------------------------------------------------------------------
+template<class IntervalT>
+typename boost::enable_if<has_dynamic_bounds<IntervalT>,
+ typename IntervalT::domain_type >::type
+lower_max(const IntervalT& left, const IntervalT& right)
+{
+ return lower_less(left, right) ? right.lower() : left.lower();
+}
+
+//------------------------------------------------------------------------------
+template<class IntervalT>
+typename boost::enable_if<has_dynamic_bounds<IntervalT>,
+ typename IntervalT::domain_type >::type
+upper_max(const IntervalT& left, const IntervalT& right)
+{
+ return upper_less(left, right) ? right.upper() : left.upper();
+}
+
+//------------------------------------------------------------------------------
+template<class IntervalT>
+typename boost::enable_if<has_dynamic_bounds<IntervalT>,
+ typename IntervalT::domain_type >::type
+upper_min(const IntervalT& left, const IntervalT& right)
+{
+ return upper_less(left, right) ? left.upper() : right.upper();
+}
+
+
+//------------------------------------------------------------------------------
+template<class IntervalT>
+typename boost::enable_if<is_asymmetric_interval<IntervalT>, bool>::type
+lower_equal(const IntervalT& left, const IntervalT& right)
+{
+ return IntervalT::domain_equal(left.lower(), right.lower());
+}
+
+template<class IntervalT>
+typename boost::enable_if<is_universal_interval<IntervalT>, bool>::type
+lower_equal(const IntervalT& left, const IntervalT& right)
+{
+ return left.lower_equal(right);
+}
+
+template<class IntervalT>
+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());
+}
+
+template<class IntervalT>
+typename boost::enable_if<is_continuous_interval<IntervalT>, bool>::type
+lower_equal(const IntervalT& left, const IntervalT& right)
+{
+ return (left_bound(left)==left_bound(right))
+ && IntervalT::domain_equal(left.lower(), right.lower());
+}
+
+
+//------------------------------------------------------------------------------
+template<class IntervalT>
+typename boost::enable_if<is_asymmetric_interval<IntervalT>, bool>::type
+upper_equal(const IntervalT& left, const IntervalT& right)
+{
+ return IntervalT::domain_equal(left.upper(), right.upper());
+}
+
+template<class IntervalT>
+typename boost::enable_if<is_universal_interval<IntervalT>, bool>::type
+upper_equal(const IntervalT& left, const IntervalT& right)
+{
+ return left.upper_equal(right);
+}
+
+template<class IntervalT>
+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());
+}
+
+template<class IntervalT>
+typename boost::enable_if<is_continuous_interval<IntervalT>, bool>::type
+upper_equal(const IntervalT& left, const IntervalT& right)
+{
+ return (right_bound(left)==right_bound(right))
+ && IntervalT::domain_equal(left.upper(), right.upper());
+}
+
+
+//- operator == ----------------------------------------------------------------
+template<class IntervalT>
+typename boost::enable_if<is_interval<IntervalT>, bool>::type
+operator == (const IntervalT& lhs, const IntervalT& rhs)
+{
+ return (itl::is_empty(lhs) && itl::is_empty(rhs))
+ || (lower_equal(lhs,rhs) && upper_equal(lhs,rhs));
+}
+
+//- operator < -----------------------------------------------------------------
+template<class IntervalT>
+typename boost::enable_if<is_interval<IntervalT>, bool>::type
+operator < (const IntervalT& lhs, const IntervalT& rhs)
+{
+ if(itl::is_empty(lhs))
+ return !itl::is_empty(rhs);
+ else
+ return lower_less(lhs,rhs)
+ || (lower_equal(lhs,rhs) && upper_less(lhs,rhs));
+}
+
+
+
+//------------------------------------------------------------------------------
+template<class IntervalT>
+typename boost::enable_if<is_asymmetric_interval<IntervalT>, bool>::type
+touches(const IntervalT& left, const IntervalT& right)
+{
+ return IntervalT::domain_equal(left.upper(), right.lower());
+}
+
+template<class IntervalT>
+typename boost::enable_if<is_universal_interval<IntervalT>, bool>::type
+touches(const IntervalT& left, const IntervalT& right)
+{
+ return left.touches(right);
+}
+
+template<class IntervalT>
+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());
+}
+
+template<class IntervalT>
+typename boost::enable_if<is_continuous_interval<IntervalT>, bool>::type
+touches(const IntervalT& left, const IntervalT& right)
+{
+ return inner_bounds(left,right).are_complementary()
+ && IntervalT::domain_equal(left.upper(), right.lower());
+}
+
+
+
+//==============================================================================
+//= Addition
+//==============================================================================
+//- hull -----------------------------------------------------------------------
+/** \c hull returns the smallest interval containing \c left and \c right. */
+template<class IntervalT>
+typename boost::enable_if<is_asymmetric_interval<IntervalT>, IntervalT>::type
+hull(IntervalT left, const IntervalT& right)
+{
+ if(itl::is_empty(right))
+ return left;
+ else if(itl::is_empty(left))
+ return right;
+
+ //JODO return construct
+ return
+ IntervalT
+ (
+ (std::min)(left.lower(), right.lower(), IntervalT::domain_compare()),
+ (std::max)(left.upper(), right.upper(), IntervalT::domain_compare())
+ );
+}
+
+template<class IntervalT>
+typename boost::enable_if<is_universal_interval<IntervalT>, IntervalT>::type
+hull(IntervalT left, const IntervalT& right)
+{
+ return left.extend(right);
+}
+
+template<class IntervalT>
+typename boost::enable_if<has_dynamic_bounds<IntervalT>, IntervalT>::type
+hull(IntervalT left, const IntervalT& right)
+{
+ if(itl::is_empty(right))
+ return left;
+ else if(itl::is_empty(left))
+ return right;
+
+ return construct
+ (
+ lower_min(left, right),
+ upper_max(left, right),
+ outer_bounds(left, right)
+ );
+}
+
+//==============================================================================
+//= Subtraction
+//==============================================================================
+//- left_subtract --------------------------------------------------------------
+/** subtract \c left_minuend from the \c right interval on it's left side.
+ Return the difference: The part of \c right right of \c left_minuend.
+\code
+right_over = right - left_minuend; //on the left.
+... d) : right
+... c) : left_minuend
+ [c d) : right_over
+\endcode
+*/
+template<class IntervalT>
+typename boost::enable_if<is_asymmetric_interval<IntervalT>, IntervalT>::type
+left_subtract(IntervalT right, const IntervalT& left_minuend)
+{
+ if(exclusive_less(left_minuend, right))
+ return right;
+ //JODO return construct(left_minuend.upper(), right.upper());
+ return IntervalT(left_minuend.upper(), right.upper());
+}
+
+template<class IntervalT>
+typename boost::enable_if<is_universal_interval<IntervalT>, IntervalT>::type
+left_subtract(IntervalT right, const IntervalT& left_minuend)
+{
+ return right.left_subtract(left_minuend);
+}
+
+template<class IntervalT>
+typename boost::enable_if<has_dynamic_bounds<IntervalT>, IntervalT>::type
+left_subtract(IntervalT right, const IntervalT& left_minuend)
+{
+ //JODO
+ if(exclusive_less(left_minuend, right))
+ return right;
+ return construct(left_minuend.upper(), right.upper(),
+ left_subtract_bounds(right, left_minuend));
+}
+
+
+//- right_subtract -------------------------------------------------------------
+/** subtract \c right_minuend from the \c left interval on it's right side.
+ Return the difference: The part of \c left right of \c right_minuend.
+\code
+left_over = left - right_minuend; //on the right side.
+[a ... : left
+ [b ... : right_minuend
+[a b) : left_over
+\endcode
+*/
+template<class IntervalT>
+typename boost::enable_if<is_asymmetric_interval<IntervalT>, IntervalT>::type
+right_subtract(IntervalT left, const IntervalT& right_minuend)
+{
+ if(exclusive_less(left, right_minuend))
+ return left;
+ return IntervalT(left.lower(), right_minuend.lower());
+ //JODO return construct(left.lower(), right_minuend.lower());
+}
+
+template<class IntervalT>
+typename boost::enable_if<is_universal_interval<IntervalT>, IntervalT>::type
+right_subtract(IntervalT left, const IntervalT& right_minuend)
+{
+ return left.right_subtract(right_minuend);
+}
+
+template<class IntervalT>
+typename boost::enable_if<has_dynamic_bounds<IntervalT>, IntervalT>::type
+right_subtract(IntervalT left, const IntervalT& right_minuend)
+{
+ //JODO s.o.
+ if(exclusive_less(left, right_minuend))
+ return left;
+ return construct(left.lower(), right_minuend.lower(),
+ right_subtract_bounds(left, right) );
+}
+
+//==============================================================================
+//= Intersection
+//==============================================================================
+//- operator & -----------------------------------------------------------------
+/** Returns the intersection of \c left and \c right interval. */
+template<class IntervalT>
+typename boost::enable_if<is_asymmetric_interval<IntervalT>, IntervalT>::type
+operator & (IntervalT left, const IntervalT& right)
+{
+ if(itl::is_empty(left) || itl::is_empty(right))
+ return IntervalT(); //JODO return neutron<IntervalT>::value; neutron for new interval_types.
+ else
+ return
+ IntervalT((std::max)(left.lower(), right.lower(), IntervalT::domain_compare()),
+ (std::min)(left.upper(), right.upper(), IntervalT::domain_compare()));
+}
+
+template<class IntervalT>
+typename boost::enable_if<is_universal_interval<IntervalT>, IntervalT>::type
+operator & (IntervalT left, const IntervalT& right)
+{
+ return left &= right;
+}
+
+template<class IntervalT>
+typename boost::enable_if<has_dynamic_bounds<IntervalT>, IntervalT>::type
+operator & (IntervalT left, const IntervalT& right)
+{
+ if(itl::is_empty(left) || itl::is_empty(right))
+ return IntervalT(); //JODO return neutron<IntervalT>::value; neutron for new interval_types.
+ else
+ return construct
+ (
+ lower_max(left, right),
+ upper_min(left, right),
+ outer_bounds(left, right)
+ );
+}
+
+
+//- intersects -----------------------------------------------------------------
+template<class IntervalT>
+typename boost::enable_if<is_interval<IntervalT>, bool>::type
+intersects(const IntervalT& left, const IntervalT& right)
+{
+ return !(exclusive_less(left,right) || exclusive_less(right,left));
+}
+
+//- disjoint -------------------------------------------------------------------
+template<class IntervalT>
+typename boost::enable_if<is_interval<IntervalT>, bool>::type
+disjoint(const IntervalT& left, const IntervalT& right)
+{
+ return exclusive_less(left,right) || exclusive_less(right,left);
+}
+
+//------------------------------------------------------------------------------
+
+}} // namespace itl boost
+
+#endif
+
Modified: sandbox/itl/boost/itl/interval_map.hpp
==============================================================================
--- sandbox/itl/boost/itl/interval_map.hpp (original)
+++ sandbox/itl/boost/itl/interval_map.hpp 2010-04-01 06:41:20 EDT (Thu, 01 Apr 2010)
@@ -36,7 +36,7 @@
ITL_COMPARE Compare = ITL_COMPARE_INSTANCE(std::less, DomainT),
ITL_COMBINE Combine = ITL_COMBINE_INSTANCE(itl::inplace_plus, CodomainT),
ITL_SECTION Section = ITL_SECTION_INSTANCE(itl::inter_section, CodomainT),
- template<class,ITL_COMPARE>class Interval = itl::interval,
+ template<class,ITL_COMPARE>class Interval = ITL_INTERVAL_DEFAULT,
ITL_ALLOC Alloc = std::allocator
>
class interval_map:
@@ -141,7 +141,7 @@
private:
bool insertable(const value_type& value)const
{
- return !value.first.empty()
+ return !empty(value.first)
&& !(Traits::absorbs_neutrons && value.second == codomain_combine::neutron());
}
@@ -184,7 +184,7 @@
::joinable(const iterator& some, const iterator& next)const
{
// assert: next != end && some++ == next
- return some->first.touches(next->first)
+ return touches(some->first, next->first)
&& some->second == next->second;
}
@@ -200,7 +200,7 @@
interval_type right_interval = right_->first;
this->_map.erase(right_);
- const_cast<interval_type&>(left_->first).extend(right_interval);
+ const_cast<interval_type&>(left_->first) = hull(left_->first, right_interval);
return left_;
}
@@ -216,7 +216,7 @@
interval_type right_interval = right_->first;
this->_map.erase(right_);
- const_cast<interval_type&>(left_->first).extend(right_interval);
+ const_cast<interval_type&>(left_->first) = hull(left_->first, right_interval);
right_ = left_;
return right_;
@@ -268,7 +268,7 @@
::add_(const value_type& addend)
{
const interval_type& inter_val = addend.first;
- if(inter_val.empty())
+ if(itl::is_empty(inter_val))
return;
const CodomainT& co_val = addend.second;
@@ -304,7 +304,7 @@
::add_(iterator prior_, const value_type& addend)
{
const interval_type& inter_val = addend.first;
- if(inter_val.empty())
+ if(itl::is_empty(inter_val))
return prior_;
const CodomainT& co_val = addend.second;
@@ -345,11 +345,11 @@
// only for the first there can be a left_resid: a part of *first_ left of inter_val
interval_type left_resid = right_subtract(first_->first, inter_val);
- if(!left_resid.empty())
+ if(!itl::is_empty(left_resid))
{ // [------------ . . .
// [prior) [left_resid---first_ --- . . .
iterator prior_ = this->prior(first_);
- const_cast<interval_type&>(first_->first).left_subtract(left_resid);
+ const_cast<interval_type&>(first_->first) = left_subtract(first_->first, left_resid);
//NOTE: Only splitting
this->_map.insert(prior_, value_type(left_resid, first_->second));
}
@@ -371,7 +371,7 @@
cur_interval = it_->first ;
add_segment<Combiner>(x_rest, co_val, it_);
// shrink interval
- x_rest.left_subtract(cur_interval);
+ x_rest = left_subtract(x_rest, cur_interval);
}
}
@@ -382,7 +382,7 @@
::add_segment(const interval_type& inter_val, const CodomainT& co_val, iterator& it_)
{
interval_type lead_gap = right_subtract(inter_val, it_->first);
- if(!lead_gap.empty())
+ if(!itl::is_empty(lead_gap))
{
// [lead_gap--- . . .
// [-- it_ ...
@@ -415,7 +415,7 @@
interval_type cur_itv = it_->first ;
interval_type lead_gap = right_subtract(inter_val, cur_itv);
- if(!lead_gap.empty())
+ if(!itl::is_empty(lead_gap))
{ // [lead_gap--- . . .
// [prior) [-- it_ ...
iterator inserted_ = this->template gap_insert<Combiner>(prior_, lead_gap, co_val);
@@ -424,7 +424,7 @@
}
interval_type end_gap = left_subtract(inter_val, cur_itv);
- if(!end_gap.empty())
+ if(!itl::is_empty(end_gap))
{
// [----------------end_gap)
// . . . -- it_ --)
@@ -448,7 +448,7 @@
// only for the last there can be a right_resid: a part of *it_ right of x
interval_type right_resid = left_subtract(cur_itv, inter_val);
- if(right_resid.empty())
+ if(itl::is_empty(right_resid))
{
// [---------------)
// [-- it_ ---)
@@ -466,7 +466,7 @@
{
// [--------------)
// [-- it_ --right_resid)
- const_cast<interval_type&>(it_->first).right_subtract(right_resid);
+ const_cast<interval_type&>(it_->first) = right_subtract(it_->first, right_resid);
//NOTE: This is NOT an insertion that has to take care for correct application of
// the Combiner functor. It only reestablished that state after splitting the
@@ -498,7 +498,7 @@
{
interval_type inter_val = minuend.first;
- if(inter_val.empty())
+ if(itl::is_empty(inter_val))
return;
const CodomainT& co_val = minuend.second;
@@ -527,10 +527,10 @@
{
interval_type left_resid = right_subtract(it_->first, inter_val);
- if(!left_resid.empty())
+ if(!itl::is_empty(left_resid))
{
iterator prior_ = this->prior(it_);
- const_cast<interval_type&>(it_->first).left_subtract(left_resid);
+ const_cast<interval_type&>(it_->first) = left_subtract(it_->first, left_resid);
this->_map.insert(prior_, value_type(left_resid, it_->second));
}
}
@@ -563,7 +563,7 @@
{
interval_type right_resid = left_subtract(it_->first, inter_val);
- if(right_resid.empty())
+ if(itl::is_empty(right_resid))
{
CodomainT& cur_val = it_->second ;
Combiner()(cur_val, co_val);
@@ -574,7 +574,7 @@
}
else
{
- const_cast<interval_type&>(it_->first).right_subtract(right_resid);
+ const_cast<interval_type&>(it_->first) = right_subtract(it_->first, right_resid);
iterator next_ = this->_map.insert(it_, value_type(right_resid, it_->second));
Combiner()(it_->second, co_val);
if(Traits::absorbs_neutrons && it_->second==Combiner::neutron())
@@ -600,7 +600,7 @@
::insert_(const value_type& addend)
{
interval_type inter_val = addend.first;
- if(inter_val.empty())
+ if(itl::is_empty(inter_val))
return;
const CodomainT& co_val = addend.second;
@@ -629,7 +629,7 @@
::insert_(iterator prior_, const value_type& addend)
{
interval_type inter_val = addend.first;
- if(inter_val.empty())
+ if(itl::is_empty(inter_val))
return prior_;
const CodomainT& co_val = addend.second;
@@ -670,7 +670,7 @@
cur_itv = it_->first ;
left_gap = right_subtract(rest_interval, cur_itv);
- if(!left_gap.empty())
+ if(!itl::is_empty(left_gap))
{
inserted_ = this->_map.insert(prior_, value_type(left_gap, co_val));
join_left(inserted_);
@@ -679,14 +679,14 @@
}
// shrink interval
- rest_interval.left_subtract(cur_itv);
+ rest_interval = left_subtract(rest_interval, cur_itv);
prior_ = it_;
++it_;
}
//insert_rear(rest_interval, co_val, last_):
interval_type end_gap = left_subtract(rest_interval, last_interval);
- if(!end_gap.empty())
+ if(!itl::is_empty(end_gap))
{
inserted_ = this->_map.insert(prior_, value_type(end_gap, co_val));
it_ = join_neighbours(inserted_);
@@ -704,7 +704,7 @@
::erase_(const value_type& minuend)
{
interval_type inter_val = minuend.first;
- if(inter_val.empty())
+ if(itl::is_empty(inter_val))
return;
const CodomainT& co_val = minuend.second;
@@ -729,13 +729,13 @@
if(first_->second == co_val)
{
interval_type left_resid = right_subtract(first_->first, inter_val);
- if(!left_resid.empty())
+ if(!itl::is_empty(left_resid))
{
const_cast<interval_type&>(first_->first) = left_resid;
- if(!right_resid.empty())
+ if(!itl::is_empty(right_resid))
this->_map.insert(first_, value_type(right_resid, co_val));
}
- else if(!right_resid.empty())
+ else if(!itl::is_empty(right_resid))
const_cast<interval_type&>(first_->first) = right_resid;
else
this->_map.erase(first_);
@@ -747,7 +747,7 @@
if(first_->second == co_val)
{
interval_type left_resid = right_subtract(first_->first, inter_val);
- if(left_resid.empty())
+ if(itl::is_empty(left_resid))
this->_map.erase(first_);
else
const_cast<interval_type&>(first_->first) = left_resid;
@@ -773,7 +773,7 @@
if(it_->second == co_val)
{
interval_type right_resid = left_subtract(it_->first, inter_val);
- if(right_resid.empty())
+ if(itl::is_empty(right_resid))
this->_map.erase(it_);
else
const_cast<interval_type&>(it_->first) = right_resid;
Modified: sandbox/itl/boost/itl/interval_set.hpp
==============================================================================
--- sandbox/itl/boost/itl/interval_set.hpp (original)
+++ sandbox/itl/boost/itl/interval_set.hpp 2010-04-01 06:41:20 EDT (Thu, 01 Apr 2010)
@@ -10,6 +10,7 @@
#define BOOST_ITL_INTERVAL_SET_HPP_JOFA_990223
#include <boost/assert.hpp>
+#include <boost/itl/rightopen_interval.hpp> //JODO REV?
#include <boost/itl/interval_base_set.hpp>
#include <boost/itl/functions.hpp>
@@ -21,7 +22,7 @@
<
typename DomainT,
ITL_COMPARE Compare = ITL_COMPARE_INSTANCE(std::less, DomainT),
- template<class,ITL_COMPARE>class Interval = itl::interval,
+ template<class,ITL_COMPARE>class Interval = ITL_INTERVAL_DEFAULT,
ITL_ALLOC Alloc = std::allocator
>
class interval_set:
@@ -54,10 +55,10 @@
/// Comparison functor for domain values
typedef ITL_COMPARE_DOMAIN(Compare,DomainT) domain_compare;
/// Comparison functor for intervals
- typedef exclusive_less<interval_type> interval_compare;
+ typedef exclusive_less_than<interval_type> interval_compare;
/// Comparison functor for keys
- typedef exclusive_less<interval_type> key_compare;
+ typedef exclusive_less_than<interval_type> key_compare;
/// The allocator type of the set
typedef Alloc<interval_type> allocator_type;
@@ -164,7 +165,7 @@
if(it_ == this->_set.begin())
{
iterator it_nxt=it_; it_nxt++;
- if(it_nxt!=this->_set.end() && (*it_).touches(*it_nxt))
+ if(it_nxt!=this->_set.end() && touches(*it_, *it_nxt))
return join_on_left(it_, it_nxt);
}
else
@@ -172,7 +173,7 @@
// there is a predecessor
iterator pred_ = it_; pred_-- ;
- if((*pred_).touches(*it_))
+ if(touches(*pred_, *it_))
{
iterator it_extended = join_on_left(pred_, it_);
@@ -180,7 +181,7 @@
if(succ_!=this->_set.end())
{
// it's a non border element that might have two touching neighbours
- if((*it_extended).touches(*succ_))
+ if(touches(*it_extended, *succ_))
return join_on_left(it_extended, succ_);
else
return it_extended;
@@ -194,7 +195,7 @@
if(succ_!=this->_set.end())
{
// it's a non border element that might have a right touching neighbours
- if((*it_).touches(*succ_))
+ if(touches(*it_, *succ_))
return join_on_left(it_, succ_);
}
}
@@ -216,7 +217,7 @@
interval_type right_itv = (*right_);
this->_set.erase(right_);
- const_cast<value_type&>(*left_).extend(right_itv);
+ const_cast<value_type&>(*left_) = hull(*left_, right_itv);
return left_;
}
@@ -225,7 +226,7 @@
template<class DomainT, ITL_COMPARE Compare, template<class,ITL_COMPARE>class Interval, ITL_ALLOC Alloc>
void interval_set<DomainT,Compare,Interval,Alloc>::add_(const value_type& addend)
{
- if(addend.empty()) return;
+ if(itl::is_empty(addend)) return;
std::pair<iterator,bool> insertion = this->_set.insert(addend);
@@ -239,15 +240,12 @@
//BOOST_ASSERT(end_ == this->_map.upper_bound(inter_val));
iterator second_= first_; ++second_;
- interval_type leftResid = right_subtract(*first_, addend);
- interval_type rightResid = left_subtract(*last_ , addend);
+ interval_type left_resid = right_subtract(*first_, addend);
+ interval_type right_resid = left_subtract(*last_ , addend);
this->_set.erase(second_, end_ );
- interval_type extended = addend;
- extended.extend(leftResid).extend(rightResid);
-
- const_cast<value_type&>(*first_) = extended;
+ const_cast<value_type&>(*first_) = hull(hull(left_resid, addend), right_resid);
handle_neighbours(first_);
}
}
@@ -256,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(addend.empty())
+ if(itl::is_empty(addend))
return prior_;
iterator insertion = this->_set.insert(prior_, addend);
@@ -272,15 +270,13 @@
iterator second_= first_; ++second_;
- interval_type leftResid = right_subtract(*first_, addend);
- interval_type rightResid = left_subtract(*last_ , addend);
+ //JODO code replication here: search hull(hull
+ interval_type left_resid = right_subtract(*first_, addend);
+ interval_type right_resid = left_subtract(*last_ , addend);
this->_set.erase(second_, end_);
- interval_type extended = addend;
- extended.extend(leftResid).extend(rightResid);
-
- const_cast<value_type&>(*first_) = extended;
+ const_cast<value_type&>(*first_) = hull(hull(left_resid, addend), right_resid);
return handle_neighbours(first_);
}
}
@@ -288,7 +284,7 @@
template<class DomainT, ITL_COMPARE Compare, template<class,ITL_COMPARE>class Interval, ITL_ALLOC Alloc>
void interval_set<DomainT,Compare,Interval,Alloc>::subtract_(const value_type& minuend)
{
- if(minuend.empty()) return;
+ if(itl::is_empty(minuend)) return;
iterator first_ = this->_set.lower_bound(minuend);
if(first_==this->_set.end()) return;
iterator end_ = this->_set.upper_bound(minuend);
@@ -301,10 +297,10 @@
this->_set.erase(first_, end_ );
- if(!leftResid.empty())
+ if(!itl::is_empty(leftResid))
this->_set.insert(leftResid);
- if(!rightResid.empty())
+ if(!itl::is_empty(rightResid))
this->_set.insert(rightResid);
}
Modified: sandbox/itl/boost/itl/predicates.hpp
==============================================================================
--- sandbox/itl/boost/itl/predicates.hpp (original)
+++ sandbox/itl/boost/itl/predicates.hpp 2010-04-01 06:41:20 EDT (Thu, 01 Apr 2010)
@@ -35,12 +35,13 @@
bool(Type::* m_pred)()const;
} ;
- template <class Type>
- class empty: public property<Type>
- {
- public:
- bool operator() (const Type& x)const { return x.empty(); }
- } ;
+ //JODO this clashes with function template itl::empty(IntervalT)
+ //template <class Type>
+ //class empty: public property<Type>
+ //{
+ //public:
+ // bool operator() (const Type& x)const { return x.empty(); }
+ //} ;
template <class Type>
struct is_neutron: public property<Type>
Added: sandbox/itl/boost/itl/rightopen_interval.hpp
==============================================================================
--- (empty file)
+++ sandbox/itl/boost/itl/rightopen_interval.hpp 2010-04-01 06:41:20 EDT (Thu, 01 Apr 2010)
@@ -0,0 +1,137 @@
+/*-----------------------------------------------------------------------------+
+Copyright (c) 2010-2010: Joachim Faulhaber
++------------------------------------------------------------------------------+
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENCE.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
++-----------------------------------------------------------------------------*/
+#ifndef BOOST_ITL_RIGHTOPEN_INTERVAL_HPP_JOFA_100323
+#define BOOST_ITL_RIGHTOPEN_INTERVAL_HPP_JOFA_100323
+
+#include <boost/itl/type_traits/value_size.hpp>
+#include <boost/itl/type_traits/type_to_string.hpp>
+#include <boost/itl/detail/base_interval.hpp>
+#include <boost/itl/interval_functions.hpp>
+
+namespace boost{namespace itl
+{
+
+template <class DomainT,
+ ITL_COMPARE Compare = ITL_COMPARE_INSTANCE(std::less, DomainT)>
+class rightopen_interval : public base_interval<DomainT,Compare>
+{
+public:
+ typedef rightopen_interval<DomainT,Compare> type;
+ typedef DomainT domain_type;
+
+public:
+ //==========================================================================
+ //= Construct, copy, destruct
+ //==========================================================================
+ /** Default constructor; yields an empty interval <tt>[0,0)</tt>. */
+ rightopen_interval()
+ : _lwb(neutron<DomainT>::value()), _upb(neutron<DomainT>::value())
+ {
+ BOOST_CONCEPT_ASSERT((DefaultConstructibleConcept<DomainT>));
+ BOOST_CONCEPT_ASSERT((LessThanComparableConcept<DomainT>));
+ }
+
+ //NOTE: Compiler generated copy constructor is used
+
+ /** Constructor for a closed singleton interval <tt>[val,val]</tt> */
+ explicit rightopen_interval(const DomainT& val)
+ : _lwb(val), _upb(succ(val))
+ {
+ BOOST_CONCEPT_ASSERT((DefaultConstructibleConcept<DomainT>));
+ BOOST_CONCEPT_ASSERT((LessThanComparableConcept<DomainT>));
+ BOOST_STATIC_ASSERT((!itl::is_continuous<DomainT>::value));
+ }
+
+ /** Interval from <tt>low</tt> to <tt>up</tt> with bounds <tt>bounds</tt> */
+ rightopen_interval(const DomainT& low, const DomainT& up) :
+ _lwb(low), _upb(up)
+ {
+ BOOST_CONCEPT_ASSERT((DefaultConstructibleConcept<DomainT>));
+ BOOST_CONCEPT_ASSERT((LessThanComparableConcept<DomainT>));
+ }
+
+ domain_type lower()const{ return _lwb; }
+ domain_type upper()const{ return _upb; }
+
+ domain_type first()const{ return _lwb; }
+
+ DomainT last()const
+ {
+ BOOST_STATIC_ASSERT((!itl::is_continuous<DomainT>::value));
+ return pred(_upb);
+ }
+
+private:
+ domain_type _lwb;
+ domain_type _upb;
+};
+
+
+template<class CharType, class CharTraits, class DomainT, ITL_COMPARE Compare>
+std::basic_ostream<CharType, CharTraits>& operator <<
+ (std::basic_ostream<CharType, CharTraits> &stream,
+ rightopen_interval<DomainT,Compare> const& object)
+{
+ if(itl::is_empty(object))
+ return stream << "[)";
+ else
+ return stream << "[" << object.lower() << "," << object.upper()<< ")";
+}
+
+
+//==============================================================================
+//= Type traits
+//==============================================================================
+template <class DomainT, ITL_COMPARE Compare>
+struct is_interval<rightopen_interval<DomainT,Compare> >
+{
+ typedef is_interval<rightopen_interval<DomainT,Compare> > type;
+ BOOST_STATIC_CONSTANT(bool, value = true);
+};
+
+template <class DomainT, ITL_COMPARE Compare>
+struct has_static_bounds<rightopen_interval<DomainT,Compare> >
+{
+ typedef has_static_bounds<rightopen_interval<DomainT,Compare> > type;
+ BOOST_STATIC_CONSTANT(bool, value = true);
+};
+
+template <class DomainT, ITL_COMPARE Compare>
+struct has_asymmetric_bounds<rightopen_interval<DomainT,Compare> >
+{
+ typedef has_asymmetric_bounds<rightopen_interval<DomainT,Compare> > type;
+ BOOST_STATIC_CONSTANT(bool, value = true);
+};
+
+/*CL?
+template <class DomainT, ITL_COMPARE Compare>
+struct has_domain<rightopen_interval<DomainT,Compare> >
+{
+ typedef has_domain<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> >
+{
+ static std::string apply()
+ { return "[I)<"+ type_to_string<DomainT>::apply() +">"; }
+};
+
+template<class DomainT>
+struct value_size<itl::rightopen_interval<DomainT> >
+{
+ static std::size_t apply(const itl::rightopen_interval<DomainT>& value)
+ { return 2; }
+};
+
+}} // namespace itl boost
+
+#endif
+
Modified: sandbox/itl/boost/itl/separate_interval_set.hpp
==============================================================================
--- sandbox/itl/boost/itl/separate_interval_set.hpp (original)
+++ sandbox/itl/boost/itl/separate_interval_set.hpp 2010-04-01 06:41:20 EDT (Thu, 01 Apr 2010)
@@ -20,7 +20,7 @@
<
typename DomainT,
ITL_COMPARE Compare = ITL_COMPARE_INSTANCE(std::less, DomainT),
- template<class,ITL_COMPARE>class Interval = itl::interval,
+ template<class,ITL_COMPARE>class Interval = ITL_INTERVAL_DEFAULT,
ITL_ALLOC Alloc = std::allocator
>
class separate_interval_set:
@@ -51,10 +51,10 @@
/// Comparison functor for domain values
typedef ITL_COMPARE_DOMAIN(Compare,DomainT) domain_compare;
/// Comparison functor for intervals
- typedef exclusive_less<interval_type> interval_compare;
+ typedef exclusive_less_than<interval_type> interval_compare;
/// Comparison functor for keys
- typedef exclusive_less<interval_type> key_compare;
+ typedef exclusive_less_than<interval_type> key_compare;
/// The allocator type of the set
typedef Alloc<interval_type> allocator_type;
@@ -146,7 +146,7 @@
template<class DomainT, ITL_COMPARE Compare, template<class,ITL_COMPARE>class Interval, ITL_ALLOC Alloc>
inline void separate_interval_set<DomainT,Compare,Interval,Alloc>::add_(const value_type& addend)
{
- if(addend.empty()) return;
+ if(itl::is_empty(addend)) return;
std::pair<iterator,bool> insertion = this->_set.insert(addend);
@@ -160,15 +160,13 @@
//BOOST_ASSERT(end_ == this->_map.upper_bound(inter_val));
iterator second_= first_; ++second_;
- interval_type leftResid = right_subtract(*first_, addend);
- interval_type rightResid = left_subtract(*last_ , addend);
+ //JODO code replication here: search hull(hull
+ interval_type left_resid = right_subtract(*first_, addend);
+ interval_type right_resid = left_subtract(*last_ , addend);
- this->_set.erase(second_, end_ );
-
- interval_type extended = addend;
- extended.extend(leftResid).extend(rightResid);
+ this->_set.erase(second_, end_);
- const_cast<value_type&>(*first_) = extended;
+ const_cast<value_type&>(*first_) = hull(hull(left_resid, addend), right_resid);
}
}
@@ -176,7 +174,7 @@
typename separate_interval_set<DomainT,Compare,Interval,Alloc>::iterator
separate_interval_set<DomainT,Compare,Interval,Alloc>::add_(iterator prior_, const value_type& addend)
{
- if(addend.empty())
+ if(itl::is_empty(addend))
return prior_;
iterator insertion = this->_set.insert(prior_, addend);
@@ -192,15 +190,13 @@
iterator second_= first_; ++second_;
- interval_type leftResid = right_subtract(*first_, addend);
- interval_type rightResid = left_subtract(*last_ , addend);
+ //JODO code replication here: search hull(hull
+ interval_type left_resid = right_subtract(*first_, addend);
+ interval_type right_resid = left_subtract(*last_ , addend);
this->_set.erase(second_, end_);
- interval_type extended = addend;
- extended.extend(leftResid).extend(rightResid);
-
- const_cast<value_type&>(*first_) = extended;
+ const_cast<value_type&>(*first_) = hull(hull(left_resid, addend), right_resid);
return first_;
}
}
@@ -209,7 +205,7 @@
template<class DomainT, ITL_COMPARE Compare, template<class,ITL_COMPARE>class Interval, ITL_ALLOC Alloc>
inline void separate_interval_set<DomainT,Compare,Interval,Alloc>::subtract_(const value_type& minuend)
{
- if(minuend.empty()) return;
+ if(itl::is_empty(minuend)) return;
iterator first_ = this->_set.lower_bound(minuend);
if(first_==this->_set.end()) return;
iterator end_ = this->_set.upper_bound(minuend);
@@ -223,10 +219,10 @@
this->_set.erase(first_, end_ );
- if(!leftResid.empty())
+ if(!itl::is_empty(leftResid))
this->_set.insert(leftResid);
- if(!rightResid.empty())
+ if(!itl::is_empty(rightResid))
this->_set.insert(rightResid);
}
Modified: sandbox/itl/boost/itl/split_interval_map.hpp
==============================================================================
--- sandbox/itl/boost/itl/split_interval_map.hpp (original)
+++ sandbox/itl/boost/itl/split_interval_map.hpp 2010-04-01 06:41:20 EDT (Thu, 01 Apr 2010)
@@ -32,7 +32,7 @@
ITL_COMPARE Compare = ITL_COMPARE_INSTANCE(std::less, DomainT),
ITL_COMBINE Combine = ITL_COMBINE_INSTANCE(itl::inplace_plus, CodomainT),
ITL_SECTION Section = ITL_SECTION_INSTANCE(itl::inter_section, CodomainT),
- template<class,ITL_COMPARE>class Interval = itl::interval,
+ template<class,ITL_COMPARE>class Interval = ITL_INTERVAL_DEFAULT,
ITL_ALLOC Alloc = std::allocator
>
class split_interval_map:
@@ -170,7 +170,7 @@
::add_(const value_type& addend)
{
interval_type inter_val = addend.first;
- if(inter_val.empty())
+ if(itl::is_empty(inter_val))
return;
const CodomainT& co_val = addend.second;
@@ -203,7 +203,7 @@
::add_(iterator prior_, const value_type& addend)
{
interval_type inter_val = addend.first;
- if(inter_val.empty())
+ if(itl::is_empty(inter_val))
return prior_;
const CodomainT& co_val = addend.second;
@@ -244,11 +244,11 @@
// only for the first there can be a left_resid: a part of *first_ left of inter_val
interval_type left_resid = right_subtract(first_->first, inter_val);
- if(!left_resid.empty())
+ if(!itl::is_empty(left_resid))
{ // [------------ . . .
// [left_resid---first_ --- . . .
iterator prior_ = this->prior(first_);
- const_cast<interval_type&>(first_->first).left_subtract(left_resid);
+ const_cast<interval_type&>(first_->first) = left_subtract(first_->first, left_resid);
//NOTE: Only splitting
iterator insertion_ = this->_map.insert(prior_, value_type(left_resid, first_->second));
}
@@ -270,7 +270,7 @@
cur_interval = it_->first ;
add_segment<Combiner>(x_rest, co_val, it_);
// shrink interval
- x_rest.left_subtract(cur_interval);
+ x_rest = left_subtract(x_rest, cur_interval);
}
}
@@ -281,7 +281,7 @@
::add_segment(const interval_type& inter_val, const CodomainT& co_val, iterator& it_)
{
interval_type lead_gap = right_subtract(inter_val, it_->first);
- if(!lead_gap.empty())
+ if(!itl::is_empty(lead_gap))
// [lead_gap--- . . .
// [prior_) [-- it_ ...
this->template gap_insert<Combiner>(prior(it_), lead_gap, co_val);
@@ -306,14 +306,14 @@
interval_type cur_itv = (*it_).first ;
interval_type lead_gap = right_subtract(inter_val, cur_itv);
- if(!lead_gap.empty())
+ if(!itl::is_empty(lead_gap))
// [lead_gap--- . . .
// [prior_) [-- it_ ...
this->template gap_insert<Combiner>(prior_, lead_gap, co_val);
interval_type end_gap = left_subtract(inter_val, cur_itv);
- if(!end_gap.empty())
+ if(!itl::is_empty(end_gap))
{
// [---------------end_gap)
// [-- it_ --)
@@ -332,7 +332,7 @@
// only for the last there can be a right_resid: a part of *it_ right of addend
interval_type right_resid = left_subtract(cur_itv, inter_val);
- if(right_resid.empty())
+ if(itl::is_empty(right_resid))
{
// [---------------)
// [-- it_ ---)
@@ -348,7 +348,7 @@
{
// [--------------)
// [-- it_ --right_resid)
- const_cast<interval_type&>(it_->first).right_subtract(right_resid);
+ const_cast<interval_type&>(it_->first) = right_subtract(it_->first, right_resid);
//NOTE: This is NOT an insertion that has to take care for correct application of
// the Combiner functor. It only reestablished that state after splitting the
@@ -378,7 +378,7 @@
{
interval_type inter_val = minuend.first;
- if(inter_val.empty())
+ if(itl::is_empty(inter_val))
return;
const CodomainT& co_val = minuend.second;
@@ -406,12 +406,12 @@
{
interval_type left_resid = right_subtract(it_->first, inter_val);
- if(!left_resid.empty())
+ if(!itl::is_empty(left_resid))
{
iterator prior_ = it_;
if(prior_ != this->_map.begin())
--prior_;
- const_cast<interval_type&>(it_->first).left_subtract(left_resid);
+ const_cast<interval_type&>(it_->first) = left_subtract(it_->first, left_resid);
this->_map.insert(prior_, value_type(left_resid, it_->second));
}
}
@@ -439,7 +439,7 @@
{
interval_type right_resid = left_subtract(it_->first, inter_val);
- if(right_resid.empty())
+ if(itl::is_empty(right_resid))
{
CodomainT& cur_val = it_->second ;
Combiner()(cur_val, co_val);
@@ -449,7 +449,7 @@
else
{ // . . . ---)
// . . . ---right_resid) : split it_
- const_cast<interval_type&>(it_->first).right_subtract(right_resid);
+ const_cast<interval_type&>(it_->first) = right_subtract(it_->first, right_resid);
iterator next_ = this->_map.insert(it_, value_type(right_resid, it_->second));
Combiner()(it_->second, co_val);
if(Traits::absorbs_neutrons && it_->second==Combiner::neutron())
@@ -467,7 +467,7 @@
::insert_(const value_type& addend)
{
interval_type inter_val = addend.first;
- if(inter_val.empty())
+ if(itl::is_empty(inter_val))
return;
const CodomainT& co_val = addend.second;
@@ -494,7 +494,7 @@
::insert_(iterator prior_, const value_type& addend)
{
interval_type inter_val = addend.first;
- if(inter_val.empty())
+ if(itl::is_empty(inter_val))
return prior_;
const CodomainT& co_val = addend.second;
@@ -535,18 +535,18 @@
cur_itv = it_->first ;
left_gap = right_subtract(rest_interval, cur_itv);
- if(!left_gap.empty())
+ if(!itl::is_empty(left_gap))
inserted_ = this->_map.insert(prior_, value_type(left_gap, co_val));
// shrink interval
- rest_interval.left_subtract(cur_itv);
+ rest_interval = left_subtract(rest_interval, cur_itv);
prior_ = it_;
++it_;
}
//insert_rear(rest_interval, co_val, last_):
interval_type end_gap = left_subtract(rest_interval, last_interval);
- if(!end_gap.empty())
+ if(!itl::is_empty(end_gap))
it_ = this->_map.insert(prior_, value_type(end_gap, co_val));
else
it_ = prior_;
@@ -562,7 +562,7 @@
::erase_(const value_type& minuend)
{
interval_type inter_val = minuend.first;
- if(inter_val.empty())
+ if(itl::is_empty(inter_val))
return;
const CodomainT& co_val = minuend.second;
@@ -587,13 +587,13 @@
if(first_->second == co_val)
{
interval_type left_resid = right_subtract(first_->first, inter_val);
- if(!left_resid.empty())
+ if(!itl::is_empty(left_resid))
{
const_cast<interval_type&>(first_->first) = left_resid;
- if(!right_resid.empty())
+ if(!itl::is_empty(right_resid))
this->_map.insert(first_, value_type(right_resid, co_val));
}
- else if(!right_resid.empty())
+ else if(!itl::is_empty(right_resid))
const_cast<interval_type&>(first_->first) = right_resid;
else
this->_map.erase(first_);
@@ -605,7 +605,7 @@
if(first_->second == co_val)
{
interval_type left_resid = right_subtract(first_->first, inter_val);
- if(left_resid.empty())
+ if(itl::is_empty(left_resid))
this->_map.erase(first_);
else
const_cast<interval_type&>(first_->first) = left_resid;
@@ -631,7 +631,7 @@
if(it_->second == co_val)
{
interval_type right_resid = left_subtract(it_->first, inter_val);
- if(right_resid.empty())
+ if(itl::is_empty(right_resid))
this->_map.erase(it_);
else
const_cast<interval_type&>(it_->first) = right_resid;
Modified: sandbox/itl/boost/itl/split_interval_set.hpp
==============================================================================
--- sandbox/itl/boost/itl/split_interval_set.hpp (original)
+++ sandbox/itl/boost/itl/split_interval_set.hpp 2010-04-01 06:41:20 EDT (Thu, 01 Apr 2010)
@@ -21,7 +21,7 @@
<
typename DomainT,
ITL_COMPARE Compare = ITL_COMPARE_INSTANCE(std::less, DomainT),
- template<class,ITL_COMPARE>class Interval = itl::interval,
+ template<class,ITL_COMPARE>class Interval = ITL_INTERVAL_DEFAULT,
ITL_ALLOC Alloc = std::allocator
>
class split_interval_set:
@@ -50,10 +50,10 @@
/// Comparison functor for domain values
typedef ITL_COMPARE_DOMAIN(Compare,DomainT) domain_compare;
/// Comparison functor for intervals
- typedef exclusive_less<interval_type> interval_compare;
+ typedef exclusive_less_than<interval_type> interval_compare;
/// Comparison functor for keys
- typedef exclusive_less<interval_type> key_compare;
+ typedef exclusive_less_than<interval_type> key_compare;
/// The allocator type of the set
typedef Alloc<interval_type> allocator_type;
@@ -147,7 +147,7 @@
template <typename DomainT, ITL_COMPARE Compare, template<class,ITL_COMPARE>class Interval, ITL_ALLOC Alloc>
inline void split_interval_set<DomainT,Compare,Interval,Alloc>::add_(const value_type& addend)
{
- if(addend.empty()) return;
+ if(itl::is_empty(addend)) return;
std::pair<iterator,bool> insertion = this->_set.insert(addend);
@@ -171,7 +171,7 @@
inline typename split_interval_set<DomainT,Compare,Interval,Alloc>::iterator
split_interval_set<DomainT,Compare,Interval,Alloc>::add_(iterator prior_, const value_type& addend)
{
- if(addend.empty())
+ if(itl::is_empty(addend))
return prior_;
iterator insertion = this->_set.insert(prior_, addend);
@@ -208,11 +208,11 @@
// only for the first there can be a left_resid: a part of *first_ left of inter_val
interval_type left_resid = right_subtract(*first_, inter_val);
- if(!left_resid.empty())
+ if(!itl::is_empty(left_resid))
{ // [------------ . . .
// [left_resid---first_ --- . . .
iterator prior_ = this->prior(first_);
- const_cast<interval_type&>(*first_).left_subtract(left_resid);
+ const_cast<interval_type&>(*first_) = left_subtract(*first_, left_resid);
//NOTE: Only splitting
iterator insertion_ = this->_set.insert(prior_, left_resid);
}
@@ -233,7 +233,7 @@
cur_interval = *it_ ;
add_segment(x_rest, it_);
// shrink interval
- x_rest.left_subtract(cur_interval);
+ x_rest = left_subtract(x_rest, cur_interval);
}
}
@@ -243,7 +243,7 @@
::add_segment(const interval_type& inter_val, iterator& it_)
{
interval_type lead_gap = right_subtract(inter_val, *it_);
- if(!lead_gap.empty())
+ if(!itl::is_empty(lead_gap))
// [lead_gap--- . . .
// [prior_) [-- it_ ...
this->_set.insert(prior(it_), lead_gap);
@@ -262,13 +262,13 @@
interval_type cur_itv = *it_;
interval_type lead_gap = right_subtract(inter_val, cur_itv);
- if(!lead_gap.empty())
+ if(!itl::is_empty(lead_gap))
// [lead_gap--- . . .
// [prior_) [-- it_ ...
this->_set.insert(prior_, lead_gap);
interval_type end_gap = left_subtract(inter_val, cur_itv);
- if(!end_gap.empty())
+ if(!itl::is_empty(end_gap))
// [---------------end_gap)
// [-- it_ --)
it_ = this->_set.insert(it_, end_gap);
@@ -277,11 +277,11 @@
// only for the last there can be a right_resid: a part of *it_ right of addend
interval_type right_resid = left_subtract(cur_itv, inter_val);
- if(!right_resid.empty())
+ if(!itl::is_empty(right_resid))
{
// [--------------)
// [-- it_ --right_resid)
- const_cast<interval_type&>(*it_).right_subtract(right_resid);
+ const_cast<interval_type&>(*it_) = right_subtract(*it_, right_resid);
it_ = this->_set.insert(it_, right_resid);
}
}
@@ -291,7 +291,7 @@
template<class DomainT, ITL_COMPARE Compare, template<class,ITL_COMPARE>class Interval, ITL_ALLOC Alloc>
inline void split_interval_set<DomainT,Compare,Interval,Alloc>::subtract_(const value_type& minuend)
{
- if(minuend.empty()) return;
+ if(itl::is_empty(minuend)) return;
iterator first_ = this->_set.lower_bound(minuend);
if(first_==this->_set.end()) return;
iterator end_ = this->_set.upper_bound(minuend);
@@ -305,10 +305,10 @@
this->_set.erase(first_, end_ );
- if(!leftResid.empty())
+ if(!itl::is_empty(leftResid))
this->_set.insert(leftResid);
- if(!rightResid.empty())
+ if(!itl::is_empty(rightResid))
this->_set.insert(rightResid);
}
Added: sandbox/itl/boost/itl/type_traits/has_dynamic_bounds.hpp
==============================================================================
--- (empty file)
+++ sandbox/itl/boost/itl/type_traits/has_dynamic_bounds.hpp 2010-04-01 06:41:20 EDT (Thu, 01 Apr 2010)
@@ -0,0 +1,26 @@
+/*-----------------------------------------------------------------------------+
+Copyright (c) 2010-2010: Joachim Faulhaber
++------------------------------------------------------------------------------+
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENCE.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
++-----------------------------------------------------------------------------*/
+#ifndef BOOST_ITL_TYPE_TRAITS_HAS_DYNAMIC_BOUNDS_HPP_JOFA_100327
+#define BOOST_ITL_TYPE_TRAITS_HAS_DYNAMIC_BOUNDS_HPP_JOFA_100327
+
+#include <boost/itl/type_traits/is_interval.hpp>
+
+namespace boost{ namespace itl
+{
+
+template <class Type> struct has_dynamic_bounds
+{
+ typedef has_dynamic_bounds<Type> type;
+ BOOST_STATIC_CONSTANT(bool, value = false);
+};
+
+}} // namespace boost itl
+
+#endif
+
+
Added: sandbox/itl/boost/itl/type_traits/is_asymmetric_interval.hpp
==============================================================================
--- (empty file)
+++ sandbox/itl/boost/itl/type_traits/is_asymmetric_interval.hpp 2010-04-01 06:41:20 EDT (Thu, 01 Apr 2010)
@@ -0,0 +1,33 @@
+/*-----------------------------------------------------------------------------+
+Copyright (c) 2010-2010: Joachim Faulhaber
++------------------------------------------------------------------------------+
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENCE.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
++-----------------------------------------------------------------------------*/
+#ifndef BOOST_ITL_TYPE_TRAITS_IS_ASYMMETRIC_INTERVAL_HPP_JOFA_100327
+#define BOOST_ITL_TYPE_TRAITS_IS_ASYMMETRIC_INTERVAL_HPP_JOFA_100327
+
+#include <boost/itl/type_traits/is_interval.hpp>
+
+namespace boost{ namespace itl
+{
+
+template <class Type> struct is_asymmetric_interval
+{
+ typedef is_asymmetric_interval<Type> type;
+ BOOST_STATIC_CONSTANT(bool,
+ value = (type_traits::ice_and
+ <
+ is_interval<Type>::value
+ , has_static_bounds<Type>::value
+ , has_asymmetric_bounds<Type>::value
+ >::value)
+ );
+};
+
+}} // namespace boost itl
+
+#endif
+
+
Modified: sandbox/itl/boost/itl/type_traits/is_continuous.hpp
==============================================================================
--- sandbox/itl/boost/itl/type_traits/is_continuous.hpp (original)
+++ sandbox/itl/boost/itl/type_traits/is_continuous.hpp 2010-04-01 06:41:20 EDT (Thu, 01 Apr 2010)
@@ -9,7 +9,7 @@
#define BOOST_ITL_TYPE_TRAITS_IS_CONTINUOUS_HPP_JOFA_080910
#include <string>
-#include <boost/config.hpp>
+#include <boost/mpl/and.hpp>
namespace boost{ namespace itl
{
@@ -39,14 +39,18 @@
BOOST_STATIC_CONSTANT(bool, value = true);
};
-
template <class Type> struct is_continuous
{
typedef is_continuous<Type> type;
- BOOST_STATIC_CONSTANT(bool, value = false);
+ BOOST_STATIC_CONSTANT(bool, value = false);
+ //JODO Meta Fortsetzung des Praedikats auf interval<Type> etc.
+ // so nicht, vielleicht anders? Meta lambda?
+ //value = (mpl::and_<has_domain<Type>::value,
+ // is_continuous<typename Type::domain_type>
+ // >::value
+ // ));
};
-
}} // namespace boost itl
#endif
Added: sandbox/itl/boost/itl/type_traits/is_continuous_interval.hpp
==============================================================================
--- (empty file)
+++ sandbox/itl/boost/itl/type_traits/is_continuous_interval.hpp 2010-04-01 06:41:20 EDT (Thu, 01 Apr 2010)
@@ -0,0 +1,26 @@
+/*-----------------------------------------------------------------------------+
+Copyright (c) 2010-2010: Joachim Faulhaber
++------------------------------------------------------------------------------+
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENCE.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
++-----------------------------------------------------------------------------*/
+#ifndef BOOST_ITL_TYPE_TRAITS_IS_CONTINUOUS_INTERVAL_HPP_JOFA_100331
+#define BOOST_ITL_TYPE_TRAITS_IS_CONTINUOUS_INTERVAL_HPP_JOFA_100331
+
+#include <boost/itl/type_traits/is_interval.hpp>
+
+namespace boost{ namespace itl
+{
+
+template <class Type> struct is_continuous_interval
+{
+ typedef is_continuous_interval<Type> type;
+ BOOST_STATIC_CONSTANT(bool, value = false);
+};
+
+}} // namespace boost itl
+
+#endif
+
+
Added: sandbox/itl/boost/itl/type_traits/is_discrete_interval.hpp
==============================================================================
--- (empty file)
+++ sandbox/itl/boost/itl/type_traits/is_discrete_interval.hpp 2010-04-01 06:41:20 EDT (Thu, 01 Apr 2010)
@@ -0,0 +1,26 @@
+/*-----------------------------------------------------------------------------+
+Copyright (c) 2010-2010: Joachim Faulhaber
++------------------------------------------------------------------------------+
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENCE.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
++-----------------------------------------------------------------------------*/
+#ifndef BOOST_ITL_TYPE_TRAITS_IS_DISCRETE_INTERVAL_HPP_JOFA_100327
+#define BOOST_ITL_TYPE_TRAITS_IS_DISCRETE_INTERVAL_HPP_JOFA_100327
+
+#include <boost/itl/type_traits/is_interval.hpp>
+
+namespace boost{ namespace itl
+{
+
+template <class Type> struct is_discrete_interval
+{
+ typedef is_discrete_interval<Type> type;
+ BOOST_STATIC_CONSTANT(bool, value = false);
+};
+
+}} // namespace boost itl
+
+#endif
+
+
Added: sandbox/itl/boost/itl/type_traits/is_interval.hpp
==============================================================================
--- (empty file)
+++ sandbox/itl/boost/itl/type_traits/is_interval.hpp 2010-04-01 06:41:20 EDT (Thu, 01 Apr 2010)
@@ -0,0 +1,37 @@
+/*-----------------------------------------------------------------------------+
+Copyright (c) 2010-2010: Joachim Faulhaber
++------------------------------------------------------------------------------+
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENCE.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
++-----------------------------------------------------------------------------*/
+#ifndef BOOST_ITL_TYPE_TRAITS_IS_INTERVAL_HPP_JOFA_100327
+#define BOOST_ITL_TYPE_TRAITS_IS_INTERVAL_HPP_JOFA_100327
+
+namespace boost{ namespace itl
+{
+
+template <class Type> struct is_interval
+{
+ typedef is_interval<Type> type;
+ BOOST_STATIC_CONSTANT(bool, value = false);
+};
+
+//JODO separate. Consider introducing interval_trais.
+template <class Type> struct has_static_bounds
+{
+ typedef has_static_bounds<Type> type;
+ BOOST_STATIC_CONSTANT(bool, value = false);
+};
+
+template <class Type> struct has_asymmetric_bounds
+{
+ typedef has_asymmetric_bounds<Type> type;
+ BOOST_STATIC_CONSTANT(bool, value = false);
+};
+
+}} // namespace boost itl
+
+#endif
+
+
Added: sandbox/itl/boost/itl/type_traits/is_universal_interval.hpp
==============================================================================
--- (empty file)
+++ sandbox/itl/boost/itl/type_traits/is_universal_interval.hpp 2010-04-01 06:41:20 EDT (Thu, 01 Apr 2010)
@@ -0,0 +1,26 @@
+/*-----------------------------------------------------------------------------+
+Copyright (c) 2010-2010: Joachim Faulhaber
++------------------------------------------------------------------------------+
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENCE.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
++-----------------------------------------------------------------------------*/
+#ifndef BOOST_ITL_TYPE_TRAITS_IS_UNIVERSAL_INTERVAL_HPP_JOFA_100327
+#define BOOST_ITL_TYPE_TRAITS_IS_UNIVERSAL_INTERVAL_HPP_JOFA_100327
+
+#include <boost/itl/type_traits/is_interval.hpp>
+
+namespace boost{ namespace itl
+{
+
+template <class Type> struct is_universal_interval
+{
+ typedef is_universal_interval<Type> type;
+ BOOST_STATIC_CONSTANT(bool, value = false);
+};
+
+}} // namespace boost itl
+
+#endif
+
+
Modified: sandbox/itl/boost/itl_xt/itvgentor.hpp
==============================================================================
--- sandbox/itl/boost/itl_xt/itvgentor.hpp (original)
+++ sandbox/itl/boost/itl_xt/itvgentor.hpp 2010-04-01 06:41:20 EDT (Thu, 01 Apr 2010)
@@ -76,16 +76,19 @@
if(decideEmpty==0)
{
ItvDomTV x2 = m_ItvDomTVGentor(m_valueRange);
- x.set(x1, x1-x2, bndTypes); //JODO this should be done smarter
+ //CL x.set(x1, x1-x2, bndTypes); //JODO this should be done smarter
+ x = construct<ItvTV>(x1, x1-x2, bndTypes);
}
else if(upOrDown==0) {
ItvDomTV up
= m_ItvDomTVGentor(x1, static_cast<ItvDomTV>(std::min(m_valueRange.upper(), x1+m_maxIntervalLength)));
- x.set(x1, up, bndTypes);
+ //CL x.set(x1, up, bndTypes);
+ x = construct<ItvTV>(x1, up, bndTypes);
} else {
ItvDomTV low
= m_ItvDomTVGentor(static_cast<ItvDomTV>(std::max(m_valueRange.lower(), x1-m_maxIntervalLength)), x1);
- x.set(low, x1, bndTypes);
+ //CL x.set(low, x1, bndTypes);
+ x = construct<ItvTV>(low, x1, bndTypes);
}
};
Modified: sandbox/itl/boost/itl_xt/map_segment_gentor.hpp
==============================================================================
--- sandbox/itl/boost/itl_xt/map_segment_gentor.hpp (original)
+++ sandbox/itl/boost/itl_xt/map_segment_gentor.hpp 2010-04-01 06:41:20 EDT (Thu, 01 Apr 2010)
@@ -19,14 +19,14 @@
namespace boost{namespace itl
{
-template <class DomainT, class CodomainT>
-class map_segment_gentor: public RandomGentorAT<std::pair<itl::interval<DomainT>, CodomainT> >
+template <class DomainT, class CodomainT, class IntervalT = itl::interval<DomainT> >
+class map_segment_gentor: public RandomGentorAT<std::pair<IntervalT, CodomainT> >
{
public:
typedef DomainT domain_type;
typedef CodomainT codomain_type;
- typedef itl::interval<DomainT> interval_type;
- typedef std::pair<itl::interval<DomainT>, CodomainT> segment_type;
+ typedef IntervalT interval_type;
+ typedef std::pair<IntervalT, CodomainT> segment_type;
public:
map_segment_gentor(): _codomain_gentor(NULL){}
@@ -50,14 +50,14 @@
}
private:
- ItvGentorT<domain_type> _interval_gentor;
- RandomGentorAT<codomain_type>* _codomain_gentor;
- itl::interval<codomain_type> _covalue_range;
+ ItvGentorT<domain_type,IntervalT> _interval_gentor;
+ RandomGentorAT<codomain_type>* _codomain_gentor;
+ itl::interval<codomain_type> _covalue_range;
};
-template <class DomainT, class CodomainT>
-void map_segment_gentor<DomainT,CodomainT>::some(segment_type& value)
+template <class DomainT, class CodomainT, class IntervalT>
+void map_segment_gentor<DomainT,CodomainT,IntervalT>::some(segment_type& value)
{
interval_type inter_val;
codomain_type co_val;
Modified: sandbox/itl/boost/validate/driver/collector_driver.hpp
==============================================================================
--- sandbox/itl/boost/validate/driver/collector_driver.hpp (original)
+++ sandbox/itl/boost/validate/driver/collector_driver.hpp 2010-04-01 06:41:20 EDT (Thu, 01 Apr 2010)
@@ -112,7 +112,7 @@
//-----------------------------------------------------------------
case RootType::interval_map: {
switch(neutronizerChoice) {
- case NeutronHandlerType::partial_absorber: return new collector_validater<interval_map<int,itl::set<int> > >;
+ case NeutronHandlerType::partial_absorber: return new collector_validater<interval_map<double,itl::set<int> > >;
case NeutronHandlerType::partial_enricher: return new collector_validater<interval_map<int,itl::set<int>,partial_enricher> >;
//case NeutronHandlerType::total_absorber : return new collector_validater<interval_map<int,itl::set<int>,total_absorber > >;
default: return choiceError(ITL_LOCATION("\nRootType::interval_map: neutronizerChoice:\n"), neutronizerChoice, _neutronizerChoice);
@@ -122,7 +122,7 @@
case RootType::split_interval_map: {
switch(neutronizerChoice) {
case NeutronHandlerType::partial_absorber: return new collector_validater<split_interval_map<int,itl::set<int> > >;
- case NeutronHandlerType::partial_enricher: return new collector_validater<split_interval_map<int,itl::set<int>,partial_enricher> >;
+ case NeutronHandlerType::partial_enricher: return new collector_validater<split_interval_map<double,itl::set<int>,partial_enricher> >;
//case NeutronHandlerType::total_absorber : return new collector_validater<split_interval_map<int,itl::set<int>,total_absorber > >;
default: return choiceError(ITL_LOCATION("\nRootType::split_interval_map: neutronizerChoice:\n"), neutronizerChoice, _neutronizerChoice);
}//switch neutronizerChoice
Modified: sandbox/itl/boost/validate/driver/itl_set_driver.hpp
==============================================================================
--- sandbox/itl/boost/validate/driver/itl_set_driver.hpp (original)
+++ sandbox/itl/boost/validate/driver/itl_set_driver.hpp 2010-04-01 06:41:20 EDT (Thu, 01 Apr 2010)
@@ -30,10 +30,10 @@
setValid(true);
_rootChoice.setSize(RootType::Types_size);
_rootChoice.setMaxWeights(100);
- _rootChoice[RootType::itl_set] = 25;
- _rootChoice[RootType::interval_set] = 25;
- _rootChoice[RootType::separate_interval_set] = 25;
- _rootChoice[RootType::split_interval_set] = 25;
+ _rootChoice[RootType::itl_set] = 0; //JODO REV = 25
+ _rootChoice[RootType::interval_set] = 33;
+ _rootChoice[RootType::separate_interval_set] = 33;
+ _rootChoice[RootType::split_interval_set] = 34;
_rootChoice[RootType::itl_map] = 0;
_rootChoice[RootType::interval_map] = 0;
_rootChoice[RootType::split_interval_map] = 0;
@@ -93,6 +93,9 @@
algebra_validater* chooseValidater()
{
+ typedef int intT;
+ typedef double doubleT;
+
int rootChoice = _rootChoice.some();
int domainChoice = _domainChoice.some();
//int codomainChoice = _codomainChoice.some();
@@ -100,34 +103,35 @@
switch(rootChoice)
{
- case RootType::itl_set: {
- switch(domainChoice) {
- case DomainType::Int: return new itl_set_validater<itl::set<int> >;
- case DomainType::Double: return new itl_set_validater<itl::set<double> >;
- default: return choiceError(ITL_LOCATION("\nRootType::itl_set: domainChoice:\n"),
- domainChoice, _domainChoice);
- }
- }
+ //JODO REV
+ //case RootType::itl_set: {
+ // switch(domainChoice) {
+ // case DomainType::Int: return new itl_set_validater<itl::set<int> >;
+ // case DomainType::Double: return new itl_set_validater<itl::set<double> >;
+ // default: return choiceError(ITL_LOCATION("\nRootType::itl_set: domainChoice:\n"),
+ // domainChoice, _domainChoice);
+ // }
+ // }
case RootType::interval_set: {
switch(domainChoice) {
- case DomainType::Int: return new itl_set_validater<interval_set<int> >;
- case DomainType::Double: return new itl_set_validater<interval_set<double> >;
+ case DomainType::Int: return new itl_set_validater<interval_set<intT> >;
+ case DomainType::Double: return new itl_set_validater<interval_set<doubleT> >;
default: return choiceError(ITL_LOCATION("\nRootType::interval_set: domainChoice:\n"),
domainChoice, _domainChoice);
}
}
case RootType::separate_interval_set: {
switch(domainChoice) {
- case DomainType::Int: return new itl_set_validater<separate_interval_set<int> >;
- case DomainType::Double: return new itl_set_validater<separate_interval_set<double> >;
+ case DomainType::Int: return new itl_set_validater<separate_interval_set<intT> >;
+ case DomainType::Double: return new itl_set_validater<separate_interval_set<doubleT> >;
default: return choiceError(ITL_LOCATION("\nRootType::separate_interval_set: domainChoice:\n"),
domainChoice, _domainChoice);
}
}
case RootType::split_interval_set: {
switch(domainChoice) {
- case DomainType::Int: return new itl_set_validater<split_interval_set<int> >;
- case DomainType::Double: return new itl_set_validater<split_interval_set<double> >;
+ case DomainType::Int: return new itl_set_validater<split_interval_set<intT> >;
+ case DomainType::Double: return new itl_set_validater<split_interval_set<doubleT> >;
default: return choiceError(ITL_LOCATION("\nRootType::split_interval_set: domainChoice:\n"),
domainChoice, _domainChoice);
}
Modified: sandbox/itl/boost/validate/driver/map_copy_conformity_driver.hpp
==============================================================================
--- sandbox/itl/boost/validate/driver/map_copy_conformity_driver.hpp (original)
+++ sandbox/itl/boost/validate/driver/map_copy_conformity_driver.hpp 2010-04-01 06:41:20 EDT (Thu, 01 Apr 2010)
@@ -112,20 +112,20 @@
//-----------------------------------------------------------------
case RootType::interval_map: {
switch(neutronizerChoice) {
- case NeutronHandlerType::partial_absorber: return new function_equality_validater<itl::list<std::pair<itl::interval<double>,int> >, interval_map<double,int,partial_absorber> >;
- case NeutronHandlerType::partial_enricher: return new function_equality_validater<itl::list<std::pair<itl::interval<double>,int> >, interval_map<double,int,partial_enricher> >;
- case NeutronHandlerType::total_absorber: return new function_equality_validater<itl::list<std::pair<itl::interval<int>, int> >, interval_map<int, int,total_absorber > >;
- case NeutronHandlerType::total_enricher: return new function_equality_validater<itl::list<std::pair<itl::interval<int>, int> >, interval_map<int, int,total_enricher > >;
+ case NeutronHandlerType::partial_absorber: return new function_equality_validater<itl::list<std::pair<ITL_INTERVAL_DEFAULT<double>,int> >, interval_map<double,int,partial_absorber> >;
+ case NeutronHandlerType::partial_enricher: return new function_equality_validater<itl::list<std::pair<ITL_INTERVAL_DEFAULT<double>,int> >, interval_map<double,int,partial_enricher> >;
+ case NeutronHandlerType::total_absorber: return new function_equality_validater<itl::list<std::pair<ITL_INTERVAL_DEFAULT<int>, int> >, interval_map<int, int,total_absorber > >;
+ case NeutronHandlerType::total_enricher: return new function_equality_validater<itl::list<std::pair<ITL_INTERVAL_DEFAULT<int>, int> >, interval_map<int, int,total_enricher > >;
default: return choiceError(ITL_LOCATION("\nRootType::interval_map: neutronizerChoice:\n"), neutronizerChoice, _neutronizerChoice);
}//switch neutronizerChoice
}//case interval_map
//-----------------------------------------------------------------
case RootType::split_interval_map: {
switch(neutronizerChoice) {
- case NeutronHandlerType::partial_absorber: return new function_equality_validater<itl::list<std::pair<itl::interval<double>,int> >, split_interval_map<double,int,partial_absorber> >;
- case NeutronHandlerType::partial_enricher: return new function_equality_validater<itl::list<std::pair<itl::interval<int>, int> >, split_interval_map<int, int,partial_enricher> >;
- case NeutronHandlerType::total_absorber: return new function_equality_validater<itl::list<std::pair<itl::interval<double>,int> >, split_interval_map<double,int,total_absorber > >;
- case NeutronHandlerType::total_enricher: return new function_equality_validater<itl::list<std::pair<itl::interval<int>, int> >, split_interval_map<int, int,total_enricher > >;
+ case NeutronHandlerType::partial_absorber: return new function_equality_validater<itl::list<std::pair<ITL_INTERVAL_DEFAULT<double>,int> >, split_interval_map<double,int,partial_absorber> >;
+ case NeutronHandlerType::partial_enricher: return new function_equality_validater<itl::list<std::pair<ITL_INTERVAL_DEFAULT<int>, int> >, split_interval_map<int, int,partial_enricher> >;
+ case NeutronHandlerType::total_absorber: return new function_equality_validater<itl::list<std::pair<ITL_INTERVAL_DEFAULT<double>,int> >, split_interval_map<double,int,total_absorber > >;
+ case NeutronHandlerType::total_enricher: return new function_equality_validater<itl::list<std::pair<ITL_INTERVAL_DEFAULT<int>, int> >, split_interval_map<int, int,total_enricher > >;
default: return choiceError(ITL_LOCATION("\nRootType::split_interval_map: neutronizerChoice:\n"), neutronizerChoice, _neutronizerChoice);
}//switch neutronizerChoice
}//case split_interval_map
Modified: sandbox/itl/boost/validate/driver/set_copy_conformity_driver.hpp
==============================================================================
--- sandbox/itl/boost/validate/driver/set_copy_conformity_driver.hpp (original)
+++ sandbox/itl/boost/validate/driver/set_copy_conformity_driver.hpp 2010-04-01 06:41:20 EDT (Thu, 01 Apr 2010)
@@ -100,10 +100,10 @@
switch(rootChoice)
{
//-----------------------------------------------------------------
- case RootType::itl_set: return new function_equality_validater<itl::list<int>, itl::set<int> >;
- case RootType::interval_set: return new function_equality_validater<itl::list<itl::interval<int> >, interval_set<int> >;
- case RootType::separate_interval_set: return new function_equality_validater<itl::list<itl::interval<int> >, separate_interval_set<int> >;
- case RootType::split_interval_set: return new function_equality_validater<itl::list<itl::interval<int> >, split_interval_set<int> >;
+ case RootType::itl_set: return new function_equality_validater<itl::list<int>, itl::set<int> >;
+ case RootType::interval_set: return new function_equality_validater<itl::list<ITL_INTERVAL_DEFAULT<int> >, interval_set<int> >;
+ case RootType::separate_interval_set: return new function_equality_validater<itl::list<ITL_INTERVAL_DEFAULT<int> >, separate_interval_set<int> >;
+ case RootType::split_interval_set: return new function_equality_validater<itl::list<ITL_INTERVAL_DEFAULT<int> >, split_interval_set<int> >;
//-----------------------------------------------------------------
default: return choiceError(ITL_LOCATION("rootChoice:\n"), rootChoice, _rootChoice);
} //switch()
Modified: sandbox/itl/boost/validate/gentor/randomgentor.hpp
==============================================================================
--- sandbox/itl/boost/validate/gentor/randomgentor.hpp (original)
+++ sandbox/itl/boost/validate/gentor/randomgentor.hpp 2010-04-01 06:41:20 EDT (Thu, 01 Apr 2010)
@@ -26,6 +26,7 @@
#include <libs/validate/example/labat_polygon_/polygon_gentor.hpp>
#endif //LAW_BASED_TEST_BOOST_POLYGON
+#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>
@@ -54,7 +55,7 @@
// -------------------------------------------------------------------------
template <class DomainT>
- class RandomGentor<itl::interval<DomainT> > :
+ class RandomGentor<ITL_INTERVAL_DEFAULT<DomainT> > :
public ItvGentorT<DomainT> {};
// -------------------------------------------------------------------------
@@ -80,20 +81,20 @@
// ----- lists -------------------------------------------------------------
template <class DomainT, class CodomainT>
- class RandomGentor<std::pair<itl::interval<DomainT>, CodomainT> > :
+ class RandomGentor<std::pair<ITL_INTERVAL_DEFAULT<DomainT>, CodomainT> > :
public map_segment_gentor<DomainT,CodomainT> {};
template <class DomainT, class CodomainT>
- class RandomGentor<itl::list<std::pair<itl::interval<DomainT>, CodomainT> > > :
- public SeqGentorT<itl::list<std::pair<itl::interval<DomainT>, CodomainT> > > {};
+ class RandomGentor<itl::list<std::pair<ITL_INTERVAL_DEFAULT<DomainT>, CodomainT> > > :
+ public SeqGentorT<itl::list<std::pair<ITL_INTERVAL_DEFAULT<DomainT>, CodomainT> > > {};
template <class DomainT, class CodomainT>
class RandomGentor<itl::list<std::pair<DomainT,CodomainT> > > :
public SeqGentorT<itl::list<std::pair<DomainT,CodomainT> > > {};
template <class DomainT>
- class RandomGentor<itl::list<itl::interval<DomainT> > > :
- public SeqGentorT<itl::list<itl::interval<DomainT> > > {};
+ class RandomGentor<itl::list<ITL_INTERVAL_DEFAULT<DomainT> > > :
+ public SeqGentorT<itl::list<ITL_INTERVAL_DEFAULT<DomainT> > > {};
// ----- sets --------------------------------------------------------------
//template <class DomainT, template<class>class Set>
@@ -253,9 +254,9 @@
template <>
- struct Calibrater<itl::interval<int>, RandomGentor>
+ struct Calibrater<ITL_INTERVAL_DEFAULT<int>, RandomGentor>
{
- static void apply(RandomGentor<itl::interval<int> >& gentor)
+ static void apply(RandomGentor<ITL_INTERVAL_DEFAULT<int> >& gentor)
{
// Set the range within which the sizes of the generated object varies.
gentor.setRange(GentorProfileSgl::it()->range_int());
@@ -333,24 +334,25 @@
};
template <>
- struct Calibrater<std::pair<itl::interval<int>, int>, RandomGentor>
+ struct Calibrater<std::pair<ITL_INTERVAL_DEFAULT<int>, int>, RandomGentor>
{
- static void apply(RandomGentor< std::pair<itl::interval<int>, int> >&){}
+ static void apply(RandomGentor< std::pair<ITL_INTERVAL_DEFAULT<int>, int> >&){}
};
template <>
- struct Calibrater<std::pair<itl::interval<double>, int>, RandomGentor>
+ struct Calibrater<std::pair<ITL_INTERVAL_DEFAULT<double>, int>, RandomGentor>
{
- static void apply(RandomGentor< std::pair<itl::interval<double>, int> >&){}
+ static void apply(RandomGentor< std::pair<ITL_INTERVAL_DEFAULT<double>, int> >&){}
};
template <>
- struct Calibrater<itl::list<std::pair<itl::interval<double>, int> >, RandomGentor>
+ struct Calibrater<itl::list<std::pair<ITL_INTERVAL_DEFAULT<double>, int> >, RandomGentor>
{
- static void apply(RandomGentor< itl::list<std::pair<itl::interval<double>, int> > >& gentor)
+ static void apply(RandomGentor< itl::list<std::pair<ITL_INTERVAL_DEFAULT<double>, int> > >& gentor)
{
gentor.setRangeOfSampleSize(GentorProfileSgl::it()->range_ContainerSize());
- map_segment_gentor<double,int>* segment_gentor = new map_segment_gentor<double,int>;
+ map_segment_gentor<double,int,ITL_INTERVAL_DEFAULT<double> >* segment_gentor
+ = new map_segment_gentor<double,int,ITL_INTERVAL_DEFAULT<double> >;
NumberGentorT<int>* int_gentor = new NumberGentorT<int>;
int_gentor->setRange(GentorProfileSgl::it()->range_int());
segment_gentor->setCodomainGentor(int_gentor);
@@ -362,12 +364,13 @@
};
template <class NumericT>
- struct Calibrater<itl::list< itl::interval<NumericT> >, RandomGentor>
+ struct Calibrater<itl::list< ITL_INTERVAL_DEFAULT<NumericT> >, RandomGentor>
{
- static void apply(RandomGentor< itl::list< itl::interval<NumericT> > >& gentor)
+ static void apply(RandomGentor< itl::list< ITL_INTERVAL_DEFAULT<NumericT> > >& gentor)
{
gentor.setRangeOfSampleSize(GentorProfileSgl::it()->range_ContainerSize());
- ItvGentorT<NumericT>* itvGentor = new ItvGentorT<NumericT>;
+ ItvGentorT<NumericT, ITL_INTERVAL_DEFAULT<NumericT> >* itvGentor
+ = new ItvGentorT<NumericT, ITL_INTERVAL_DEFAULT<NumericT> >;
itvGentor->setRange(GentorProfileSgl_numeric_range<NumericT>::get());
itvGentor->setMaxIntervalLength(GentorProfileSgl::it()->maxIntervalLength());
gentor.setDomainGentor(itvGentor);
@@ -404,12 +407,13 @@
};
template <>
- struct Calibrater<itl::list<std::pair<itl::interval<int>, int> >, RandomGentor>
+ struct Calibrater<itl::list<std::pair<ITL_INTERVAL_DEFAULT<int>, int> >, RandomGentor>
{
- static void apply(RandomGentor< itl::list<std::pair<itl::interval<int>, int> > >& gentor)
+ static void apply(RandomGentor< itl::list<std::pair<ITL_INTERVAL_DEFAULT<int>, int> > >& gentor)
{
gentor.setRangeOfSampleSize(GentorProfileSgl::it()->range_ContainerSize());
- map_segment_gentor<int,int>* segment_gentor = new map_segment_gentor<int,int>;
+ map_segment_gentor<int,int,ITL_INTERVAL_DEFAULT<int> >* segment_gentor
+ = new map_segment_gentor<int,int,ITL_INTERVAL_DEFAULT<int> >;
NumberGentorT<int>* int_gentor = new NumberGentorT<int>;
int_gentor->setRange(GentorProfileSgl::it()->range_int());
segment_gentor->setCodomainGentor(int_gentor);
@@ -447,14 +451,15 @@
}
};
-
+ //--------------------------------------------------------------------------
template <>
struct Calibrater<interval_set<int>, RandomGentor>
{
static void apply(RandomGentor<interval_set<int> >& gentor)
{
gentor.setRangeOfSampleSize(GentorProfileSgl::it()->range_ContainerSize());
- ItvGentorT<int>* itvGentor = new ItvGentorT<int>;
+ ItvGentorT<int, ITL_INTERVAL_DEFAULT<int> >* itvGentor
+ = new ItvGentorT<int, ITL_INTERVAL_DEFAULT<int> >;
interval<int> valRange = GentorProfileSgl::it()->range_interval_int();
itvGentor->setValueRange(valRange.lower(), valRange.upper());
itvGentor->setMaxIntervalLength(GentorProfileSgl::it()->maxIntervalLength());
@@ -468,7 +473,8 @@
static void apply(RandomGentor<interval_set<double> >& gentor)
{
gentor.setRangeOfSampleSize(GentorProfileSgl::it()->range_ContainerSize());
- ItvGentorT<double>* itvGentor = new ItvGentorT<double>;
+ ItvGentorT<double, ITL_INTERVAL_DEFAULT<double> >* itvGentor
+ = new ItvGentorT<double, ITL_INTERVAL_DEFAULT<double> >;
interval<double> valRange = GentorProfileSgl::it()->range_interval_double();
itvGentor->setValueRange(valRange.lower(), valRange.upper());
itvGentor->setMaxIntervalLength(GentorProfileSgl::it()->maxIntervalLength());
@@ -482,7 +488,8 @@
static void apply(RandomGentor<separate_interval_set<int> >& gentor)
{
gentor.setRangeOfSampleSize(GentorProfileSgl::it()->range_ContainerSize());
- ItvGentorT<int>* itvGentor = new ItvGentorT<int>;
+ ItvGentorT<int, ITL_INTERVAL_DEFAULT<int> >* itvGentor
+ = new ItvGentorT<int, ITL_INTERVAL_DEFAULT<int> >;
interval<int> valRange = GentorProfileSgl::it()->range_interval_int();
itvGentor->setValueRange(valRange.lower(), valRange.upper());
itvGentor->setMaxIntervalLength(GentorProfileSgl::it()->maxIntervalLength());
@@ -499,7 +506,8 @@
// If it is a container: (Create and) Pass the generator(s) for their contents
// NumberGentorT<int> intGentor;
- ItvGentorT<double>* itvGentor = new ItvGentorT<double>;
+ ItvGentorT<double, ITL_INTERVAL_DEFAULT<double> >* itvGentor
+ = new ItvGentorT<double, ITL_INTERVAL_DEFAULT<double> >;
interval<double> valRange = GentorProfileSgl::it()->range_interval_double();
itvGentor->setValueRange(valRange.lower(), valRange.upper());
itvGentor->setMaxIntervalLength(GentorProfileSgl::it()->maxIntervalLength());
@@ -517,7 +525,8 @@
// If it is a container: (Create and) Pass the generator(s) for their contents
// NumberGentorT<int> intGentor;
- ItvGentorT<int>* itvGentor = new ItvGentorT<int>;
+ ItvGentorT<int, ITL_INTERVAL_DEFAULT<int> >* itvGentor
+ = new ItvGentorT<int, ITL_INTERVAL_DEFAULT<int> >;
interval<int> valRange = GentorProfileSgl::it()->range_interval_int();
itvGentor->setValueRange(valRange.lower(), valRange.upper());
itvGentor->setMaxIntervalLength(GentorProfileSgl::it()->maxIntervalLength());
@@ -534,7 +543,8 @@
// If it is a container: (Create and) Pass the generator(s) for their contents
// NumberGentorT<int> intGentor;
- ItvGentorT<double>* itvGentor = new ItvGentorT<double>;
+ ItvGentorT<double, ITL_INTERVAL_DEFAULT<double> >* itvGentor
+ = new ItvGentorT<double, ITL_INTERVAL_DEFAULT<double> >;
interval<double> valRange = GentorProfileSgl::it()->range_interval_double();
itvGentor->setValueRange(valRange.lower(), valRange.upper());
itvGentor->setMaxIntervalLength(GentorProfileSgl::it()->maxIntervalLength());
@@ -576,7 +586,8 @@
static void apply(RandomGentor<itl::tree<int> >& gentor)
{
gentor.setRangeOfSampleSize(GentorProfileSgl::it()->range_ContainerSize());
- ItvGentorT<int>* itvGentor = new ItvGentorT<int>;
+ ItvGentorT<int, ITL_INTERVAL_DEFAULT<int> >* itvGentor
+ = new ItvGentorT<int, ITL_INTERVAL_DEFAULT<int> >;
interval<int> valRange = GentorProfileSgl::it()->range_interval_int();
itvGentor->setValueRange(valRange.lower(), valRange.upper());
itvGentor->setMaxIntervalLength(GentorProfileSgl::it()->maxIntervalLength());
@@ -665,7 +676,9 @@
// If it is a container: (Create and) Pass the generator(s) for their contents
// NumberGentorT<int> intGentor;
- ItvGentorT<NumericDomainT>* itvGentor = new ItvGentorT<NumericDomainT>;
+ //CL ItvGentorT<NumericDomainT>* itvGentor = new ItvGentorT<NumericDomainT>;
+ ItvGentorT<NumericDomainT, ITL_INTERVAL_DEFAULT<NumericDomainT> >* itvGentor
+ = new ItvGentorT<NumericDomainT, ITL_INTERVAL_DEFAULT<NumericDomainT> >;
interval<NumericDomainT> valRange = GentorProfileSgl_numeric_range<NumericDomainT>::get();
itvGentor->setValueRange(valRange.lower(), valRange.upper());
itvGentor->setMaxIntervalLength(GentorProfileSgl::it()->maxIntervalLength());
@@ -692,7 +705,8 @@
// If it is a container: (Create and) Pass the generator(s) for their contents
// NumberGentorT<int> intGentor;
- ItvGentorT<NumericDomainT>* itvGentor = new ItvGentorT<NumericDomainT>;
+ ItvGentorT<NumericDomainT, ITL_INTERVAL_DEFAULT<NumericDomainT> >* itvGentor
+ = new ItvGentorT<NumericDomainT, ITL_INTERVAL_DEFAULT<NumericDomainT> >;
interval<NumericDomainT> valRange = GentorProfileSgl_numeric_range<NumericDomainT>::get();
itvGentor->setValueRange(valRange.lower(), valRange.upper());
itvGentor->setMaxIntervalLength(GentorProfileSgl::it()->maxIntervalLength());
@@ -717,7 +731,8 @@
// If it is a container: (Create and) Pass the generator(s) for their contents
// NumberGentorT<int> intGentor;
- ItvGentorT<NumericDomainT>* itvGentor = new ItvGentorT<NumericDomainT>;
+ ItvGentorT<NumericDomainT, ITL_INTERVAL_DEFAULT<NumericDomainT> >* itvGentor
+ = new ItvGentorT<NumericDomainT, ITL_INTERVAL_DEFAULT<NumericDomainT> >;
interval<NumericDomainT> valRange = GentorProfileSgl_numeric_range<NumericDomainT>::get();
itvGentor->setValueRange(valRange.lower(), valRange.upper());
itvGentor->setMaxIntervalLength(GentorProfileSgl::it()->maxIntervalLength());
@@ -745,7 +760,8 @@
// If it is a container: (Create and) Pass the generator(s) for their contents
// NumberGentorT<int> intGentor;
- ItvGentorT<NumericDomainT>* itvGentor = new ItvGentorT<NumericDomainT>;
+ ItvGentorT<NumericDomainT, ITL_INTERVAL_DEFAULT<NumericDomainT> >* itvGentor
+ = new ItvGentorT<NumericDomainT, ITL_INTERVAL_DEFAULT<NumericDomainT> >;
interval<NumericDomainT> valRange = GentorProfileSgl_numeric_range<NumericDomainT>::get();
itvGentor->setValueRange(valRange.lower(), valRange.upper());
itvGentor->setMaxIntervalLength(GentorProfileSgl::it()->maxIntervalLength());
@@ -771,7 +787,8 @@
// If it is a container: (Create and) Pass the generator(s) for their contents
// NumberGentorT<int> intGentor;
- ItvGentorT<NumericDomainT>* itvGentor = new ItvGentorT<NumericDomainT>;
+ ItvGentorT<NumericDomainT, ITL_INTERVAL_DEFAULT<NumericDomainT> >* itvGentor
+ = new ItvGentorT<NumericDomainT, ITL_INTERVAL_DEFAULT<NumericDomainT> >;
interval<NumericDomainT> valRange = GentorProfileSgl_numeric_range<NumericDomainT>::get();
itvGentor->setValueRange(valRange.lower(), valRange.upper());
itvGentor->setMaxIntervalLength(GentorProfileSgl::it()->maxIntervalLength());
@@ -796,7 +813,8 @@
// If it is a container: (Create and) Pass the generator(s) for their contents
// NumberGentorT<int> intGentor;
- ItvGentorT<NumericDomainT>* itvGentor = new ItvGentorT<NumericDomainT>;
+ ItvGentorT<NumericDomainT, ITL_INTERVAL_DEFAULT<NumericDomainT> >* itvGentor
+ = new ItvGentorT<NumericDomainT, ITL_INTERVAL_DEFAULT<NumericDomainT> >;
interval<NumericDomainT> valRange = GentorProfileSgl_numeric_range<NumericDomainT>::get();
itvGentor->setValueRange(valRange.lower(), valRange.upper());
itvGentor->setMaxIntervalLength(GentorProfileSgl::it()->maxIntervalLength());
@@ -819,7 +837,8 @@
// If it is a container: (Create and) Pass the generator(s) for their contents
// NumberGentorT<int> intGentor;
- ItvGentorT<NumericDomainT>* itvGentor = new ItvGentorT<NumericDomainT>;
+ ItvGentorT<NumericDomainT, ITL_INTERVAL_DEFAULT<NumericDomainT> >* itvGentor
+ = new ItvGentorT<NumericDomainT, ITL_INTERVAL_DEFAULT<NumericDomainT> >;
interval<NumericDomainT> valRange = GentorProfileSgl_numeric_range<NumericDomainT>::get();
itvGentor->setValueRange(valRange.lower(), valRange.upper());
itvGentor->setMaxIntervalLength(GentorProfileSgl::it()->maxIntervalLength());
Modified: sandbox/itl/boost/validate/laws/monoid.hpp
==============================================================================
--- sandbox/itl/boost/validate/laws/monoid.hpp (original)
+++ sandbox/itl/boost/validate/laws/monoid.hpp 2010-04-01 06:41:20 EDT (Thu, 01 Apr 2010)
@@ -272,23 +272,23 @@
{
std::cout << typeString() << std::endl;
std::cout << formula() << std::endl;
- std::cout << "a: " << this->template getInputValue<operand_a>().as_string() << std::endl;
- std::cout << "b: " << this->template getInputValue<operand_b>().as_string() << std::endl;
- std::cout << "c: " << this->template getInputValue<operand_c>().as_string() << std::endl;
+ std::cout << "a: " << this->template getInputValue<operand_a>() << std::endl;
+ std::cout << "b: " << this->template getInputValue<operand_b>() << std::endl;
+ std::cout << "c: " << this->template getInputValue<operand_c>() << std::endl;
Type lsum = this->template getInputValue<operand_a>();
Accumulator<Type>()(lsum, this->template getInputValue<operand_b>());
- std::cout << "a o b: " << lsum.as_string() << std::endl;
+ std::cout << "a o b: " << lsum << std::endl;
Accumulator<Type>()(lsum, this->template getInputValue<operand_c>());
- std::cout << "(a o b) o c: " << lsum.as_string() << std::endl;
+ std::cout << "(a o b) o c: " << lsum << std::endl;
Type rsum = this->template getInputValue<operand_a>();
Type b_plus_c = this->template getInputValue<operand_b>();
Accumulator<Type>()(b_plus_c, this->template getInputValue<operand_c>());
- std::cout << "b o c: " << b_plus_c.as_string() << std::endl;
+ std::cout << "b o c: " << b_plus_c << std::endl;
Accumulator<Type>()(rsum, b_plus_c);
- std::cout << "a o (b o c): " << rsum.as_string() << std::endl;
+ std::cout << "a o (b o c): " << rsum << std::endl;
this->template setOutputValue<lhs_sum>(lsum);
this->template setOutputValue<rhs_sum>(rsum);
@@ -355,16 +355,16 @@
{
std::cout << typeString() << std::endl;
std::cout << formula() << std::endl;
- std::cout << "a: " << this->template getInputValue<operand_a>().as_string() << std::endl;
- std::cout << "b: " << this->template getInputValue<operand_b>().as_string() << std::endl;
+ std::cout << "a: " << this->template getInputValue<operand_a>() << std::endl;
+ std::cout << "b: " << this->template getInputValue<operand_b>() << std::endl;
Type lsum = this->template getInputValue<operand_a>();
lsum += this->template getInputValue<operand_b>();
- std::cout << "a o b: " << lsum.as_string() << std::endl;
+ std::cout << "a o b: " << lsum << std::endl;
Type rsum = this->template getInputValue<operand_b>();
rsum += this->template getInputValue<operand_a>();
- std::cout << "b o a: " << rsum.as_string() << std::endl;
+ std::cout << "b o a: " << rsum << std::endl;
this->template setOutputValue<lhs_sum>(lsum);
this->template setOutputValue<rhs_sum>(rsum);
Modified: sandbox/itl/boost/validate/laws/pushouts.hpp
==============================================================================
--- sandbox/itl/boost/validate/laws/pushouts.hpp (original)
+++ sandbox/itl/boost/validate/laws/pushouts.hpp 2010-04-01 06:41:20 EDT (Thu, 01 Apr 2010)
@@ -90,8 +90,8 @@
{
std::cout << typeString() << std::endl;
std::cout << formula() << std::endl;
- std::cout << "a: " << this->template getInputValue<operand_a>().as_string() << std::endl;
- std::cout << "b: " << this->template getInputValue<operand_b>().as_string() << std::endl;
+ std::cout << "a: " << this->template getInputValue<operand_a>() << std::endl;
+ std::cout << "b: " << this->template getInputValue<operand_b>() << std::endl;
// f(a o b) == f(a) o f(b)
// --- left hand side ------------------------
@@ -99,25 +99,25 @@
SourceT a_o_b = this->template getInputValue<operand_a>();
// a_o_b o= this->template getInputValue<operand_b>();
OperatorT<SourceT>()(a_o_b, this->template getInputValue<operand_b>());
- std::cout << "a o b:" << a_o_b.as_string() << std::endl;
+ std::cout << "a o b:" << a_o_b << std::endl;
TargetT lhs;
FunctionT<TargetT,SourceT>()(lhs, a_o_b);
- std::cout << "f(a o b):" << lhs.as_string() << std::endl;
+ std::cout << "f(a o b):" << lhs << std::endl;
// --- right hand side -----------------------
// rhs := atomize(a) * atomize(b)
SourceT value_a = this->template getInputValue<operand_a>();
TargetT atomic_a;
FunctionT<TargetT,SourceT>()(atomic_a, value_a);
- std::cout << "f(a):" << atomic_a.as_string() << std::endl;
+ std::cout << "f(a):" << atomic_a << std::endl;
SourceT value_b = this->template getInputValue<operand_b>();
TargetT atomic_b;
FunctionT<TargetT,SourceT>()(atomic_b, value_b);
- std::cout << "f(b):" << atomic_b.as_string() << std::endl;
+ std::cout << "f(b):" << atomic_b << std::endl;
TargetT rhs = atomic_a;
OperatorT<TargetT>()(rhs, atomic_b);
- std::cout << "f(a) o f(b):" << rhs.as_string() << std::endl;
+ std::cout << "f(a) o f(b):" << rhs << std::endl;
this->template setOutputValue<lhs_result>(lhs);
this->template setOutputValue<rhs_result>(rhs);
Modified: sandbox/itl/boost/validate/laws/set_laws.hpp
==============================================================================
--- sandbox/itl/boost/validate/laws/set_laws.hpp (original)
+++ sandbox/itl/boost/validate/laws/set_laws.hpp 2010-04-01 06:41:20 EDT (Thu, 01 Apr 2010)
@@ -76,32 +76,32 @@
bool debug_holds()
{
// a + (b * c) == (a + b) * (a + c)
- std::cout << "a:" << this->template getInputValue<operand_a>().as_string() << std::endl;
- std::cout << "b:" << this->template getInputValue<operand_b>().as_string() << std::endl;
- std::cout << "c:" << this->template getInputValue<operand_c>().as_string() << std::endl;
+ std::cout << "a:" << this->template getInputValue<operand_a>() << std::endl;
+ std::cout << "b:" << this->template getInputValue<operand_b>() << std::endl;
+ std::cout << "c:" << this->template getInputValue<operand_c>() << std::endl;
// --- left hand side ------------------------
Type b_star_c = this->template getInputValue<operand_b>();
Operator2<Type>()(b_star_c, this->template getInputValue<operand_c>());
- std::cout << "b*c:" << b_star_c.as_string() << std::endl;
+ std::cout << "b*c:" << b_star_c << std::endl;
// lhs := a + (b * c)
Type lhs = this->template getInputValue<operand_a>();
Operator1<Type>()(lhs, b_star_c);
- std::cout << "l=a+(b*c):" << lhs.as_string() << std::endl;
+ std::cout << "l=a+(b*c):" << lhs << std::endl;
// --- right hand side -----------------------
Type a_plus_b = this->template getInputValue<operand_a>();
Operator1<Type>()(a_plus_b, this->template getInputValue<operand_b>());
- std::cout << "a+b:" << a_plus_b.as_string() << std::endl;
+ std::cout << "a+b:" << a_plus_b << std::endl;
Type a_plus_c = this->template getInputValue<operand_a>();
Operator1<Type>()(a_plus_c, this->template getInputValue<operand_c>());
- std::cout << "a+c:" << a_plus_c.as_string() << std::endl;
+ std::cout << "a+c:" << a_plus_c << std::endl;
// rhs := (a + b) * (a + c)
Type rhs = a_plus_b;
Operator2<Type>()(rhs, a_plus_c);
- std::cout << "r=(a+b)*(a+c):" << rhs.as_string() << std::endl;
+ std::cout << "r=(a+b)*(a+c):" << rhs << std::endl;
this->template setOutputValue<lhs_result>(lhs);
this->template setOutputValue<rhs_result>(rhs);
@@ -292,30 +292,30 @@
bool debug_holds()
{
// (a + b) - c == (a - c) + (b - c)
- std::cout << "a:" << this->template getInputValue<operand_a>().as_string() << std::endl;
- std::cout << "b:" << this->template getInputValue<operand_b>().as_string() << std::endl;
- std::cout << "c:" << this->template getInputValue<operand_c>().as_string() << std::endl;
+ std::cout << "a:" << this->template getInputValue<operand_a>() << std::endl;
+ std::cout << "b:" << this->template getInputValue<operand_b>() << std::endl;
+ std::cout << "c:" << this->template getInputValue<operand_c>() << std::endl;
// --- left hand side ------------------------
// lhs := (a + b) - c
Type lhs = this->template getInputValue<operand_a>();
Operator1<Type>()(lhs, this->template getInputValue<operand_b>());
- std::cout << "a+b:" << lhs.as_string() << std::endl;
+ std::cout << "a+b:" << lhs << std::endl;
Operator2<Type>()(lhs, this->template getInputValue<operand_c>());
- std::cout << "l=(a+b)-c:" << lhs.as_string() << std::endl;
+ std::cout << "l=(a+b)-c:" << lhs << std::endl;
// --- right hand side -----------------------
Type a_minus_c = this->template getInputValue<operand_a>();
Operator2<Type>()(a_minus_c, this->template getInputValue<operand_c>());
- std::cout << "a-c:" << a_minus_c.as_string() << std::endl;
+ std::cout << "a-c:" << a_minus_c << std::endl;
Type b_minus_c = this->template getInputValue<operand_b>();
Operator2<Type>()(b_minus_c, this->template getInputValue<operand_c>());
- std::cout << "b-c:" << b_minus_c.as_string() << std::endl;
+ std::cout << "b-c:" << b_minus_c << std::endl;
// rhs := (a - c) + (b - c)
Type rhs = a_minus_c;
Operator1<Type>()(rhs, b_minus_c);
- std::cout << "r=(a-c)+(b-c):" << b_minus_c.as_string() << std::endl;
+ std::cout << "r=(a-c)+(b-c):" << b_minus_c << std::endl;
this->template setOutputValue<lhs_result>(lhs);
this->template setOutputValue<rhs_result>(rhs);
Modified: sandbox/itl/boost/validate/laws/symmetric_difference.hpp
==============================================================================
--- sandbox/itl/boost/validate/laws/symmetric_difference.hpp (original)
+++ sandbox/itl/boost/validate/laws/symmetric_difference.hpp 2010-04-01 06:41:20 EDT (Thu, 01 Apr 2010)
@@ -79,30 +79,30 @@
Type a_plus_b = this->template getInputValue<operand_a>();
Addition<Type>()(a_plus_b, this->template getInputValue<operand_b>());
- std::cout << "a_plus_b=" << a_plus_b.as_string() << std::endl;
+ std::cout << "a_plus_b=" << a_plus_b << std::endl;
Type a_sec_b = this->template getInputValue<operand_a>();
Intersection<Type>()(a_sec_b, this->template getInputValue<operand_b>());
- std::cout << "a_sec_b=" << a_sec_b.as_string() << std::endl;
+ std::cout << "a_sec_b=" << a_sec_b << std::endl;
Type lhs = a_plus_b;
Subtraction<Type>()(lhs, a_sec_b);
- std::cout << "lhs=" << lhs.as_string() << std::endl;
+ std::cout << "lhs=" << lhs << std::endl;
// --- right hand side -----------------------
Type a_minus_b = this->template getInputValue<operand_a>();
Subtraction<Type>()(a_minus_b, this->template getInputValue<operand_b>());
- std::cout << "a_minus_b=" << a_minus_b.as_string() << std::endl;
+ std::cout << "a_minus_b=" << a_minus_b << std::endl;
Type b_minus_a = this->template getInputValue<operand_b>();
Subtraction<Type>()(b_minus_a, this->template getInputValue<operand_a>());
- std::cout << "b_minus_a=" << b_minus_a.as_string() << std::endl;
+ std::cout << "b_minus_a=" << b_minus_a << std::endl;
Type rhs = a_minus_b;
Addition<Type>()(rhs, b_minus_a);
- std::cout << "rhs=" << rhs.as_string() << std::endl;
+ std::cout << "rhs=" << rhs << std::endl;
this->template setOutputValue<lhs_result>(lhs);
this->template setOutputValue<rhs_result>(rhs);
@@ -169,20 +169,20 @@
// --- left hand side ------------------------
Type lhs = this->template getInputValue<operand_a>();
lhs ^= this->template getInputValue<operand_b>();
- std::cout << "lhs=" << lhs.as_string() << std::endl;
+ std::cout << "lhs=" << lhs << std::endl;
// --- right hand side -----------------------
Type a_minus_b = this->template getInputValue<operand_a>();
a_minus_b -= this->template getInputValue<operand_b>();
- std::cout << "a_minus_b=" << a_minus_b.as_string() << std::endl;
+ std::cout << "a_minus_b=" << a_minus_b << std::endl;
Type b_minus_a = this->template getInputValue<operand_b>();
b_minus_a -= this->template getInputValue<operand_a>();
- std::cout << "b_minus_a=" << b_minus_a.as_string() << std::endl;
+ std::cout << "b_minus_a=" << b_minus_a << std::endl;
Type rhs = a_minus_b;
rhs += b_minus_a;
- std::cout << "rhs=" << rhs.as_string() << std::endl;
+ std::cout << "rhs=" << rhs << std::endl;
this->template setOutputValue<lhs_result>(lhs);
this->template setOutputValue<rhs_result>(rhs);
Modified: sandbox/itl/libs/itl/doc/acknowledgments.qbk
==============================================================================
--- sandbox/itl/libs/itl/doc/acknowledgments.qbk (original)
+++ sandbox/itl/libs/itl/doc/acknowledgments.qbk 2010-04-01 06:41:20 EDT (Thu, 01 Apr 2010)
@@ -33,9 +33,10 @@
I am grateful to Hartmut Kaiser for managing the formal review of
this library and to all the reviewers and participants
in the related discussions, including Jeff Flinn, Luke Simonson,
-Phil Endecott, Eric M. Jonas, Peter Wuttke, Jerry Jeremiah,
+Phil Endecott, Eric M. Jonas, Peter Wuttke, Robert Stuard,
Barend Gehrels, Vicente Botet, Thomas Klimpel, Paul A. Bristow,
-John Reid, Steven Watanabe, Brian Wood, Markus Werle and Michael Caisse.
+Jerry Jeremiah, John Reid, Steven Watanabe, Brian Wood, Markus Werle
+and Michael Caisse.
[endsect]
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-04-01 06:41:20 EDT (Thu, 01 Apr 2010)
@@ -40,7 +40,7 @@
joinedTimes.insert(next_morning); //touching
joinedTimes.insert(next_evening); //disjoint
- cout << "Joined times :" << joinedTimes.as_string() << endl;
+ cout << "Joined times :" << joinedTimes << endl;
// A separate interval set of type separate_interval_set joins intervals that that
// overlap but it preserves interval borders that just touch each other. You may
@@ -51,7 +51,7 @@
separateTimes.insert(next_morning); //touching
separateTimes.insert(next_evening); //disjoint
- cout << "Separate times:" << separateTimes.as_string() << endl;
+ cout << "Separate times:" << separateTimes << endl;
// A split interval set of type split_interval_set preserves all interval
// borders. On insertion of overlapping intervals the intervals in the
@@ -62,7 +62,7 @@
splitTimes += next_morning; //touching
splitTimes += next_evening; //disjoint
- cout << "Split times :\n" << splitTimes.as_string() << endl;
+ cout << "Split times :\n" << splitTimes << endl;
// A split interval map splits up inserted intervals on overlap and aggregates the
// associated quantities via the operator +=
Modified: sandbox/itl/libs/itl/example/itvset_shell_/itvset_shell.cpp
==============================================================================
--- sandbox/itl/libs/itl/example/itvset_shell_/itvset_shell.cpp (original)
+++ sandbox/itl/libs/itl/example/itvset_shell_/itvset_shell.cpp 2010-04-01 06:41:20 EDT (Thu, 01 Apr 2010)
@@ -68,8 +68,8 @@
// SetTV::IntervalTD itv = rightOpenInterval(lwb,upb);
m1.insert(itv);
- cout << "+" << itv.as_string().c_str() << " =" << endl;
- cout << "{" << m1.as_string() << "}" << endl;
+ cout << "+" << itv << " =" << endl;
+ cout << "{" << m1 << "}" << endl;
}
break;
@@ -84,15 +84,15 @@
tmp.insert(itv);
m1 -= tmp;
- cout << "-" << itv.as_string().c_str()<<" =" << endl;
- cout << "{" << m1.as_string() << "}" << endl;
+ cout << "-" << itv << " =" << endl;
+ cout << "{" << m1 << "}" << endl;
}
break;
case 'j':
{
m1.join();
- cout << "{" << m1.as_string() << "}" << endl;
+ cout << "{" << m1 << "}" << endl;
}
break;
case 's':
Modified: sandbox/itl/libs/itl/example/splititvmap_shell_/splititvmap_shell.cpp
==============================================================================
--- sandbox/itl/libs/itl/example/splititvmap_shell_/splititvmap_shell.cpp (original)
+++ sandbox/itl/libs/itl/example/splititvmap_shell_/splititvmap_shell.cpp 2010-04-01 06:41:20 EDT (Thu, 01 Apr 2010)
@@ -73,8 +73,8 @@
itv = typename MapTV::interval_type(lwb,upb);
m1 += make_pair(itv,val);
- cout << "+" << itv.as_string().c_str()<<" "<<val<< " =" << endl;
- cout << "{" << m1.as_string() << "}" << endl;
+ cout << "+" << itv << " " << val << " =" << endl;
+ cout << "{" << m1 << "}" << endl;
}
break;
@@ -86,15 +86,15 @@
itv = typename MapTV::interval_type(lwb,upb);
m1 -= make_pair(itv,val);
- cout << "-" << itv.as_string().c_str()<<" "<<val<< " =" << endl;
- cout << "{" << m1.as_string() << "}" << endl;
+ cout << "-" << itv << " " << val << " =" << endl;
+ cout << "{" << m1 << "}" << endl;
}
break;
case 'j':
{
m1.join();
- cout << "{" << m1.as_string() << "}" << endl;
+ cout << "{" << m1 << "}" << endl;
}
break;
case 's':
Modified: sandbox/itl/libs/itl/example/user_groups_/user_groups.cpp
==============================================================================
--- sandbox/itl/libs/itl/example/user_groups_/user_groups.cpp (original)
+++ sandbox/itl/libs/itl/example/user_groups_/user_groups.cpp 2010-04-01 06:41:20 EDT (Thu, 01 Apr 2010)
@@ -121,7 +121,7 @@
// Who is member of group med_users within the time interval 'when' ?
MemberSetT who = (*med_++).second;
cout << "[" << when.first() << " - " << when.last() << "]"
- << ": " << who.as_string() << endl;
+ << ": " << who << endl;
}
MembershipT::iterator admin_ = admin_users.begin();
@@ -132,7 +132,7 @@
// Who is member of group admin_users within the time interval 'when' ?
MemberSetT who = (*admin_++).second;
cout << "[" << when.first() << " - " << when.last() << "]"
- << ": " << who.as_string() << endl;
+ << ": " << who << endl;
}
MembershipT::iterator all_ = all_users.begin();
@@ -143,7 +143,7 @@
// Who is member of group med_users OR admin_users ?
MemberSetT who = (*all_++).second;
cout << "[" << when.first() << " - " << when.last() << "]"
- << ": " << who.as_string() << endl;
+ << ": " << who << endl;
}
MembershipT::iterator super_ = super_users.begin();
@@ -154,7 +154,7 @@
// Who is member of group med_users AND admin_users ?
MemberSetT who = (*super_++).second;
cout << "[" << when.first() << " - " << when.last() << "]"
- << ": " << who.as_string() << endl;
+ << ": " << who << endl;
}
}
Modified: sandbox/itl/libs/itl/test/test_casual_/test_casual.cpp
==============================================================================
--- sandbox/itl/libs/itl/test/test_casual_/test_casual.cpp (original)
+++ sandbox/itl/libs/itl/test/test_casual_/test_casual.cpp 2010-04-01 06:41:20 EDT (Thu, 01 Apr 2010)
@@ -38,6 +38,7 @@
using namespace unit_test;
using namespace boost::itl;
+/*CL after Proto
BOOST_AUTO_TEST_CASE(reverse_iter)
{
interval_map<int,int> map_a;
@@ -62,7 +63,7 @@
#include <limits>
#include <complex>
-BOOST_AUTO_TEST_CASE(casual)
+BOOST_AUTO_TEST_CASE(digits_to_check_numerics) //JODO Proto: properties of infinity.
{
cout << "--- limits ---\n";
cout << "max<char> = " << (std::numeric_limits<char>::max)() << endl;
@@ -78,4 +79,14 @@
BOOST_CHECK_EQUAL(0 != itl::infinity<int>::value(), true);
}
+*/
+
+#include <boost/itl/rightopen_interval.hpp>
+#include <boost/itl/type_traits/is_asymmetric_interval.hpp>
+
+BOOST_AUTO_TEST_CASE(casual)
+{
+ BOOST_CHECK_EQUAL(is_interval<rightopen_interval<int> >::value, true);
+ BOOST_CHECK_EQUAL(is_asymmetric_interval<rightopen_interval<int> >::value, true);
+}
Modified: sandbox/itl/libs/itl_xt/test/itvmaptester.h
==============================================================================
--- sandbox/itl/libs/itl_xt/test/itvmaptester.h (original)
+++ sandbox/itl/libs/itl_xt/test/itvmaptester.h 2010-04-01 06:41:20 EDT (Thu, 01 Apr 2010)
@@ -155,8 +155,8 @@
if(!correct) {
std::cout << "JoinIndependence violated ---------------------------" << std::endl;
- std::cout << "y :" << min_y.as_string().c_str() << std::endl;
- std::cout << "y_join:" << min_y_join.as_string().c_str() << std::endl;
+ std::cout << "y :" << min_y << std::endl;
+ std::cout << "y_join:" << min_y_join << std::endl;
}
return correct;
@@ -209,9 +209,9 @@
if(!correct) {
std::cout << "InsertAndJoinIndependence violated ---------------------------" << std::endl;
- std::cout << "y :" << min_y.as_string().c_str() << std::endl;
- std::cout << "y_perm :" << min_y_perm.as_string().c_str() << std::endl;
- std::cout << "y_pjoin:" << min_y_permJoin.as_string().c_str() << std::endl;
+ std::cout << "y :" << min_y << std::endl;
+ std::cout << "y_perm :" << min_y_perm << std::endl;
+ std::cout << "y_pjoin:" << min_y_permJoin << std::endl;
}
return correct;
@@ -290,21 +290,21 @@
if(!correct) {
std::cout << "InsertReversibility1: x + y - join(perm(y)) == x =: x2 violated --------" << std::endl;
- std::cout << "x :" << min_x.as_string().c_str() << std::endl;
- std::cout << "y :" << min_y.as_string().c_str() << std::endl;
- std::cout << "y_perm :" << min_y_perm.as_string().c_str() << std::endl;
- std::cout << "y_pJnt :" << min_y_permJoin.as_string().c_str() << std::endl;
- std::cout << "x+y :" << min_x_plus_y.as_string().c_str() << std::endl;
- std::cout << "x2 :" << min_x2.as_string().c_str() << std::endl;
+ std::cout << "x :" << min_x << std::endl;
+ std::cout << "y :" << min_y << std::endl;
+ std::cout << "y_perm :" << min_y_perm << std::endl;
+ std::cout << "y_pJnt :" << min_y_permJoin << std::endl;
+ std::cout << "x+y :" << min_x_plus_y << std::endl;
+ std::cout << "x2 :" << min_x2 << std::endl;
FILE* fp;
fp = fopen(errFile,"w");
- fprintf(fp, "x: %s\n", min_x.as_string().c_str());
- fprintf(fp, "y: %s\n", min_y.as_string().c_str());
- fprintf(fp, "y_perm: %s\n", min_y_perm.as_string().c_str());
- fprintf(fp, "y_pJnt: %s\n", min_y_permJoin.as_string().c_str());
- fprintf(fp, "x+y: %s\n", min_x_plus_y.as_string().c_str());
- fprintf(fp, "x2: %s\n", min_x2.as_string().c_str());
+ fprintf(fp, "x: %s\n", to_string<ItvMapTV>::apply(min_x).c_str());
+ fprintf(fp, "y: %s\n", to_string<ItvMapTV>::apply(min_y).c_str());
+ fprintf(fp, "y_perm: %s\n", to_string<ItvMapTV>::apply(min_y_perm).c_str());
+ fprintf(fp, "y_pJnt: %s\n", to_string<ItvMapTV>::apply(min_y_permJoin).c_str());
+ fprintf(fp, "x+y: %s\n", to_string<ItvMapTV>::apply(min_x_plus_y).c_str());
+ fprintf(fp, "x2: %s\n", to_string<ItvMapTV>::apply(min_x2).c_str());
min_x.isEqual(min_x2);
debugInsertReversibility1(min_x, min_y, min_y_perm);
@@ -405,22 +405,21 @@
if(!correct) {
std::cout << "InsertReversibility2: (x + join(perm(y)) - y).join() == x =: x2 violated --------" << std::endl;
- std::cout << "x :" << min_x.as_string().c_str() << std::endl;
- std::cout << "y :" << min_y.as_string().c_str() << std::endl;
- std::cout << "y_perm :" << min_y_perm.as_string().c_str() << std::endl;
- std::cout << "y_pJnt :" << min_y_permJoin.as_string().c_str() << std::endl;
- std::cout << "x+y_pJnt:" << min_x_plus_y_pj.as_string().c_str() << std::endl;
- std::cout << "x2 :" << min_x2.as_string().c_str() << std::endl;
-
+ std::cout << "x :" << min_x << std::endl;
+ std::cout << "y :" << min_y << std::endl;
+ std::cout << "y_perm :" << min_y_perm << std::endl;
+ std::cout << "y_pJnt :" << min_y_permJoin << std::endl;
+ std::cout << "x+y_pJnt:" << min_x_plus_y_pj << std::endl;
+ std::cout << "x2 :" << min_x2 << std::endl;
FILE* fp;
fp = fopen(errFile,"w");
- fprintf(fp, "x: %s\n", min_x.as_string().c_str());
- fprintf(fp, "y: %s\n", min_y.as_string().c_str());
- fprintf(fp, "y_perm: %s\n", min_y_perm.as_string().c_str());
- fprintf(fp, "y_pJnt: %s\n", min_y_permJoin.as_string().c_str());
- fprintf(fp, "x+y: %s\n", min_x_plus_y_pj.as_string().c_str());
- fprintf(fp, "x2: %s\n", min_x2.as_string().c_str());
+ fprintf(fp, "x: %s\n", to_string<ItvMapTV>::apply(min_x).c_str());
+ fprintf(fp, "y: %s\n", to_string<ItvMapTV>::apply(min_y).c_str());
+ fprintf(fp, "y_perm: %s\n", to_string<ItvMapTV>::apply(min_y_perm).c_str());
+ fprintf(fp, "y_pJnt: %s\n", to_string<ItvMapTV>::apply(min_y_permJoin).c_str());
+ fprintf(fp, "x+y: %s\n", to_string<ItvMapTV>::apply(min_x_plus_y_pj).c_str());
+ fprintf(fp, "x2: %s\n", to_string<ItvMapTV>::apply(min_x2).c_str());
debugInsertReversibility2(min_x, min_y, min_y_perm);
}
@@ -525,14 +524,13 @@
if(!correct) {
std::cout << "ErasureAsIntersectionComputability: x -~ y == x * (dom(x)-y) violated --------" << std::endl;
- std::cout << "x :" << min_x.as_string().c_str() << std::endl;
- std::cout << "y :" << min_y.as_string().c_str() << std::endl;
-
+ std::cout << "x :" << min_x << std::endl;
+ std::cout << "y :" << min_y << std::endl;
FILE* fp;
fp = fopen(errFile,"w");
- fprintf(fp, "x: %s\n", min_x.as_string().c_str());
- fprintf(fp, "y: %s\n", min_y.as_string().c_str());
+ fprintf(fp, "x: %s\n", to_string<ItvMapTV>::apply(min_x).c_str());
+ fprintf(fp, "y: %s\n", to_string<interval_set_type>::apply(min_y).c_str());
//debugInsertReversibility2(min_x, min_y, min_y_perm);
}
Modified: sandbox/itl/libs/itl_xt/test/itvsettester.h
==============================================================================
--- sandbox/itl/libs/itl_xt/test/itvsettester.h (original)
+++ sandbox/itl/libs/itl_xt/test/itvsettester.h 2010-04-01 06:41:20 EDT (Thu, 01 Apr 2010)
@@ -194,8 +194,8 @@
if(!correct) {
std::cout << "JoinIndependence violated ---------------------------" << std::endl;
- std::cout << "y :" << min_y.as_string().c_str() << std::endl;
- std::cout << "y_join:" << min_y_join.as_string().c_str() << std::endl;
+ std::cout << "y :" << min_y << std::endl;
+ std::cout << "y_join:" << min_y_join << std::endl;
}
return correct;
@@ -247,9 +247,9 @@
if(!correct) {
std::cout << "InsertAndJoinIndependence violated ---------------------------" << std::endl;
- std::cout << "y :" << min_y.as_string().c_str() << std::endl;
- std::cout << "y_perm :" << min_y_perm.as_string().c_str() << std::endl;
- std::cout << "y_pjoin:" << min_y_permJoin.as_string().c_str() << std::endl;
+ std::cout << "y :" << min_y << std::endl;
+ std::cout << "y_perm :" << min_y_perm << std::endl;
+ std::cout << "y_pjoin:" << min_y_permJoin << std::endl;
}
return correct;
@@ -332,24 +332,26 @@
if(!correct) {
std::cout << "InsertReversibility: x + y - join(perm(y)) == x - y violated --------" << std::endl;
- std::cout << "x :" << min_x.as_string().c_str() << std::endl;
- std::cout << "y :" << min_y.as_string().c_str() << std::endl;
- std::cout << "y_perm :" << min_y_perm.as_string().c_str() << std::endl;
- std::cout << "y_pJnt :" << min_y_permJoin.as_string().c_str() << std::endl;
- std::cout << "x+y :" << min_x_plus_y.as_string().c_str() << std::endl;
- std::cout << "lhs :" << min_lhs.as_string().c_str() << std::endl;
- std::cout << "rhs :" << min_rhs.as_string().c_str() << std::endl;
+ std::cout << "x :" << min_x << std::endl;
+ std::cout << "y :" << min_y << std::endl;
+ std::cout << "y_perm :" << min_y_perm << std::endl;
+ std::cout << "y_pJnt :" << min_y_permJoin << std::endl;
+ std::cout << "x+y :" << min_x_plus_y << std::endl;
+ std::cout << "lhs :" << min_lhs << std::endl;
+ std::cout << "rhs :" << min_rhs << std::endl;
FILE* fp;
fp = fopen(errFile,"w");
//fopen_s(&fp,errFile,"w");
- fprintf(fp, "x: %s\n", min_x.as_string().c_str());
- fprintf(fp, "y: %s\n", min_y.as_string().c_str());
- fprintf(fp, "y_perm: %s\n", min_y_perm.as_string().c_str());
- fprintf(fp, "y_pJnt: %s\n", min_y_permJoin.as_string().c_str());
- fprintf(fp, "x+y: %s\n", min_x_plus_y.as_string().c_str());
- fprintf(fp, "lhs: %s\n", min_lhs.as_string().c_str());
- fprintf(fp, "rhs: %s\n", min_rhs.as_string().c_str());
+ fprintf(fp, "x: %s\n", to_string<ItvSetTV>::apply(min_x).c_str());
+ /*JODO
+ fprintf(fp, "y: %s\n", to_string<ItvSetTV>::apply(min_y).c_str());
+ fprintf(fp, "y_perm: %s\n", to_string<ItvSetTV>::apply(min_y_perm).c_str());
+ fprintf(fp, "y_pJnt: %s\n", to_string<ItvSetTV>::apply(min_y_permJoin).c_str());
+ fprintf(fp, "x+y: %s\n", to_string<ItvSetTV>::apply(min_x_plus_y).c_str());
+ fprintf(fp, "lhs: %s\n", to_string<ItvSetTV>::apply(min_lhs).c_str());
+ fprintf(fp, "rhs: %s\n", to_string<ItvSetTV>::apply(min_rhs).c_str());
+ */
// min_lhs.isEqual(min_rhs);
// debugInsertReversibility1(min_x, min_y, min_y_perm);
@@ -440,21 +442,21 @@
if(!correct) {
std::cout << "InsertReversibility1: x + y - join(perm(y)) == x =: x2 violated --------" << std::endl;
- std::cout << "x :" << min_x.as_string().c_str() << std::endl;
- std::cout << "y :" << min_y.as_string().c_str() << std::endl;
- std::cout << "y_perm :" << min_y_perm.as_string().c_str() << std::endl;
- std::cout << "y_pJnt :" << min_y_permJoin.as_string().c_str() << std::endl;
- std::cout << "x+y :" << min_x_plus_y.as_string().c_str() << std::endl;
- std::cout << "x2 :" << min_x2.as_string().c_str() << std::endl;
+ std::cout << "x :" << min_x << std::endl;
+ std::cout << "y :" << min_y << std::endl;
+ std::cout << "y_perm :" << min_y_perm << std::endl;
+ std::cout << "y_pJnt :" << min_y_permJoin << std::endl;
+ std::cout << "x+y :" << min_x_plus_y << std::endl;
+ std::cout << "x2 :" << min_x2 << std::endl;
FILE* fp;
fp = fopen(errFile,"w");
- fprintf(fp, "x: %s\n", min_x.as_string().c_str());
- fprintf(fp, "y: %s\n", min_y.as_string().c_str());
- fprintf(fp, "y_perm: %s\n", min_y_perm.as_string().c_str());
- fprintf(fp, "y_pJnt: %s\n", min_y_permJoin.as_string().c_str());
- fprintf(fp, "x+y: %s\n", min_x_plus_y.as_string().c_str());
- fprintf(fp, "x2: %s\n", min_x2.as_string().c_str());
+ fprintf(fp, "x: %s\n", to_string<ItvSetTV>::apply(min_x).c_str());
+ fprintf(fp, "y: %s\n", to_string<ItvSetTV>::apply(min_y).c_str());
+ fprintf(fp, "y_perm: %s\n", to_string<ItvSetTV>::apply(min_y_perm).c_str());
+ fprintf(fp, "y_pJnt: %s\n", to_string<ItvSetTV>::apply(min_y_permJoin).c_str());
+ fprintf(fp, "x+y: %s\n", to_string<ItvSetTV>::apply(min_x_plus_y).c_str());
+ fprintf(fp, "x2: %s\n", to_string<ItvSetTV>::apply(min_x2).c_str());
min_x.isEqual(min_x2);
debugInsertReversibility1(min_x, min_y, min_y_perm);
@@ -578,29 +580,14 @@
if(!correct) {
std::cout << "SymmetricDifference: (x + y) - (x * y) == (x - y) + (y - x) violated --------" << std::endl;
- std::cout << "x :" << min_x.as_string().c_str() << std::endl;
- std::cout << "y :" << min_y.as_string().c_str() << std::endl;
- /*
- std::cout << "y_perm :" << min_y_perm.as_string().c_str() << std::endl;
- std::cout << "y_pJnt :" << min_y_permJoin.as_string().c_str() << std::endl;
- std::cout << "x+y :" << min_x_plus_y.as_string().c_str() << std::endl;
- std::cout << "x2 :" << min_x2.as_string().c_str() << std::endl;
- */
+ std::cout << "x :" << min_x << std::endl;
+ std::cout << "y :" << min_y << std::endl;
FILE* fp;
fp = fopen(errFile,"w");
//fopen_s(&fp,errFile,"w");
- fprintf(fp, "x: %s\n", min_x.as_string().c_str());
- fprintf(fp, "y: %s\n", min_y.as_string().c_str());
- /*
- fprintf(fp, "y_perm: %s\n", min_y_perm.as_string().c_str());
- fprintf(fp, "y_pJnt: %s\n", min_y_permJoin.as_string().c_str());
- fprintf(fp, "x+y: %s\n", min_x_plus_y.as_string().c_str());
- fprintf(fp, "x2: %s\n", min_x2.as_string().c_str());
-
- min_x.isEqual(min_x2);
- debugInsertReversibility1(min_x, min_y, min_y_perm);
- */
+ fprintf(fp, "x: %s\n", to_string<ItvSetTV>::apply(min_x).c_str());
+ fprintf(fp, "y: %s\n", to_string<ItvSetTV>::apply(min_y).c_str());
}
else
{
Modified: sandbox/itl/libs/validate/example/labat_collector_/vc9_labat_collector.vcproj
==============================================================================
--- sandbox/itl/libs/validate/example/labat_collector_/vc9_labat_collector.vcproj (original)
+++ sandbox/itl/libs/validate/example/labat_collector_/vc9_labat_collector.vcproj 2010-04-01 06:41:20 EDT (Thu, 01 Apr 2010)
@@ -196,6 +196,10 @@
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
+ RelativePath="..\..\..\..\boost\validate\driver\collector_driver.hpp"
+ >
+ </File>
+ <File
RelativePath="..\..\..\..\boost\validate\law.h"
>
</File>
Modified: sandbox/itl/libs/validate/example/labat_itl_set_/vc9_labat_itl_set.vcproj
==============================================================================
--- sandbox/itl/libs/validate/example/labat_itl_set_/vc9_labat_itl_set.vcproj (original)
+++ sandbox/itl/libs/validate/example/labat_itl_set_/vc9_labat_itl_set.vcproj 2010-04-01 06:41:20 EDT (Thu, 01 Apr 2010)
@@ -196,6 +196,10 @@
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
+ RelativePath="..\..\..\..\boost\validate\driver\itl_set_driver.hpp"
+ >
+ </File>
+ <File
RelativePath="..\..\..\..\boost\validate\law.h"
>
</File>
Modified: sandbox/itl/libs/validate/example/labat_set_copy_conformity_/vc9_labat_set_copy_conformity.vcproj
==============================================================================
--- sandbox/itl/libs/validate/example/labat_set_copy_conformity_/vc9_labat_set_copy_conformity.vcproj (original)
+++ sandbox/itl/libs/validate/example/labat_set_copy_conformity_/vc9_labat_set_copy_conformity.vcproj 2010-04-01 06:41:20 EDT (Thu, 01 Apr 2010)
@@ -224,6 +224,10 @@
>
</File>
<File
+ RelativePath="..\..\..\..\boost\validate\driver\set_copy_conformity_driver.hpp"
+ >
+ </File>
+ <File
RelativePath="..\..\..\..\boost\validate\laws\set_laws.h"
>
</File>
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-04-01 06:41:20 EDT (Thu, 01 Apr 2010)
@@ -71,7 +71,7 @@
//LawValidater<TestLawT, RandomGentor> test_law;
typedef InplaceSymmetricDifference
- <interval_map<int,double,total_absorber> > TestLawT;
+ <interval_set<int> > TestLawT;
LawValidater<TestLawT, RandomGentor> test_law;
//-----------------------------------------------------------------------------
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