|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r65132 - in sandbox/itl: boost/itl boost/itl/detail boost/itl/type_traits boost/itl_xt boost/validate/laws libs/itl/example/large_bitset_ libs/itl/test libs/itl/test/test_casual_ libs/validate/example/labat_single_
From: afojgo_at_[hidden]
Date: 2010-08-30 10:13:14
Author: jofaber
Date: 2010-08-30 10:13:10 EDT (Mon, 30 Aug 2010)
New Revision: 65132
URL: http://svn.boost.org/trac/boost/changeset/65132
Log:
Refactoring. Separated static parts of algorithms using functor classes with partial specialization.
Isolated pivotal parts to help avoid code replication in partial specialization.
Stable{msvc-9.0, gcc-3.4.4}
Added:
sandbox/itl/boost/itl/detail/associated_value.hpp (contents, props changed)
sandbox/itl/boost/itl/type_traits/adds_inversely.hpp (contents, props changed)
sandbox/itl/boost/itl/type_traits/codomain_type_of.hpp (contents, props changed)
sandbox/itl/boost/itl/type_traits/has_set_semantics.hpp (contents, props changed)
sandbox/itl/boost/itl/type_traits/is_container.hpp (contents, props changed)
sandbox/itl/boost/itl/type_traits/is_key_container_of.hpp (contents, props changed)
Text files modified:
sandbox/itl/boost/itl/detail/element_comparer.hpp | 4
sandbox/itl/boost/itl/detail/interval_map_algo.hpp | 4
sandbox/itl/boost/itl/detail/interval_morphism.hpp | 4
sandbox/itl/boost/itl/detail/interval_subset_comparer.hpp | 6
sandbox/itl/boost/itl/detail/map_functors.hpp | 406 +++++++++++----------------------------
sandbox/itl/boost/itl/detail/set_algo.hpp | 2
sandbox/itl/boost/itl/detail/subset_comparer.hpp | 6
sandbox/itl/boost/itl/functors.hpp | 5
sandbox/itl/boost/itl/interval_base_map.hpp | 16 -
sandbox/itl/boost/itl/interval_base_set.hpp | 2
sandbox/itl/boost/itl/interval_map.hpp | 8
sandbox/itl/boost/itl/interval_set.hpp | 2
sandbox/itl/boost/itl/map.hpp | 21 -
sandbox/itl/boost/itl/map_functions.hpp | 112 +++++++---
sandbox/itl/boost/itl/separate_interval_set.hpp | 1
sandbox/itl/boost/itl/set.hpp | 6
sandbox/itl/boost/itl/split_interval_map.hpp | 9
sandbox/itl/boost/itl/split_interval_set.hpp | 1
sandbox/itl/boost/itl_xt/bits.hpp | 2
sandbox/itl/boost/validate/laws/order.hpp | 20 +
sandbox/itl/libs/itl/example/large_bitset_/bits.hpp | 7
sandbox/itl/libs/itl/test/fastest_partial_icl_quantifier_cases.hpp | 1
sandbox/itl/libs/itl/test/test_casual_/test_casual.cpp | 36 +++
sandbox/itl/libs/itl/test/test_icl_quantifier_shared.hpp | 2
sandbox/itl/libs/itl/test/test_laws.hpp | 17 +
sandbox/itl/libs/itl/test/test_value_maker.hpp | 9
sandbox/itl/libs/validate/example/labat_single_/labat_single.cpp | 20 +
27 files changed, 325 insertions(+), 404 deletions(-)
Added: sandbox/itl/boost/itl/detail/associated_value.hpp
==============================================================================
--- (empty file)
+++ sandbox/itl/boost/itl/detail/associated_value.hpp 2010-08-30 10:13:10 EDT (Mon, 30 Aug 2010)
@@ -0,0 +1,43 @@
+/*-----------------------------------------------------------------------------+
+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_DETAIL_ASSOCIATED_VALUE_HPP_JOFA_100829
+#define BOOST_ITL_DETAIL_ASSOCIATED_VALUE_HPP_JOFA_100829
+
+#include <boost/itl/detail/design_config.hpp>
+#include <boost/itl/type_traits/is_combinable.hpp>
+#include <boost/mpl/not.hpp>
+#include <boost/mpl/and.hpp>
+
+namespace boost{namespace itl
+{
+
+template<class ObjectT, class CoObjectT> //JODO Only maps of equal iterability shall match!
+typename enable_if< mpl::and_< is_domain_compare_equal<ObjectT,CoObjectT>
+ , mpl::and_<is_map<ObjectT>, is_map<CoObjectT> > >,
+ bool>::type
+co_equal(typename ObjectT::const_iterator left_, typename CoObjectT::const_iterator right_,
+ const ObjectT& left, const CoObjectT& right)
+{
+ return ObjectT::co_value(left_) == CoObjectT::co_value(right_);
+}
+
+template<class ObjectT, class CoObjectT>
+typename enable_if< mpl::and_< is_domain_compare_equal<ObjectT,CoObjectT>
+ , mpl::not_<mpl::and_<is_map<ObjectT>, is_map<CoObjectT> > > >,
+ bool>::type
+co_equal(typename ObjectT::const_iterator, typename CoObjectT::const_iterator,
+ const ObjectT&, const CoObjectT&)
+{
+ return true;
+}
+
+
+}} // namespace itl boost
+
+#endif
+
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-08-30 10:13:10 EDT (Mon, 30 Aug 2010)
@@ -51,9 +51,9 @@
bool covalues_are_equal(LeftIterT& left, RightIterT& right)
{
- if(LeftT::codomain_value(left) < RightT::codomain_value(right))
+ if(LeftT::co_value(left) < RightT::co_value(right))
_result = less;
- if(RightT::codomain_value(right) < LeftT::codomain_value(left))
+ if(RightT::co_value(right) < LeftT::co_value(left))
_result = greater;
return _result == equal;
}
Modified: sandbox/itl/boost/itl/detail/interval_map_algo.hpp
==============================================================================
--- sandbox/itl/boost/itl/detail/interval_map_algo.hpp (original)
+++ sandbox/itl/boost/itl/detail/interval_map_algo.hpp 2010-08-30 10:13:10 EDT (Mon, 30 Aug 2010)
@@ -41,10 +41,10 @@
++next_;
const typename IntervalMapT::codomain_type& co_value
- = IntervalMapT::codomain_value(first);
+ = IntervalMapT::co_value(first);
while(it_ != past)
{
- if(IntervalMapT::codomain_value(next_) != co_value)
+ if(IntervalMapT::co_value(next_) != co_value)
return false;
if(!itl::touches(IntervalMapT::key_value(it_++),
IntervalMapT::key_value(next_++)))
Modified: sandbox/itl/boost/itl/detail/interval_morphism.hpp
==============================================================================
--- sandbox/itl/boost/itl/detail/interval_morphism.hpp (original)
+++ sandbox/itl/boost/itl/detail/interval_morphism.hpp 2010-08-30 10:13:10 EDT (Mon, 30 Aug 2010)
@@ -19,7 +19,7 @@
ITL_const_FORALL(typename IntervalContainerT, itv_, src)
{
const typename IntervalContainerT::key_type& itv = IntervalContainerT::key_value(itv_);
- typename IntervalContainerT::codomain_type coval = IntervalContainerT::codomain_value(itv_);
+ typename IntervalContainerT::codomain_type coval = IntervalContainerT::co_value(itv_);
for(typename IntervalContainerT::domain_type element = first(itv); element <= last(itv); ++element)
{
@@ -36,7 +36,7 @@
ITL_const_FORALL(typename ElementContainerT, element_, src)
{
const typename ElementContainerT::key_type& key = ElementContainerT::key_value(element_);
- const typename ElementContainerT::data_type& data = ElementContainerT::codomain_value(element_);
+ const typename ElementContainerT::data_type& data = ElementContainerT::co_value(element_);
result += IntervalContainerT::make_value(key_type(key), data);
}
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-08-30 10:13:10 EDT (Mon, 30 Aug 2010)
@@ -34,8 +34,8 @@
{
static int apply(typename LeftT::const_iterator& left_, typename RightT::const_iterator& right_)
{
- return inclusion_compare( LeftT::codomain_value(left_),
- RightT::codomain_value(right_));
+ return inclusion_compare( LeftT::co_value(left_),
+ RightT::co_value(right_));
}
};
@@ -44,7 +44,7 @@
{
static int apply(typename LeftT::const_iterator& left_, typename RightT::const_iterator& right_)
{
- if(LeftT::codomain_value(left_) == RightT::codomain_value(right_))
+ if(LeftT::co_value(left_) == RightT::co_value(right_))
return inclusion::equal;
else
return inclusion::unrelated;
Modified: sandbox/itl/boost/itl/detail/map_functors.hpp
==============================================================================
--- sandbox/itl/boost/itl/detail/map_functors.hpp (original)
+++ sandbox/itl/boost/itl/detail/map_functors.hpp 2010-08-30 10:13:10 EDT (Mon, 30 Aug 2010)
@@ -1,5 +1,5 @@
/*-----------------------------------------------------------------------------+
-Copyright (c) 2007-2010: Joachim Faulhaber
+Copyright (c) 2010-2010: Joachim Faulhaber
+------------------------------------------------------------------------------+
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENCE.txt or copy at
@@ -9,6 +9,8 @@
#define BOOST_ITL_DETAIL_MAP_FUNCTORS_HPP_JOFA_100823
#include <boost/itl/detail/design_config.hpp>
+#include <boost/itl/detail/associated_value.hpp>
+#include <boost/itl/type_traits/adds_inversely.hpp>
#include <boost/itl/functors.hpp>
#include <boost/itl/map_functions.hpp>
@@ -21,18 +23,6 @@
//JODO e.g. erase_if and subtract. Forward decl should not be necessary
//JODO but may be it is better to use forward decls only instead of inlclues here.
-
-template<class MapT, class Combiner> //JODO locate
-struct adds_inversely
-{
- typedef adds_inversely type;
- BOOST_STATIC_CONSTANT(bool,
- value = (mpl::and_< has_inverse<typename MapT::codomain_type>
- , is_negative<Combiner>
- >::value));
-};
-
-
template<class MapT, class Combiner, bool creates_inverse>
struct element_version
{
@@ -56,193 +46,119 @@
};
//==============================================================================
-//=P Containment
-//==============================================================================
+//JODO should be made usable for interval maps too and must go to it's own file
+// in itl/detail
-template<class MapT>
-struct map_within
+template<class MapT, class Combiner, bool absorbs_neutrons>
+struct absorbs_neutron
{
- typedef typename MapT::set_type set_type;
+ static bool apply(const typename MapT::codomain_type& value);
+};
- static bool apply(const typename MapT::set_type& sub, const MapT& super)
- {
- if(itl::is_empty(sub)) return true;
- if(itl::is_empty(super)) return false;
- if(itl::size(super) < itl::size(sub)) return false;
+template<class MapT, class Combiner>
+struct absorbs_neutron<MapT,Combiner,false>
+{
+ static bool apply(const typename MapT::codomain_type&){ return false; }
+};
- typename set_type::const_iterator common_lwb_;
- typename set_type::const_iterator common_upb_;
- if(!Set::common_range(common_lwb_, common_upb_, sub, super))
- return false;
+template<class MapT, class Combiner>
+struct absorbs_neutron<MapT,Combiner,true>
+{
+ static bool apply(const typename MapT::codomain_type& value)
+ { return value == Combiner::neutron(); }
+};
- typename set_type::const_iterator sub_ = sub.begin();
- typename MapT::const_iterator super_;
- while(sub_ != seqs<MapT>::end(sub))
- {
- super_ = seqs<MapT>::find(super, *sub_++);
- if(super_ == seqs<MapT>::end(super))
- return false;
- }
- return true;
- }
+//------------------------------------------------------------------------------
+template<class MapT, class Combiner, bool absorbs_neutrons>
+struct handle_neutron
+{
+ typedef typename MapT::iterator iterator;
+ static iterator apply(MapT& object, iterator it);
+};
- static bool apply(const MapT& sub, const MapT& super)
- {
- if(&super == &sub) return true;
- if(itl::is_empty(sub)) return true;
- if(itl::is_empty(super)) return false;
- if(itl::size(super) < itl::size(sub)) return false;
-
- typename MapT::const_iterator common_lwb_;
- typename MapT::const_iterator common_upb_;
- if(!Set::common_range(common_lwb_, common_upb_, sub, super))
- return false;
+template<class MapT, class Combiner>
+struct handle_neutron<MapT,Combiner,false>
+{
+ typedef typename MapT::iterator iterator;
+ static iterator apply(MapT&, iterator it)
+ { return it; }
+};
- typename MapT::const_iterator sub_ = sub.begin(), super_;
- while(sub_ != seqs<MapT>::end(sub))
- {
- super_ = seqs<MapT>::find(super, seqs<MapT>::key_value(sub_));
- if(super_ == super.end())
- return false;
- else if(!(seqs<MapT>::co_value(sub_) == seqs<MapT>::co_value(super_)))
- return false;
- sub_++;
+template<class MapT, class Combiner>
+struct handle_neutron<MapT,Combiner,true>
+{
+ typedef typename MapT::iterator iterator;
+ static iterator apply(MapT& object, iterator it)
+ {
+ if(it->second == Combiner::neutron())
+ {
+ object.erase(it);
+ return object.end();
}
- return true;
+ return it;
}
};
//==============================================================================
-//=P Addition
-//==============================================================================
-template<class MapT, class Combiner, bool absorbs_neutrons>
-struct map_add
-{
- typedef MapT map_type;
- typedef typename map_type::value_type value_type;
- typedef typename map_type::element_type element_type;
- typedef typename map_type::iterator iterator;
- static MapT& apply(map_type& object, const value_type& value_pair);
- static iterator apply(map_type& object, iterator prior, const element_type& value_pair);
-};
+//==============================================================================
+//=P Addition
+//==============================================================================
-template <class MapT, class Combiner>
-struct map_add<MapT, Combiner, true>
-{ // absorbs_neutrons
+template <class MapT, class Combiner, bool absorbs_neutrons>
+struct map_add
+{
typedef MapT map_type;
typedef typename map_type::value_type value_type;
typedef typename map_type::element_type element_type;
typedef typename map_type::codomain_type codomain_type;
typedef typename map_type::iterator iterator;
- BOOST_STATIC_CONSTANT(bool, co_version = (adds_inversely<MapT,Combiner>::value));
+ BOOST_STATIC_CONSTANT(bool,
+ co_version = (adds_inversely<codomain_type,Combiner>::value));
- static map_type& apply(map_type& object, const value_type& val)
+ static map_type& apply(map_type& object, const value_type& value_pair)
{
- if(val.second == Combiner::neutron())
+ if(absorbs_neutron<MapT,Combiner,absorbs_neutrons>::apply(value_pair.second))
return object;
- // if Combiner is negative e.g. subtract and
- std::pair<iterator, bool> insertion = // the codomain has an inverse, we have to
- seqs<map_type>::insert(object, // insert the inverse element of val.second
- element_version<MapT,Combiner,co_version>::apply(val));
+
+ // if Combiner is negative e.g. subtract and the codomain has an inverse,
+ // we have to insert the inverse element of value_pair.second
+ std::pair<iterator, bool> insertion =
+ object.insert(element_version<MapT,Combiner,co_version>::apply(value_pair));
if( insertion.second )
return object;
else
{
iterator it = insertion.first;
- Combiner()((*it).second, val.second); // If this combination results in a
- // neutral element,
- if((*it).second == Combiner::neutron()) // it has to be removed.
- seqs<map_type>::erase(object, it);
-
+ Combiner()((*it).second, value_pair.second);
+
+ handle_neutron<MapT,Combiner,absorbs_neutrons>::apply(object, it);
return object;
}
}
-
static iterator apply(map_type& object, iterator prior, const element_type& value_pair)
{
- if(value_pair.second == Combiner::neutron())
- return seqs<map_type>::end(object);
+ if(absorbs_neutron<MapT,Combiner,absorbs_neutrons>::apply(value_pair.second))
+ return object.end();
iterator inserted_
- = seqs<map_type>::insert(object, prior,
- value_type(value_pair.first, Combiner::neutron()));
+ = object.insert(prior, value_type(value_pair.first, Combiner::neutron()));
Combiner()(inserted_->second, value_pair.second); // May generate an inverse via inv(x)= 0-x
- if(inserted_->second == Combiner::neutron())
- {
- seqs<map_type>::erase(object, inserted_);
- return seqs<map_type>::end(object);
- }
- else
- return inserted_;
+ return handle_neutron<MapT,Combiner,absorbs_neutrons>::apply(object, inserted_);
}
};
-template <class MapT, class Combiner>
-struct map_add<MapT, Combiner, false>
-{ // !absorbs_neutrons
- typedef MapT map_type;
- typedef typename map_type::value_type value_type;
- typedef typename map_type::element_type element_type;
- typedef typename map_type::codomain_type codomain_type;
- typedef typename map_type::iterator iterator;
-
- BOOST_STATIC_CONSTANT(bool, co_version = (adds_inversely<MapT,Combiner>::value));
-
- static map_type& apply(map_type& object, const value_type& value_pair)
- {
- std::pair<iterator, bool> insertion =
- seqs<map_type>::insert(object,
- element_version<MapT,Combiner,co_version>::apply(value_pair));
-
- if( insertion.second )
- return object;
- else
- {
- iterator it = insertion.first;
- Combiner()((*it).second, value_pair.second);
- return object;
- }
- }
-
- static iterator apply(map_type& object, iterator prior, const element_type& value_pair)
- {
- iterator inserted_
- = seqs<MapT>::insert(object, prior,
- value_type(value_pair.first, Combiner::neutron()));
- Combiner()(inserted_->second, value_pair.second); // May generate an inverse via inv(x)= 0-x
- return inserted_;
- }
-
-};
-
//==============================================================================
-//=P Subtraction
+//=P Subtraction < is_total && is_invertible >
//==============================================================================
-//------------------------------------------------------------------------------
-//-P Subtraction for partial maps
-//------------------------------------------------------------------------------
-
-template<class MapT, class Combiner, bool absorbs_neutrons>
-struct map_partial_subtract
-{
- typedef MapT map_type;
- typedef typename map_type::domain_type domain_type;
- typedef typename map_type::element_type element_type;
-
- static map_type& apply(map_type&, const element_type&);
-};
-
-//------------------------------------------------------------------------------
-
template<class MapT, bool is_total_invertible>
struct map_subtract
{
@@ -272,57 +188,26 @@
template<class MapT>
struct map_subtract<MapT, false>
{
- typedef MapT map_type;
- typedef typename map_type::element_type element_type;
- typedef typename map_type::inverse_codomain_combine inverse_codomain_combine;
-
- static map_type& apply(map_type& object, const element_type& value_pair)
- {
- return map_partial_subtract<map_type
- ,inverse_codomain_combine
- ,absorbs_neutrons<MapT>::value >
- ::apply(object, value_pair);
- }
-};
-
-template<class MapT, class Combiner>
-struct map_partial_subtract<MapT, Combiner, true>
-{
typedef MapT map_type;
typedef typename map_type::element_type element_type;
typedef typename map_type::codomain_combine codomain_combine;
+ typedef typename map_type::inverse_codomain_combine
+ inverse_codomain_combine;
typedef typename map_type::iterator iterator;
+ BOOST_STATIC_CONSTANT(bool, absorbs = (absorbs_neutrons<MapT>::value));
static map_type& apply(map_type& object, const element_type& value_pair)
{
- iterator it_ = seqs<map_type>::find(object, value_pair.first);
- if(it_ != seqs<map_type>::end(object))
+ iterator it_ = object.find(value_pair.first);
+ if(it_ != object.end())
{
- Combiner()((*it_).second, value_pair.second);
- if((*it_).second == codomain_combine::neutron())
- seqs<map_type>::erase(object, it_);
+ inverse_codomain_combine()((*it_).second, value_pair.second);
+ handle_neutron<MapT,codomain_combine,absorbs>::apply(object,it_);
}
return object;
}
};
-template<class MapT, class Combiner>
-struct map_partial_subtract<MapT, Combiner, false>
-{
- typedef MapT map_type;
- typedef typename map_type::element_type element_type;
- typedef typename map_type::iterator iterator;
-
- static map_type& apply(map_type& object, const element_type& value_pair)
- {
- iterator it_ = seqs<MapT>::find(object, value_pair.first);
- if(it_ != seqs<MapT>::end(object))
- Combiner()((*it_).second, value_pair.second);
-
- return object;
- }
-};
-
//==============================================================================
//=P Insertion
@@ -331,18 +216,6 @@
template<class MapT, class Combiner, bool absorbs_neutrons>
struct map_insert
{
- typedef MapT map_type;
- typedef typename map_type::domain_type domain_type;
- typedef typename map_type::element_type element_type;
- typedef typename map_type::iterator iterator;
-
- static map_type& apply(map_type&, const element_type&);
- static map_type& apply(map_type&, iterator, const element_type&);
-};
-
-template<class MapT, class Combiner>
-struct map_insert<MapT, Combiner, true>
-{
typedef MapT map_type;
typedef typename map_type::element_type element_type;
typedef typename map_type::codomain_combine codomain_combine;
@@ -350,37 +223,18 @@
static std::pair<iterator,bool> apply(map_type& object, const element_type& value_pair)
{
- if(value_pair.second == codomain_combine::neutron())
+ if(absorbs_neutron<MapT,Combiner,absorbs_neutrons>::apply(value_pair.second))
return std::pair<iterator,bool>(object.end(),true);
else
- return seqs<map_type>::insert(object, value_pair);
+ return object.insert(value_pair);
}
static iterator apply(map_type& object, iterator prior, const element_type& value_pair)
{
- if(value_pair.second == codomain_combine::neutron())
- return seqs<map_type>::end(object);
+ if(absorbs_neutron<MapT,Combiner,absorbs_neutrons>::apply(value_pair.second))
+ return object.end();
else
- return seqs<map_type>::insert(object, prior, value_pair);
- }
-
-};
-
-template<class MapT, class Combiner>
-struct map_insert<MapT, Combiner, false>
-{
- typedef MapT map_type;
- typedef typename map_type::element_type element_type;
- typedef typename map_type::iterator iterator;
-
- static std::pair<iterator,bool> apply(map_type& object, const element_type& value_pair)
- {
- return seqs<MapT>::insert(object, value_pair);
- }
-
- static iterator apply(map_type& object, iterator prior, const element_type& value_pair)
- {
- return seqs<MapT>::insert(object, prior, value_pair);
+ return object.insert(prior, value_pair);
}
};
@@ -398,64 +252,27 @@
typedef typename map_type::size_type size_type;
typedef typename map_type::iterator iterator;
- static size_type apply(map_type&, const element_type&);
-
static size_type apply(map_type& object, const domain_type& key)
{
- iterator it_ = seqs<map_type>::find(object, key);
- if(it_ != seqs<map_type>::end(object))
+ iterator it_ = object.find(key);
+ if(it_ != object.end())
{
- seqs<map_type>::erase(object, it_);
+ object.erase(it_);
return 1;
}
return 0;
}
-};
-
-template<class MapT, class Combiner>
-struct map_erase<MapT, Combiner, true>
-{
- typedef MapT map_type;
- typedef typename map_type::domain_type domain_type;
- typedef typename map_type::element_type element_type;
- typedef typename map_type::size_type size_type;
- typedef typename map_type::codomain_combine codomain_combine;
- typedef typename map_type::iterator iterator;
-
static size_type apply(map_type& object, const element_type& value_pair)
{
- if(value_pair.second == codomain_combine::neutron())
- return 0; // neutrons are never contained 'substantially'
- // only 'virtually'.
+ if(absorbs_neutron<MapT,Combiner,absorbs_neutrons>::apply(value_pair.second))
+ return 0; // neutrons are never contained 'substantially' only 'virtually'.
- iterator it_ = seqs<map_type>::find(object, value_pair.first);
- if(it_ != seqs<map_type>::end(object) && value_pair.second == it_->second)
+ iterator it_ = object.find(value_pair.first);
+ if(it_ != object.end() && value_pair.second == it_->second)
{
- seqs<map_type>::erase(object, it_);
- return 1;
- }
-
- return 0;
- }
-};
-
-template<class MapT, class Combiner>
-struct map_erase<MapT, Combiner, false>
-{
- typedef MapT map_type;
- typedef typename map_type::domain_type domain_type;
- typedef typename map_type::element_type element_type;
- typedef typename map_type::size_type size_type;
- typedef typename map_type::iterator iterator;
-
- static size_type apply(map_type& object, const element_type& value_pair)
- {
- iterator it_ = seqs<map_type>::find(object, value_pair.first);
- if(it_ != seqs<map_type>::end(object) && value_pair.second == it_->second)
- {
- seqs<map_type>::erase(object, it_);
+ object.erase(it_);
return 1;
}
@@ -483,16 +300,20 @@
template<class MapT>
struct map_add_intersection<MapT, true>
{ // is_total
- typedef MapT map_type;
- typedef typename map_type::domain_type domain_type;
- typedef typename map_type::element_type element_type;
+ typedef MapT map_type;
+ typedef typename map_type::domain_type domain_type;
+ typedef typename map_type::element_type element_type;
+ typedef typename map_type::codomain_combine codomain_combine;
+ typedef typename map_type::const_iterator const_iterator;
+ BOOST_STATIC_CONSTANT(bool, absorbs = (absorbs_neutrons<MapT>::value));
static map_type& apply(map_type& section, const map_type& object, const domain_type& key_value)
{
- typename map_type::const_iterator it_ = seqs<map_type>::find(object, key_value);
- if(it_ != seqs<map_type>::end(object))
- itl::add(section, *it_);
+ const_iterator it_ = object.find(key_value);
+ if(it_ != object.end())
+ //itl::add(section, *it_);
+ map_add<map_type,codomain_combine,absorbs>::apply(section, *it_);
return section;
}
@@ -516,8 +337,8 @@
static map_type& apply(map_type& section, const map_type& object, const domain_type& key_value)
{
- const_iterator it_ = seqs<map_type>::find(object, key_value);
- if(it_ != seqs<map_type>::end(object))
+ const_iterator it_ = object.find(key_value);
+ if(it_ != object.end())
map_add<map_type,codomain_intersect,absorbs>::apply(section, *it_);
return section;
@@ -525,8 +346,8 @@
static map_type& apply(map_type& section, const map_type& object, const element_type& value_pair)
{
- const_iterator it_ = seqs<map_type>::find(object, value_pair.first);
- if(it_ != seqs<map_type>::end(object))
+ const_iterator it_ = object.find(value_pair.first);
+ if(it_ != object.end())
{
map_add<map_type,codomain_intersect,absorbs>::apply(section, *it_);
map_add<map_type,codomain_intersect,absorbs>::apply(section, value_pair);
@@ -576,7 +397,7 @@
{
MapT section;
map_add_intersection<MapT,false>::apply(section, object, operand);
- seqs<MapT>::swap(object, section);
+ object.swap(section);
return object;
}
@@ -592,8 +413,8 @@
const_iterator sec_ = common_lwb_;
while(sec_ != common_upb_)
{
- const_iterator it_ = seqs<MapT>::find(object, sec_->first);
- if(it_ != seqs<MapT>::end(object))
+ const_iterator it_ = object.find(sec_->first);
+ if(it_ != object.end())
{
itl::add(section, *it_);
map_add<MapT, codomain_intersect, absorbs_neutrons<MapT>::value >::apply(section, *sec_);
@@ -602,7 +423,7 @@
}
}
- seqs<MapT>::swap(object, section);
+ object.swap(section);
return object;
}
@@ -727,7 +548,7 @@
{ // is_total, !absorbs_neutrons
typedef MapT map_type;
typedef typename map_type::codomain_type codomain_type;
- BOOST_STATIC_CONSTANT(bool, codomain_is_set = (is_set<codomain_type>::value));
+ BOOST_STATIC_CONSTANT(bool, codomain_is_set = (has_set_semantics<codomain_type>::value));
static map_type& apply(map_type& object, const map_type& operand)
{
@@ -745,7 +566,7 @@
{ // !is_total
typedef MapT map_type;
typedef typename map_type::codomain_type codomain_type;
- BOOST_STATIC_CONSTANT(bool, codomain_is_set = (is_set<codomain_type>::value));
+ BOOST_STATIC_CONSTANT(bool, codomain_is_set = (has_set_semantics<codomain_type>::value));
static map_type& apply(map_type& object, const map_type& operand)
{
@@ -773,8 +594,8 @@
static void apply(MapT& result, const MapT& x2)
{
- const_iterator x2_ = seqs<MapT>::begin(x2);
- while(x2_ != seqs<MapT>::end(x2))
+ const_iterator x2_ = x2.begin();
+ while(x2_ != x2.end())
apply(result, *x2_++);
}
};
@@ -809,15 +630,12 @@
static void apply(MapT& result, const MapT& x2)
{
- const_iterator x2_ = seqs<MapT>::begin(x2);
- while(x2_ != seqs<MapT>::end(x2))
+ const_iterator x2_ = x2.begin();
+ while(x2_ != x2.end())
apply(result, *x2_++);
}
};
-
-
-
//=============================================================================
//=P Neutron absorbtion
//=============================================================================
Modified: sandbox/itl/boost/itl/detail/set_algo.hpp
==============================================================================
--- sandbox/itl/boost/itl/detail/set_algo.hpp (original)
+++ sandbox/itl/boost/itl/detail/set_algo.hpp 2010-08-30 10:13:10 EDT (Mon, 30 Aug 2010)
@@ -13,7 +13,7 @@
#include <boost/itl/detail/notate.hpp>
#include <boost/itl/predicates.hpp>
#include <boost/itl/functors.hpp>
-#include <boost/itl/seqs.hpp>
+//CL #include <boost/itl/seqs.hpp>
/*
<b>SetAlgo </b>
Modified: sandbox/itl/boost/itl/detail/subset_comparer.hpp
==============================================================================
--- sandbox/itl/boost/itl/detail/subset_comparer.hpp (original)
+++ sandbox/itl/boost/itl/detail/subset_comparer.hpp 2010-08-30 10:13:10 EDT (Mon, 30 Aug 2010)
@@ -34,8 +34,8 @@
{
static int apply(typename LeftT::const_iterator& left_, typename RightT::const_iterator& right_)
{
- return inclusion_compare( LeftT::codomain_value(left_),
- RightT::codomain_value(right_));
+ return inclusion_compare( LeftT::co_value(left_),
+ RightT::co_value(right_));
}
};
@@ -44,7 +44,7 @@
{
static int apply(typename LeftT::const_iterator& left_, typename RightT::const_iterator& right_)
{
- if(LeftT::codomain_value(left_) == RightT::codomain_value(right_))
+ if(LeftT::co_value(left_) == RightT::co_value(right_))
return inclusion::equal;
else
return inclusion::unrelated;
Modified: sandbox/itl/boost/itl/functors.hpp
==============================================================================
--- sandbox/itl/boost/itl/functors.hpp (original)
+++ sandbox/itl/boost/itl/functors.hpp 2010-08-30 10:13:10 EDT (Mon, 30 Aug 2010)
@@ -14,6 +14,7 @@
#include <boost/itl/type_traits/neutron.hpp>
#include <boost/itl/type_traits/unon.hpp>
#include <boost/itl/type_traits/is_set.hpp>
+#include <boost/itl/type_traits/has_set_semantics.hpp>
namespace boost{namespace itl
{
@@ -274,7 +275,7 @@
: public neutron_based_inplace_combine<Type>
{
typedef typename boost::mpl::
- if_<is_set<Type>,
+ if_<has_set_semantics<Type>,
itl::inplace_et<Type>,
itl::inplace_plus<Type>
>::type
@@ -348,7 +349,7 @@
: public neutron_based_inplace_combine<Type>
{
typedef typename boost::mpl::
- if_<is_set<Type>,
+ if_<has_set_semantics<Type>,
itl::inplace_caret<Type>,
itl::inplace_minus<Type>
>::type
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-08-30 10:13:10 EDT (Mon, 30 Aug 2010)
@@ -738,7 +738,7 @@
static const key_type& key_value(IteratorT value_){ return (*value_).first; }
template<typename IteratorT>
- static codomain_type codomain_value(IteratorT value_){ return (*value_).second; }
+ static codomain_type co_value(IteratorT value_){ return (*value_).second; }
template<typename LeftIterT, typename RightIterT>
static bool key_less(LeftIterT left_, RightIterT right_)
@@ -991,7 +991,7 @@
const_iterator it_;
iterator prior_ = section.end();
- if(is_set<CodomainT>::value)
+ if(has_set_semantics<CodomainT>::value)
for(it_=first_; it_ != end_; it_++)
{
interval_type common_interval = it_->first & sectant_interval;
@@ -1102,7 +1102,7 @@
// ... shall be subtracted
eraser.add(common_interval);
- if(is_set<codomain_type>::value)
+ if(has_set_semantics<codomain_type>::value)
{
codomain_type common_value = x_value;
inverse_codomain_intersect()(common_value, co_value);
@@ -1554,16 +1554,6 @@
//-----------------------------------------------------------------------------
// type traits
//-----------------------------------------------------------------------------
-template
-<
- class SubType,
- class DomainT, class CodomainT, class Traits, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_SECTION Section, ITL_INTERVAL(ITL_COMPARE) Interval, ITL_ALLOC Alloc
->
-struct is_set<itl::interval_base_map<SubType,DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc> >
-{
- typedef is_set<itl::interval_base_map<SubType,DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc> > type;
- BOOST_STATIC_CONSTANT(bool, value = (is_set<CodomainT>::value));
-};
template
<
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-08-30 10:13:10 EDT (Mon, 30 Aug 2010)
@@ -458,7 +458,7 @@
static const key_type& key_value(IteratorT value_){ return (*value_); }
template<typename IteratorT>
- static codomain_type codomain_value(IteratorT value_)
+ static codomain_type co_value(IteratorT value_)
{ return itl::is_empty(*value_)? codomain_type() : (*value_).lower(); }
template<typename LeftIterT, typename RightIterT>
Modified: sandbox/itl/boost/itl/interval_map.hpp
==============================================================================
--- sandbox/itl/boost/itl/interval_map.hpp (original)
+++ sandbox/itl/boost/itl/interval_map.hpp 2010-08-30 10:13:10 EDT (Mon, 30 Aug 2010)
@@ -66,6 +66,7 @@
typedef interval_set<DomainT,Compare,Interval,Alloc> interval_set_type;
typedef interval_set_type set_type;
+ typedef set_type key_object_type;
enum { fineness = 1 };
@@ -785,13 +786,6 @@
// type traits
//-----------------------------------------------------------------------------
template <class DomainT, class CodomainT, class Traits, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_SECTION Section, ITL_INTERVAL(ITL_COMPARE) Interval, ITL_ALLOC Alloc>
-struct is_set<itl::interval_map<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc> >
-{
- typedef is_set<itl::interval_map<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc> > type;
- BOOST_STATIC_CONSTANT(bool, value = (is_set<CodomainT>::value));
-};
-
-template <class DomainT, class CodomainT, class Traits, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_SECTION Section, ITL_INTERVAL(ITL_COMPARE) Interval, ITL_ALLOC Alloc>
struct is_map<itl::interval_map<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc> >
{
typedef is_map<itl::interval_map<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc> > type;
Modified: sandbox/itl/boost/itl/interval_set.hpp
==============================================================================
--- sandbox/itl/boost/itl/interval_set.hpp (original)
+++ sandbox/itl/boost/itl/interval_set.hpp 2010-08-30 10:13:10 EDT (Mon, 30 Aug 2010)
@@ -40,6 +40,8 @@
typedef type joint_type;
+ typedef type key_object_type;
+
/// The domain type of the set
typedef DomainT domain_type;
/// The codomaintype is the same as domain_type
Modified: sandbox/itl/boost/itl/map.hpp
==============================================================================
--- sandbox/itl/boost/itl/map.hpp (original)
+++ sandbox/itl/boost/itl/map.hpp 2010-08-30 10:13:10 EDT (Mon, 30 Aug 2010)
@@ -27,7 +27,7 @@
#include <boost/itl/type_traits/is_element_container.hpp>
#include <boost/itl/type_traits/has_inverse.hpp>
#include <boost/itl/type_traits/to_string.hpp>
-#include <boost/itl/seqs.hpp>
+//CL #include <boost/itl/seqs.hpp>
#include <boost/itl/functors.hpp>
#include <boost/itl/predicates.hpp>
#include <boost/itl/set.hpp>
@@ -78,6 +78,7 @@
inline std::string type_to_string<total_enricher>::apply() { return "e^0"; }
+/*CL
template<class, class, class, ITL_COMPARE, ITL_COMBINE, ITL_SECTION, ITL_ALLOC>
class map;
@@ -141,7 +142,7 @@
};
//==============================================================================
-
+*/
/** \brief Addable, subractable and intersectable maps */
template
@@ -164,6 +165,7 @@
typedef typename ITL_IMPL_SPACE::map<DomainT, CodomainT, ITL_COMPARE_DOMAIN(Compare,DomainT),
allocator_type> base_type;
typedef typename itl::set<DomainT, Compare, Alloc > set_type;
+ typedef set_type key_object_type;
typedef Traits traits;
@@ -181,7 +183,7 @@
typedef ITL_COMPARE_DOMAIN(Compare,element_type) element_compare;
typedef typename inverse<codomain_combine >::type inverse_codomain_combine;
typedef typename mpl::if_
- <is_set<codomain_type>
+ <has_set_semantics<codomain_type>
, ITL_SECTION_CODOMAIN(Section,CodomainT)
, codomain_combine
>::type codomain_intersect; //JODO extra metafuction?
@@ -394,10 +396,10 @@
template<typename IteratorT>
static const key_type& key_value(IteratorT value_){ return (*value_).first; }
- /** \c codomain_value allows for a uniform access to \c codomain_values which is
+ /** \c co_value allows for a uniform access to \c codomain_values which is
is used for common algorithms on sets and maps. */
- template<typename IteratorT>
- static const codomain_type& codomain_value(IteratorT value_){ return (*value_).second; }
+ template<typename IteratorT>
+ static const codomain_type& co_value(IteratorT value_){ return (*value_).second; }
/** \c key_less allows for a uniform notation of key comparison which
is used for common algorithms on sets and maps. */
@@ -423,13 +425,6 @@
//-----------------------------------------------------------------------------
// type traits
//-----------------------------------------------------------------------------
-template<class DomainT, class CodomainT, class Traits, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_SECTION Section, ITL_ALLOC Alloc>
-struct is_set<itl::map<DomainT,CodomainT,Traits,Compare,Combine,Section,Alloc> >
-{
- typedef is_set<itl::map<DomainT,CodomainT,Traits,Compare,Combine,Section,Alloc> > type;
- BOOST_STATIC_CONSTANT(bool, value = (is_set<CodomainT>::value));
-};
-
template <class DomainT, class CodomainT, class Traits, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_SECTION Section, ITL_ALLOC Alloc>
struct is_map<itl::map<DomainT,CodomainT,Traits,Compare,Combine,Section,Alloc> >
{
Modified: sandbox/itl/boost/itl/map_functions.hpp
==============================================================================
--- sandbox/itl/boost/itl/map_functions.hpp (original)
+++ sandbox/itl/boost/itl/map_functions.hpp 2010-08-30 10:13:10 EDT (Mon, 30 Aug 2010)
@@ -11,6 +11,8 @@
#include <boost/itl/detail/design_config.hpp>
#include <boost/itl/detail/map_algo.hpp>
#include <boost/itl/detail/map_functors.hpp>
+#include <boost/itl/type_traits/is_element_container.hpp>
+#include <boost/itl/type_traits/is_key_container_of.hpp>
namespace boost{namespace itl
{
@@ -25,7 +27,7 @@
typename enable_if<is_element_map<MapT>, void>::type
clear(MapT& object)
{
- seqs<MapT>::erase(object, seqs<MapT>::begin(object), seqs<MapT>::end(object));
+ object.clear();
}
/** Tests if the container is empty.
@@ -34,7 +36,7 @@
typename enable_if<is_element_map<MapT>, bool>::type
is_empty(const MapT& object)
{
- return seqs<MapT>::begin(object) == seqs<MapT>::end(object);
+ return object.empty();
}
/** Checks if a key is in the map */
@@ -42,7 +44,7 @@
typename enable_if<is_element_map<MapT>, bool>::type
contains(const MapT& object, const typename MapT::domain_type& key)
{
- return !(seqs<MapT>::find(object,key) == seqs<MapT>::end(object));
+ return !(object.find(key) == object.end());
}
/** Checks if a key-value pair is in the map */
@@ -51,24 +53,59 @@
contains(const MapT& object, const typename MapT::element_type& key_value_pair)
{
typedef typename MapT::const_iterator const_iterator;
- const_iterator found_ = seqs<MapT>::find(object, key_value_pair.first);
- return found_ != seqs<MapT>::end(object) && found_->second == key_value_pair.second;
+ const_iterator found_ = object.find(key_value_pair.first);
+ return found_ != object.end() && found_->second == key_value_pair.second;
}
/** Does <tt>super</tt> contain <tt>sub</tt>? */
template<class MapT>
typename enable_if<is_element_map<MapT>, bool>::type
contains(const MapT& super, const MapT& sub)
-{ return map_within<MapT>::apply(sub, super); }
+{ return itl::within(sub, super); }
/** Does <tt>super</tt> contain <tt>sub</tt>? */
template<class MapT>
typename enable_if<is_element_map<MapT>, bool>::type
contains(const MapT& super, const typename MapT::set_type& sub)
-{ return map_within<MapT>::apply(sub, super); }
+{
+ return itl::within(sub, super);
+}
//- within ---------------------------------------------------------------------
+
+template<class SubT, class SuperT>
+typename enable_if<mpl::and_< is_element_map<SuperT>
+ , is_key_container_of<SubT, SuperT> >,
+ bool>::type
+within(const SubT& sub, const SuperT& super)
+{
+ if(itl::is_empty(sub)) return true;
+ if(itl::is_empty(super)) return false;
+ if(itl::size(super) < itl::size(sub)) return false;
+
+ typename SubT::const_iterator common_lwb_;
+ typename SubT::const_iterator common_upb_;
+ if(!Set::common_range(common_lwb_, common_upb_, sub, super))
+ return false;
+
+ typename SubT::const_iterator sub_ = sub.begin();
+ typename SuperT::const_iterator super_;
+ while(sub_ != sub.end())
+ {
+ super_ = super.find(SubT::key_value(sub_));
+ if(super_ == super.end())
+ return false;
+ else if(!co_equal(sub_, super_, sub, super))
+ return false;
+
+ ++sub_;
+ }
+ return true;
+}
+
+
+
/** Is <tt>sub</tt> contained within <tt>super</tt>? */
template<class MapT>
typename enable_if<is_element_map<MapT>, bool>::type
@@ -81,18 +118,6 @@
within(const typename MapT::element_type& sub, const MapT& super)
{ return contains(super, sub); }
-/** Is <tt>sub</tt> contained within <tt>super</tt>? */
-template<class MapT>
-typename enable_if<is_element_map<MapT>, bool>::type
-within(const typename MapT::set_type& sub, const MapT& super)
-{ return map_within<MapT>::apply(sub, super); }
-
-/** Is <tt>sub</tt> contained within <tt>super</tt>? */
-template<class MapT>
-typename enable_if<is_element_map<MapT>, bool>::type
-within(const MapT& sub, const MapT& super)
-{ return map_within<MapT>::apply(sub, super); }
-
//==============================================================================
//= Size
//==============================================================================
@@ -100,21 +125,21 @@
typename enable_if<is_element_map<MapT>, typename MapT::size_type>::type
size(const MapT& object)
{
- return seqs<MapT>::size(object);
+ return object.size();
}
template<class MapT>
typename enable_if<is_element_map<MapT>, typename MapT::size_type>::type
cardinality(const MapT& object)
{
- return seqs<MapT>::size(object);
+ return object.size();
}
template<class MapT>
typename enable_if<is_element_map<MapT>, typename MapT::size_type>::type
iterative_size(const MapT& object)
{
- return seqs<MapT>::size(object);
+ return object.size();
}
@@ -134,8 +159,8 @@
inline typename enable_if<is_element_map<MapT>, bool>::type
operator == (const MapT& lhs, const MapT& rhs)
{
- return seqs<MapT>::size(lhs) == seqs<MapT>::size(rhs)
- && equal(seqs<MapT>::begin(lhs), seqs<MapT>::end(lhs), seqs<MapT>::begin(rhs));
+ return lhs.size() == rhs.size()
+ && equal(lhs.begin(), lhs.end(), rhs.begin());
}
#ifdef BOOST_MSVC
@@ -166,8 +191,7 @@
operator < (const MapT& lhs, const MapT& rhs)
{
return std::lexicographical_compare(
- seqs<MapT>::begin(lhs), seqs<MapT>::end(lhs),
- seqs<MapT>::begin(rhs), seqs<MapT>::end(rhs),
+ lhs.begin(), lhs.end(), rhs.begin(), rhs.end(),
typename MapT::element_compare()
//lhs.value_comp() //JODO why does this implementation violate antisymmetry?
);
@@ -216,6 +240,7 @@
return MapT::add_::apply(object, prior, value_pair);
}
+
template <class MapT>
inline typename enable_if<is_element_map<MapT>, MapT>::type&
operator += (MapT& object, const typename MapT::element_type& value_pair)
@@ -377,7 +402,7 @@
{
typedef typename MapT::iterator iterator;
- iterator prior_ = seqs<MapT>::end(object);
+ iterator prior_ = object.end();
ITL_const_FORALL(typename MapT, elem_, addend)
itl::insert(object, prior_, *elem_);
@@ -517,7 +542,7 @@
{
MapT section;
add_intersection(section, object, operand);
- seqs<MapT>::swap(object, section);
+ object.swap(section);
return object;
}
@@ -632,7 +657,7 @@
operator ^ (MapT object, const typename MapT::element_type& value_pair)
{
MapT operand;//JODO
- seqs<MapT>::insert(operand, value_pair);
+ operand.insert(value_pair);
return object ^= operand;
}
@@ -641,11 +666,29 @@
operator ^ (const typename MapT::element_type& value_pair, MapT object)
{
MapT operand;//JODO
- seqs<MapT>::insert(operand, value_pair);
+ operand.insert(value_pair);
return object ^= operand;
}
//==============================================================================
+//= Set selection
+//==============================================================================
+template<class MapT>
+inline typename enable_if<is_element_map<MapT>,
+ typename MapT::set_type>::type&
+domain(typename MapT::set_type& domain_set, const MapT& object)
+{
+ typename MapT::set_type::iterator prior_ = domain_set.end();
+ typename MapT::const_iterator it_ = object.begin();
+ while(it_ != object.end())
+ prior_ = domain_set.insert(prior_, (*it_++).first);
+ //JODO prior_ = itl::insert(domain_set, prior_, it_->first);
+
+ return domain_set;
+}
+
+
+//==============================================================================
//= Manipulation by predicates
//==============================================================================
@@ -653,8 +696,8 @@
inline typename enable_if<is_element_map<MapT>, MapT>::type&
erase_if(const Predicate& pred, MapT& object)
{
- typename MapT::iterator it_ = seqs<MapT>::begin(object);
- while(it_ != seqs<MapT>::end(object))
+ typename MapT::iterator it_ = object.begin();
+ while(it_ != object.end())
if(pred(*it_))
itl::erase(object, it_++);
else ++it_;
@@ -666,8 +709,8 @@
inline typename enable_if<is_element_map<MapT>, MapT>::type&
add_if(const Predicate& pred, MapT& object, const MapT& src)
{
- typename MapT::const_iterator it_ = seqs<MapT>::begin(src);
- while(it_ != seqs<MapT>::end(src))
+ typename MapT::const_iterator it_ = src.begin();
+ while(it_ != src.end())
if(pred(*it_))
itl::add(object, *it_++);
@@ -694,7 +737,6 @@
}
-
//---------------------------------------------------------------------------------
template<class CharType, class CharTraits, class MapT>
inline typename enable_if<is_element_map<MapT>, std::basic_ostream<CharType, CharTraits> >::type&
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-08-30 10:13:10 EDT (Mon, 30 Aug 2010)
@@ -33,6 +33,7 @@
typedef interval_base_set<type,DomainT,Compare,Interval,Alloc> base_type;
typedef type overloadable_type;
+ typedef type key_object_type;
typedef interval_set<DomainT,Compare,Interval,Alloc> joint_type;
Modified: sandbox/itl/boost/itl/set.hpp
==============================================================================
--- sandbox/itl/boost/itl/set.hpp (original)
+++ sandbox/itl/boost/itl/set.hpp 2010-08-30 10:13:10 EDT (Mon, 30 Aug 2010)
@@ -22,6 +22,7 @@
#include <boost/itl/detail/concept_check.hpp>
#include <boost/itl/type_traits/to_string.hpp>
#include <boost/itl/type_traits/is_set.hpp>
+#include <boost/itl/type_traits/has_set_semantics.hpp>
#include <boost/itl/type_traits/is_interval_container.hpp>
#include <boost/itl/type_traits/is_interval_splitter.hpp>
#include <boost/itl/type_traits/is_interval_separator.hpp>
@@ -54,6 +55,7 @@
public:
typedef typename itl::set<DomainT, Compare, Alloc> type;
typedef typename ITL_IMPL_SPACE::set<DomainT, ITL_COMPARE_DOMAIN(Compare,DomainT), Alloc<DomainT> > base_type;
+ typedef type key_object_type;
public:
typedef DomainT domain_type;
@@ -231,10 +233,10 @@
template<typename IteratorT>
static const key_type& key_value(IteratorT value_){ return (*value_); }
- /** \c codomain_value allows for a uniform access to \c data_values which is
+ /** \c co_value allows for a uniform access to \c data_values which is
is used for common algorithms on sets and maps. */
template<typename IteratorT>
- static const codomain_type& codomain_value(IteratorT value_){ return (*value_); }
+ static const codomain_type& co_value(IteratorT value_){ return (*value_); }
/** \c key_less allows for a uniform notation of key comparison which
is used for common algorithms on sets and maps. */
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-08-30 10:13:10 EDT (Mon, 30 Aug 2010)
@@ -63,6 +63,7 @@
typedef interval_set<DomainT,Compare,Interval,Alloc> interval_set_type;
typedef interval_set_type set_type;
+ typedef set_type key_object_type;
enum { fineness = 3 };
@@ -642,14 +643,6 @@
//-----------------------------------------------------------------------------
// type traits
//-----------------------------------------------------------------------------
-
-template <class DomainT, class CodomainT, class Traits, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_SECTION Section, ITL_INTERVAL(ITL_COMPARE) Interval, ITL_ALLOC Alloc>
-struct is_set<itl::split_interval_map<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc> >
-{
- typedef is_set<itl::split_interval_map<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc> > type;
- BOOST_STATIC_CONSTANT(bool, value = (is_set<CodomainT>::value));
-};
-
template <class DomainT, class CodomainT, class Traits, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_SECTION Section, ITL_INTERVAL(ITL_COMPARE) Interval, ITL_ALLOC Alloc>
struct is_map<itl::split_interval_map<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc> >
{
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-08-30 10:13:10 EDT (Mon, 30 Aug 2010)
@@ -34,6 +34,7 @@
typedef interval_set<DomainT,Compare,Interval,Alloc> joint_type;
typedef type overloadable_type;
+ typedef type key_object_type;
/// The domain type of the set
typedef DomainT domain_type;
Added: sandbox/itl/boost/itl/type_traits/adds_inversely.hpp
==============================================================================
--- (empty file)
+++ sandbox/itl/boost/itl/type_traits/adds_inversely.hpp 2010-08-30 10:13:10 EDT (Mon, 30 Aug 2010)
@@ -0,0 +1,29 @@
+/*-----------------------------------------------------------------------------+
+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_ADDS_INVERSELY_HPP_JOFA_100829
+#define BOOST_ITL_TYPE_TRAITS_ADDS_INVERSELY_HPP_JOFA_100829
+
+#include <boost/itl/type_traits/has_inverse.hpp>
+#include <boost/itl/functors.hpp>
+
+namespace boost{ namespace itl
+{
+
+template<class Type, class Combiner>
+struct adds_inversely
+{
+ typedef adds_inversely type;
+ BOOST_STATIC_CONSTANT(bool,
+ value = (mpl::and_<has_inverse<Type>, is_negative<Combiner> >::value));
+};
+
+}} // namespace boost itl
+
+#endif // BOOST_ITL_TYPE_TRAITS_ADDS_INVERSELY_HPP_JOFA_100829
+
+
Added: sandbox/itl/boost/itl/type_traits/codomain_type_of.hpp
==============================================================================
--- (empty file)
+++ sandbox/itl/boost/itl/type_traits/codomain_type_of.hpp 2010-08-30 10:13:10 EDT (Mon, 30 Aug 2010)
@@ -0,0 +1,57 @@
+/*-----------------------------------------------------------------------------+
+Copyright (c) 2008-2009: 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_CODOMAIN_TYPE_OF_HPP_JOFA_100829
+#define BOOST_ITL_TYPE_TRAITS_CODOMAIN_TYPE_OF_HPP_JOFA_100829
+
+#include <boost/mpl/has_xxx.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/or.hpp>
+#include <boost/mpl/and.hpp>
+
+namespace boost{ namespace itl
+{
+ struct no_type{};
+
+ namespace detail
+ {
+ BOOST_MPL_HAS_XXX_TRAIT_DEF(codomain_type)
+ }
+
+ template <class Type>
+ struct has_codomain_type
+ : mpl::bool_<detail::has_codomain_type<Type>::value>
+ {};
+
+ template <class Type, bool has_codomain_type>
+ struct get_codomain_type;
+
+ template <class Type>
+ struct get_codomain_type<Type, false>
+ {
+ typedef no_type type;
+ };
+
+ template <class Type>
+ struct get_codomain_type<Type, true>
+ {
+ typedef typename Type::codomain_type type;
+ };
+
+ template <class Type>
+ struct codomain_type_of
+ {
+ typedef typename
+ get_codomain_type<Type, has_codomain_type<Type>::value>::type type;
+ };
+
+}} // namespace boost itl
+
+#endif
+
+
Added: sandbox/itl/boost/itl/type_traits/has_set_semantics.hpp
==============================================================================
--- (empty file)
+++ sandbox/itl/boost/itl/type_traits/has_set_semantics.hpp 2010-08-30 10:13:10 EDT (Mon, 30 Aug 2010)
@@ -0,0 +1,35 @@
+/*-----------------------------------------------------------------------------+
+Copyright (c) 2008-2009: 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_SET_SEMANTICS_HPP_JOFA_100829
+#define BOOST_ITL_TYPE_TRAITS_HAS_SET_SEMANTICS_HPP_JOFA_100829
+
+#include <boost/mpl/or.hpp>
+#include <boost/mpl/and.hpp>
+#include <boost/itl/type_traits/is_set.hpp>
+#include <boost/itl/type_traits/is_map.hpp>
+#include <boost/itl/type_traits/codomain_type_of.hpp>
+
+namespace boost{ namespace itl
+{
+ template <class Type> struct has_set_semantics
+ {
+ typedef has_set_semantics<Type> type;
+ BOOST_STATIC_CONSTANT(bool,
+ value = (mpl::or_< is_set<Type>
+ , mpl::and_< is_map<Type>
+ , has_set_semantics
+ <typename codomain_type_of<Type>::type >
+ >
+ >::value));
+ };
+
+}} // namespace boost itl
+
+#endif
+
+
Added: sandbox/itl/boost/itl/type_traits/is_container.hpp
==============================================================================
--- (empty file)
+++ sandbox/itl/boost/itl/type_traits/is_container.hpp 2010-08-30 10:13:10 EDT (Mon, 30 Aug 2010)
@@ -0,0 +1,41 @@
+/*-----------------------------------------------------------------------------+
+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_CONTAINER_HPP_JOFA_100828
+#define BOOST_ITL_TYPE_TRAITS_IS_CONTAINER_HPP_JOFA_100828
+
+#include <boost/mpl/has_xxx.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/mpl/and.hpp>
+#include <boost/mpl/not.hpp>
+#include <boost/itl/type_traits/is_map.hpp>
+
+namespace boost{ namespace itl
+{
+ namespace detail
+ {
+ BOOST_MPL_HAS_XXX_TRAIT_DEF(value_type)
+ BOOST_MPL_HAS_XXX_TRAIT_DEF(iterator)
+ BOOST_MPL_HAS_XXX_TRAIT_DEF(size_type)
+ BOOST_MPL_HAS_XXX_TRAIT_DEF(reference)
+ }
+
+ template <class Type>
+ struct is_container
+ : mpl::bool_<
+ detail::has_value_type<Type>::value &&
+ detail::has_iterator<Type>::value &&
+ detail::has_size_type<Type>::value &&
+ detail::has_reference<Type>::value>
+ {};
+
+
+}} // namespace boost itl
+
+#endif
+
+
Added: sandbox/itl/boost/itl/type_traits/is_key_container_of.hpp
==============================================================================
--- (empty file)
+++ sandbox/itl/boost/itl/type_traits/is_key_container_of.hpp 2010-08-30 10:13:10 EDT (Mon, 30 Aug 2010)
@@ -0,0 +1,43 @@
+/*-----------------------------------------------------------------------------+
+Copyright (c) 2008-2009: 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_KEY_CONTAINER_OF_HPP_JOFA_100829
+#define BOOST_ITL_TYPE_TRAITS_IS_KEY_CONTAINER_OF_HPP_JOFA_100829
+
+#include <boost/itl/type_traits/is_combinable.hpp>
+#include <boost/itl/type_traits/is_container.hpp>
+
+namespace boost{ namespace itl
+{
+
+ template<class KeyT, class ObjectT>
+ struct is_strict_key_container_of
+ {
+ typedef is_strict_key_container_of<KeyT, ObjectT> type;
+ BOOST_STATIC_CONSTANT(bool, value =
+ (mpl::and_< is_map<ObjectT>
+ , is_same<typename ObjectT::key_object_type, KeyT> >::value)
+ );
+ };
+
+ template<class KeyT, class ObjectT>
+ struct is_key_container_of
+ {
+ typedef is_key_container_of<KeyT, ObjectT> type;
+ BOOST_STATIC_CONSTANT(bool, value =
+ (mpl::or_< is_strict_key_container_of<KeyT, ObjectT>
+ , mpl::and_< is_container<ObjectT> //JODO is_itl_associative_container
+ , is_same<ObjectT, KeyT> > >::value)
+ );
+ };
+
+
+}} // namespace boost itl
+
+#endif
+
+
Modified: sandbox/itl/boost/itl_xt/bits.hpp
==============================================================================
--- sandbox/itl/boost/itl_xt/bits.hpp (original)
+++ sandbox/itl/boost/itl_xt/bits.hpp 2010-08-30 10:13:10 EDT (Mon, 30 Aug 2010)
@@ -17,6 +17,7 @@
#include <boost/itl/type_traits/type_to_string.hpp>
#include <boost/itl/type_traits/to_string.hpp>
#include <boost/itl/type_traits/is_set.hpp>
+#include <boost/itl/type_traits/has_set_semantics.hpp>
#include <boost/itl/detail/relation_state.hpp>
namespace boost{namespace itl
@@ -240,7 +241,6 @@
};
-
template <>struct type_to_string<itl::bits<unsigned char > >{static std::string apply(){ return "bit8"; }};
template <>struct type_to_string<itl::bits<unsigned short> >{static std::string apply(){ return "bit16"; }};
template <>struct type_to_string<itl::bits<unsigned int > >{static std::string apply(){ return "bit_32"; }};
Modified: sandbox/itl/boost/validate/laws/order.hpp
==============================================================================
--- sandbox/itl/boost/validate/laws/order.hpp (original)
+++ sandbox/itl/boost/validate/laws/order.hpp 2010-08-30 10:13:10 EDT (Mon, 30 Aug 2010)
@@ -114,7 +114,25 @@
return !(Relation<Type>()(a,b) && Relation<Type>()(b,a)) || Equality<Type>()(a,b);
}
- bool debug_holds(){ return holds(); }
+ bool debug_holds()
+ {
+ Type a = this->template getInputValue<operand_a>();
+ Type b = this->template getInputValue<operand_b>();
+
+ cout << "a = " << a << endl;
+ cout << "b = " << b << endl;
+
+ bool a_R_b = Relation<Type>()(a,b);
+ cout << "a<=b == " << a_R_b << endl;
+
+ bool b_R_a = Relation<Type>()(b,a);
+ cout << "b<=a == " << b_R_a << endl;
+
+ bool a_E_b = Equality<Type>()(a,b);
+ cout << "b==a == " << a_E_b << endl;
+
+ return !(Relation<Type>()(a,b) && Relation<Type>()(b,a)) || Equality<Type>()(a,b);
+ }
size_t size()const
{
Modified: sandbox/itl/libs/itl/example/large_bitset_/bits.hpp
==============================================================================
--- sandbox/itl/libs/itl/example/large_bitset_/bits.hpp (original)
+++ sandbox/itl/libs/itl/example/large_bitset_/bits.hpp 2010-08-30 10:13:10 EDT (Mon, 30 Aug 2010)
@@ -63,6 +63,13 @@
typedef is_set<mini::bits<NaturalT> > type;
BOOST_STATIC_CONSTANT(bool, value = true);
};
+
+ template<class NaturalT>
+ struct has_set_semantics<mini::bits<NaturalT> >
+ {
+ typedef has_set_semantics<mini::bits<NaturalT> > type;
+ BOOST_STATIC_CONSTANT(bool, value = true);
+ };
}}
//]
Modified: sandbox/itl/libs/itl/test/fastest_partial_icl_quantifier_cases.hpp
==============================================================================
--- sandbox/itl/libs/itl/test/fastest_partial_icl_quantifier_cases.hpp (original)
+++ sandbox/itl/libs/itl/test/fastest_partial_icl_quantifier_cases.hpp 2010-08-30 10:13:10 EDT (Mon, 30 Aug 2010)
@@ -63,6 +63,7 @@
//------------------------------------------------------------------------------
// Containedness
//------------------------------------------------------------------------------
+
BOOST_AUTO_TEST_CASE
(fastest_itl_partial_icl_quantifier_check_containedness_4_bicremental_types)
{ icl_quantifier_check_containedness_4_bicremental_types<bicremental_type_1, mono, partial_absorber, INTERVAL_MAP>();}
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-08-30 10:13:10 EDT (Mon, 30 Aug 2010)
@@ -25,6 +25,10 @@
#include <boost/itl/interval_map.hpp>
#include <boost/itl/split_interval_map.hpp>
#include <boost/itl/detail/element_iterator.hpp>
+#include <boost/itl/type_traits/is_key_container_of.hpp>
+#include <boost/itl/type_traits/codomain_type_of.hpp>
+
+
#include <boost/itl_xt/detail/bit_element_iterator.hpp>
#include <boost/itl_xt/interval_bitset.hpp>
#include <boost/itl_xt/list.hpp>
@@ -201,11 +205,33 @@
typedef interval_set<T> IntervalSetT;
typedef IntervalMapT::interval_type IntervalT;
- IntervalMapT map_a;
- IntervalSetT set_a;
- set_a.add(I_I(0,0));
+ BOOST_CHECK_EQUAL((is_key_container_of< int , itl::map<int,int> >::value), false);
+ BOOST_CHECK_EQUAL((is_key_container_of<std::pair<int,int> , itl::map<int,int> >::value), false);
+ BOOST_CHECK_EQUAL((is_key_container_of<itl::set<int>, itl::set<int> >::value), true);
+ BOOST_CHECK_EQUAL((is_key_container_of<itl::set<int>, itl::map<int,int> >::value), true);
+ BOOST_CHECK_EQUAL((is_key_container_of<itl::map<int,int>, itl::map<int,int> >::value), true);
+
+ //BOOST_CHECK_EQUAL((is_element_container<itl::map<int,int> >::value), true);
+
+ typedef itl::map<int,int> MapII;
+
+ //const bool xx = is_same< typename itl::map<int,int>::codomain_type,
+ // typename codomain_type_of<itl::map<int,int> >::type >::value;
+
+ BOOST_CHECK_EQUAL(has_codomain_type<MapII>::value, true);
+ BOOST_CHECK_EQUAL((is_same<MapII::codomain_type, int>::value), true);
+
+ BOOST_CHECK_EQUAL((is_same<get_codomain_type<MapII,true>::type, int>::value), true);
+ BOOST_CHECK_EQUAL((is_same<get_codomain_type<MapII,false>::type, int>::value), false);
+ BOOST_CHECK_EQUAL((is_same<get_codomain_type<MapII,false>::type, itl::no_type>::value), true);
+
+ BOOST_CHECK_EQUAL((is_same<get_codomain_type<MapII, has_codomain_type<MapII>::value >::type, int>::value), true);
+ BOOST_CHECK_EQUAL((is_same<get_codomain_type<MapII, has_codomain_type<MapII>::value >::type, itl::no_type>::value), false);
+
+ BOOST_CHECK_EQUAL((is_map<MapII>::value), true);
+
- map_a.contains(set_a);
- BOOST_CHECK(map_a.contains(set_a));
+ //BOOST_CHECK_EQUAL(xx, true);
+
}
Modified: sandbox/itl/libs/itl/test/test_icl_quantifier_shared.hpp
==============================================================================
--- sandbox/itl/libs/itl/test/test_icl_quantifier_shared.hpp (original)
+++ sandbox/itl/libs/itl/test/test_icl_quantifier_shared.hpp 2010-08-30 10:13:10 EDT (Mon, 30 Aug 2010)
@@ -307,6 +307,8 @@
check_union_containedness(map_a, map_c);
check_union_containedness(map_c, map_pair_a);
+
+ check_domain_containedness(map_a);
}
Modified: sandbox/itl/libs/itl/test/test_laws.hpp
==============================================================================
--- sandbox/itl/libs/itl/test/test_laws.hpp (original)
+++ sandbox/itl/libs/itl/test/test_laws.hpp 2010-08-30 10:13:10 EDT (Mon, 30 Aug 2010)
@@ -245,6 +245,23 @@
BOOST_CHECK_EQUAL(contains(b + a, a), true);
}
+template<class MapT>
+void check_domain_containedness(const MapT& a)
+{
+ typedef typename MapT::set_type set_type;
+ set_type dom;
+ domain(dom, a);
+ BOOST_CHECK_EQUAL(within(dom, a), true);
+ BOOST_CHECK_EQUAL(contains(a, dom), true);
+
+ if(!dom.empty())
+ {
+ typename MapT::domain_type a1 = *dom.begin();
+ BOOST_CHECK_EQUAL(within(a1, a), true);
+ BOOST_CHECK_EQUAL(contains(a, a1), true);
+ }
+}
+
//==============================================================================
// Law tests are now combined to test algebraic concepts.
//------------------------------------------------------------------------------
Modified: sandbox/itl/libs/itl/test/test_value_maker.hpp
==============================================================================
--- sandbox/itl/libs/itl/test/test_value_maker.hpp (original)
+++ sandbox/itl/libs/itl/test/test_value_maker.hpp 2010-08-30 10:13:10 EDT (Mon, 30 Aug 2010)
@@ -34,6 +34,15 @@
bool operator == (const mono&, const mono&){ return true; }
bool operator < (const mono&, const mono&){ return false; }
+template<class CharType, class CharTraits>
+std::basic_ostream<CharType, CharTraits>&
+operator << (std::basic_ostream<CharType, CharTraits>& stream, const mono& object)
+{
+ return stream << "*";
+}
+
+
+
template <class BicrementableT>
BicrementableT make(int n)
{
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-08-30 10:13:10 EDT (Mon, 30 Aug 2010)
@@ -74,16 +74,18 @@
//typedef InplaceCommutativity<itl::set<double> > TestLawT;
//LawValidater<TestLawT> test_law;
+ //typedef FunctionEquality
+ //<
+ // itl::list<std::pair<rightopen_interval<double,std::less>,int> >, //SourceT,
+ // split_interval_map<double,int,partial_absorber>, //TargetT,
+ // base_insertion,
+ // hint_insertion
+ //>
+ //TestLawT;
+
+
+ typedef Antisymmetry<itl::map<int,int>, itl::sub_super_set, itl::element_equal> TestLawT;
-
- typedef FunctionEquality
- <
- itl::list<std::pair<rightopen_interval<double,std::less>,int> >, //SourceT,
- split_interval_map<double,int,partial_absorber>, //TargetT,
- base_insertion,
- hint_insertion
- >
- TestLawT;
LawValidater<TestLawT> test_law;
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