URL:
https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-10-04 Matthieu Garrigues <garrigues(a)lrde.epita.fr>
Rename x variables into t in accumulators.
* mln/accu/count.hh,
* mln/accu/histo.hh,
* mln/accu/max.hh,
* mln/accu/max_h.hh,
* mln/accu/mean.hh,
* mln/accu/median.hh,
* mln/accu/median_alt.hh,
* mln/accu/min.hh,
* mln/accu/min_h.hh,
* mln/accu/p.hh,
* mln/accu/pair.hh,
* mln/accu/sum.hh,
* mln/accu/v.hh,
* mln/core/concept/accumulator.hh,
* mln/core/concept/doc/accumulator.hh: Rename.
* tests/value_float01.cc: Fix warnings.
---
mln/accu/count.hh | 36 +++++++++---------
mln/accu/histo.hh | 20 +++++-----
mln/accu/max.hh | 64 ++++++++++++++++----------------
mln/accu/max_h.hh | 42 ++++++++++-----------
mln/accu/mean.hh | 50 ++++++++++++-------------
mln/accu/median.hh | 32 ++++++++--------
mln/accu/median_alt.hh | 42 ++++++++++-----------
mln/accu/min.hh | 72 ++++++++++++++++++------------------
mln/accu/min_h.hh | 42 ++++++++++-----------
mln/accu/p.hh | 12 +++---
mln/accu/pair.hh | 62 +++++++++++++++----------------
mln/accu/sum.hh | 40 ++++++++++----------
mln/accu/v.hh | 12 +++---
mln/core/concept/accumulator.hh | 2 -
mln/core/concept/doc/accumulator.hh | 4 +-
tests/value_float01.cc | 8 ++--
16 files changed, 270 insertions(+), 270 deletions(-)
Index: trunk/milena/tests/value_float01.cc
===================================================================
--- trunk/milena/tests/value_float01.cc (revision 1247)
+++ trunk/milena/tests/value_float01.cc (revision 1248)
@@ -48,11 +48,11 @@
using namespace mln::value;
using mln::value::int_u8;
-float fi(int x) { return 0.5; }
-int ii(int x) { return 1; }
+float fi(int) { return 0.5; }
+int ii(int) { return 1; }
-float fd(double x) { return 0.5; }
-int id(double x) { return 1; }
+float fd(double) { return 0.5; }
+int id(double) { return 1; }
struct tofloat01 : mln::Function_v2v<tofloat01>
Index: trunk/milena/mln/core/concept/doc/accumulator.hh
===================================================================
--- trunk/milena/mln/core/concept/doc/accumulator.hh (revision 1247)
+++ trunk/milena/mln/core/concept/doc/accumulator.hh (revision 1248)
@@ -50,8 +50,8 @@
/// Initialize the accumulator.
void init();
- /// Take into account a argument \p x (an element).
- void take(const argument& x);
+ /// Take into account a argument \p t (an element).
+ void take(const argument& t);
/// Take into account another accumulator \p other.
void take(const E& other);
Index: trunk/milena/mln/core/concept/accumulator.hh
===================================================================
--- trunk/milena/mln/core/concept/accumulator.hh (revision 1247)
+++ trunk/milena/mln/core/concept/accumulator.hh (revision 1248)
@@ -68,7 +68,7 @@
typedef argument;
typedef result;
void init();
- void take(const argument& x);
+ void take(const argument& t);
void take(const E& other);
result to_result() const;
operator result_() const;
Index: trunk/milena/mln/accu/min.hh
===================================================================
--- trunk/milena/mln/accu/min.hh (revision 1247)
+++ trunk/milena/mln/accu/min.hh (revision 1248)
@@ -48,26 +48,26 @@
/*! Generic min accumulator class.
*
- * The parameter \c V is the type of values.
+ * The parameter \c T is the type of values.
*/
- template <typename V>
- struct min_ : public mln::accu::internal::base_< V, min_<V> >
+ template <typename T>
+ struct min_ : public mln::accu::internal::base_< T, min_<T> >
{
- typedef V argument;
- typedef V result;
+ typedef T argument;
+ typedef T result;
min_();
void init();
- void take_as_init(const argument& x);
- void take(const argument& x);
- void take(const min_<V>& other);
+ void take_as_init(const argument& t);
+ void take(const argument& t);
+ void take(const min_<T>& other);
- V to_result() const;
+ T to_result() const;
protected:
- V x_;
+ T t_;
};
@@ -77,10 +77,10 @@
// FIXME: Doc!
struct min : public Meta_Accumulator< min >
{
- template <typename V>
+ template <typename T>
struct with
{
- typedef min_<V> ret;
+ typedef min_<T> ret;
};
};
@@ -88,17 +88,17 @@
// // FIXME: Sample code.
-// template <typename V>
-// struct p_min_ : public p_< min_<V> >
+// template <typename T>
+// struct p_min_ : public p_< min_<T> >
// {
// };
// struct p_min : public Meta_Accumulator< p_min >
// {
-// template <typename V>
+// template <typename T>
// struct with
// {
-// typedef p_min_<V> ret;
+// typedef p_min_<T> ret;
// };
// };
@@ -106,45 +106,45 @@
# ifndef MLN_INCLUDE_ONLY
- template <typename V>
- min_<V>::min_()
+ template <typename T>
+ min_<T>::min_()
{
init();
}
- template <typename V>
+ template <typename T>
void
- min_<V>::init()
+ min_<T>::init()
{
- x_ = mln_max(V);
+ t_ = mln_max(T);
}
- template <typename V>
- void min_<V>::take_as_init(const argument& x)
+ template <typename T>
+ void min_<T>::take_as_init(const argument& t)
{
- x_ = x;
+ t_ = t;
}
- template <typename V>
- void min_<V>::take(const argument& x)
+ template <typename T>
+ void min_<T>::take(const argument& t)
{
- if (x < x_)
- x_ = x;
+ if (t < t_)
+ t_ = t;
}
- template <typename V>
+ template <typename T>
void
- min_<V>::take(const min_<V>& other)
+ min_<T>::take(const min_<T>& other)
{
- if (other.x_ < x_)
- x_ = other.x_;
+ if (other.t_ < t_)
+ t_ = other.t_;
}
- template <typename V>
- V
- min_<V>::to_result() const
+ template <typename T>
+ T
+ min_<T>::to_result() const
{
- return x_;
+ return t_;
}
# endif // ! MLN_INCLUDE_ONLY
Index: trunk/milena/mln/accu/max.hh
===================================================================
--- trunk/milena/mln/accu/max.hh (revision 1247)
+++ trunk/milena/mln/accu/max.hh (revision 1248)
@@ -47,26 +47,26 @@
/*! Generic max accumulator class.
*
- * The parameter \c V is the type of values.
+ * The parameter \c T is the type of values.
*/
- template <typename V>
- struct max_ : public mln::accu::internal::base_< V , max_<V> >
+ template <typename T>
+ struct max_ : public mln::accu::internal::base_< T , max_<T> >
{
- typedef V argument;
- typedef V result;
+ typedef T argument;
+ typedef T result;
max_();
void init();
- void take_as_init(const argument& x);
- void take(const argument& x);
- void take(const max_<V>& other);
+ void take_as_init(const argument& t);
+ void take(const argument& t);
+ void take(const max_<T>& other);
- V to_result() const;
+ T to_result() const;
protected:
- V x_;
+ T t_;
};
@@ -76,10 +76,10 @@
// FIXME: Doc!
struct max : public Meta_Accumulator< max >
{
- template <typename V>
+ template <typename T>
struct with
{
- typedef max_<V> ret;
+ typedef max_<T> ret;
};
};
@@ -87,47 +87,47 @@
# ifndef MLN_INCLUDE_ONLY
- template <typename V>
- max_<V>::max_()
+ template <typename T>
+ max_<T>::max_()
{
init();
}
- template <typename V>
+ template <typename T>
void
- max_<V>::init()
+ max_<T>::init()
{
- x_ = mln_min(V);
+ t_ = mln_min(T);
}
- template <typename V>
+ template <typename T>
void
- max_<V>::take_as_init(const argument& x)
+ max_<T>::take_as_init(const argument& t)
{
- x_ = x;
+ t_ = t;
}
- template <typename V>
+ template <typename T>
void
- max_<V>::take(const argument& x)
+ max_<T>::take(const argument& t)
{
- if (x > x_)
- x_ = x;
+ if (t > t_)
+ t_ = t;
}
- template <typename V>
+ template <typename T>
void
- max_<V>::take(const max_<V>& other)
+ max_<T>::take(const max_<T>& other)
{
- if (other.x_ > x_)
- x_ = other.x_;
+ if (other.t_ > t_)
+ t_ = other.t_;
}
- template <typename V>
- V
- max_<V>::to_result() const
+ template <typename T>
+ T
+ max_<T>::to_result() const
{
- return x_;
+ return t_;
}
# endif // ! MLN_INCLUDE_ONLY
Index: trunk/milena/mln/accu/histo.hh
===================================================================
--- trunk/milena/mln/accu/histo.hh (revision 1247)
+++ trunk/milena/mln/accu/histo.hh (revision 1248)
@@ -61,12 +61,12 @@
typedef mln_value(S) argument;
typedef const std::vector<std::size_t>& result;
- void take(const argument& x);
+ void take(const argument& t);
void take(const histo<S>& other);
- void untake(const argument& x);
+ void untake(const argument& t);
void init();
- std::size_t operator()(const argument& x) const;
+ std::size_t operator()(const argument& t) const;
std::size_t operator[](std::size_t i) const;
std::size_t nvalues() const;
std::size_t sum() const;
@@ -110,9 +110,9 @@
template <typename S>
void
- histo<S>::take(const argument& x)
+ histo<S>::take(const argument& t)
{
- ++h_[s_.index_of(x)];
+ ++h_[s_.index_of(t)];
++sum_;
}
@@ -127,11 +127,11 @@
template <typename S>
void
- histo<S>::untake(const argument& x)
+ histo<S>::untake(const argument& t)
{
- mln_precondition(h_[s_.index_of(x)] > 0);
+ mln_precondition(h_[s_.index_of(t)] > 0);
mln_precondition(sum_ > 0);
- --h_[s_.index_of(x)];
+ --h_[s_.index_of(t)];
--sum_;
}
@@ -145,9 +145,9 @@
template <typename S>
std::size_t
- histo<S>::operator()(const argument& x) const
+ histo<S>::operator()(const argument& t) const
{
- return h_[s_.index_of(x)];
+ return h_[s_.index_of(t)];
}
template <typename S>
Index: trunk/milena/mln/accu/count.hh
===================================================================
--- trunk/milena/mln/accu/count.hh (revision 1247)
+++ trunk/milena/mln/accu/count.hh (revision 1248)
@@ -46,17 +46,17 @@
/*! Generic counter accumulator class.
*/
- template <typename V>
- struct count_ : public mln::accu::internal::base_< std::size_t , count_<V>
>
+ template <typename T>
+ struct count_ : public mln::accu::internal::base_< std::size_t , count_<T>
>
{
- typedef V argument;
+ typedef T argument;
typedef std::size_t result; // FIXME: Up in Accumulator.
count_();
void init();
void take(const argument&);
- void take(const count_<V>& other);
+ void take(const count_<T>& other);
std::size_t to_result() const;
void set_value(std::size_t c);
@@ -70,53 +70,53 @@
// FIXME: Doc!
struct count : public Meta_Accumulator< count >
{
- template <typename V>
+ template <typename T>
struct with
{
- typedef count_<V> ret;
+ typedef count_<T> ret;
};
};
# ifndef MLN_INCLUDE_ONLY
- template <typename V>
- count_<V>::count_()
+ template <typename T>
+ count_<T>::count_()
{
init();
}
- template <typename V>
+ template <typename T>
void
- count_<V>::init()
+ count_<T>::init()
{
count__ = 0;
}
- template <typename V>
+ template <typename T>
void
- count_<V>::take(const argument&)
+ count_<T>::take(const argument&)
{
++count__;
}
- template <typename V>
+ template <typename T>
void
- count_<V>::take(const count_<V>& other)
+ count_<T>::take(const count_<T>& other)
{
count__ += other.count__;
}
- template <typename V>
+ template <typename T>
std::size_t
- count_<V>::to_result() const
+ count_<T>::to_result() const
{
return count__;
}
- template <typename V>
+ template <typename T>
void
- count_<V>::set_value(std::size_t c)
+ count_<T>::set_value(std::size_t c)
{
count__ = c;
}
Index: trunk/milena/mln/accu/min_h.hh
===================================================================
--- trunk/milena/mln/accu/min_h.hh (revision 1247)
+++ trunk/milena/mln/accu/min_h.hh (revision 1248)
@@ -57,10 +57,10 @@
min_h();
void init();
- void take(const argument& x);
- void take_as_init(const argument& x);
+ void take(const argument& t);
+ void take_as_init(const argument& t);
void take(const min_h<S>& other);
- void untake(const argument& x);
+ void untake(const argument& t);
unsigned card() const { return h_.sum(); }
@@ -76,7 +76,7 @@
mutable std::size_t sum_;
mutable bool valid_;
mutable std::size_t i_; // the min index
- mutable argument x_; // the min value
+ mutable argument t_; // the min value
// Auxiliary methods
void update_() const;
@@ -105,15 +105,15 @@
template <typename S>
void
- min_h<S>::take(const argument& x)
+ min_h<S>::take(const argument& t)
{
- h_.take(x);
+ h_.take(t);
if (h_.sum() == 1)
{
- this->take_as_init(x);
+ this->take_as_init(t);
return;
}
- if (x < x_)
+ if (t < t_)
{
++sum_;
valid_ = false;
@@ -134,23 +134,23 @@
template <typename S>
void
- min_h<S>::untake(const argument& x)
+ min_h<S>::untake(const argument& t)
{
- mln_precondition(h_(x) != 0);
- h_.untake(x);
+ mln_precondition(h_(t) != 0);
+ h_.untake(t);
if (h_.sum() == 0)
{
init();
return;
}
- if (x < x_)
+ if (t < t_)
{
mln_invariant(sum_ >= 1);
--sum_;
valid_ = false;
}
else
- if (x == x_ && h_[i_] == 0)
+ if (t == t_ && h_[i_] == 0)
valid_ = false;
}
@@ -177,7 +177,7 @@
sum_ -= h_[i_];
}
while (sum_ != 0);
- x_ = s_[i_];
+ t_ = s_[i_];
}
template <typename S>
@@ -187,7 +187,7 @@
do
++i_;
while (h_[i_] == 0);
- x_ = s_[i_];
+ t_ = s_[i_];
}
template <typename S>
@@ -197,18 +197,18 @@
h_.init();
sum_ = 0;
i_ = mln_max(argument);
- x_ = s_[i_];
+ t_ = s_[i_];
valid_ = true;
}
template <typename S>
void
- min_h<S>::take_as_init(const argument& x)
+ min_h<S>::take_as_init(const argument& t)
{
- h_.take(x);
+ h_.take(t);
sum_ = 0;
- i_ = s_.index_of(x);
- x_ = x;
+ i_ = s_.index_of(t);
+ t_ = t;
valid_ = true;
}
@@ -218,7 +218,7 @@
{
if (! valid_)
update_();
- return x_;
+ return t_;
}
template <typename S>
Index: trunk/milena/mln/accu/pair.hh
===================================================================
--- trunk/milena/mln/accu/pair.hh (revision 1247)
+++ trunk/milena/mln/accu/pair.hh (revision 1248)
@@ -51,14 +51,14 @@
/*! Generic pair of accumulators.
*
- * The parameter \c V is the type of values.
+ * The parameter \c T is the type of values.
*
- * \todo Check that, when V is not provided, A1 and A2 have the same value.
+ * \todo Check that, when T is not provided, A1 and A2 have the same value.
*/
- template <typename A1, typename A2, typename V = mln_argument(A1)>
- struct pair_ : public mln::accu::internal::base_< std::pair<
mlc_unqualif(mln_result(A1)) , mlc_unqualif(mln_result(A2)) > , pair_<A1,A2,V>
>
+ template <typename A1, typename A2, typename T = mln_argument(A1)>
+ struct pair_ : public mln::accu::internal::base_< std::pair<
mlc_unqualif(mln_result(A1)) , mlc_unqualif(mln_result(A2)) > , pair_<A1,A2,T>
>
{
- typedef V argument;
+ typedef T argument;
typedef mlc_unqualif(mln_result(A1)) result_1;
typedef mlc_unqualif(mln_result(A2)) result_2;
@@ -68,9 +68,9 @@
pair_(const A1& a1, const A2& a2);
void init();
- void take_as_init(const argument& x);
- void take(const argument& x);
- void take(const pair_<A1,A2,V>& other);
+ void take_as_init(const argument& t);
+ void take(const argument& t);
+ void take(const pair_<A1,A2,T>& other);
result to_result() const;
void get_result(result_1& r1, result_2& r2) const;
@@ -87,67 +87,67 @@
template <typename A1, typename A2>
struct pair : public Meta_Accumulator< pair<A1,A2> >
{
- template <typename V>
+ template <typename T>
struct with
{
- typedef mln_accu_with(A1, V) A1_V;
- typedef mln_accu_with(A2, V) A2_V;
- typedef pair_<A1_V, A2_V, V> ret;
+ typedef mln_accu_with(A1, T) A1_T;
+ typedef mln_accu_with(A2, T) A2_T;
+ typedef pair_<A1_T, A2_T, T> ret;
};
};
# ifndef MLN_INCLUDE_ONLY
- template <typename A1, typename A2, typename V>
- pair_<A1,A2,V>::pair_()
+ template <typename A1, typename A2, typename T>
+ pair_<A1,A2,T>::pair_()
{
init();
}
- template <typename A1, typename A2, typename V>
+ template <typename A1, typename A2, typename T>
void
- pair_<A1,A2,V>::init()
+ pair_<A1,A2,T>::init()
{
a1_.init();
a2_.init();
}
- template <typename A1, typename A2, typename V>
+ template <typename A1, typename A2, typename T>
void
- pair_<A1,A2,V>::take_as_init(const argument& x)
+ pair_<A1,A2,T>::take_as_init(const argument& t)
{
- a1_.take_as_init(x);
- a2_.take_as_init(x);
+ a1_.take_as_init(t);
+ a2_.take_as_init(t);
}
- template <typename A1, typename A2, typename V>
+ template <typename A1, typename A2, typename T>
void
- pair_<A1,A2,V>::take(const argument& x)
+ pair_<A1,A2,T>::take(const argument& t)
{
- a1_.take(x);
- a2_.take(x);
+ a1_.take(t);
+ a2_.take(t);
}
- template <typename A1, typename A2, typename V>
+ template <typename A1, typename A2, typename T>
void
- pair_<A1,A2,V>::take(const pair_<A1,A2,V>& other)
+ pair_<A1,A2,T>::take(const pair_<A1,A2,T>& other)
{
a1_.take(other.a1_);
a2_.take(other.a2_);
}
- template <typename A1, typename A2, typename V>
- typename pair_<A1,A2,V>::result
- pair_<A1,A2,V>::to_result() const
+ template <typename A1, typename A2, typename T>
+ typename pair_<A1,A2,T>::result
+ pair_<A1,A2,T>::to_result() const
{
result tmp(a1_.to_result(), a2_.to_result());
return tmp;
}
- template <typename A1, typename A2, typename V>
+ template <typename A1, typename A2, typename T>
void
- pair_<A1,A2,V>::get_result(result_1& r1,
+ pair_<A1,A2,T>::get_result(result_1& r1,
result_2& r2) const
{
r1 = a1_.to_result();
Index: trunk/milena/mln/accu/max_h.hh
===================================================================
--- trunk/milena/mln/accu/max_h.hh (revision 1247)
+++ trunk/milena/mln/accu/max_h.hh (revision 1248)
@@ -57,10 +57,10 @@
max_h();
void init();
- void take(const argument& x);
- void take_as_init(const argument& x);
+ void take(const argument& t);
+ void take_as_init(const argument& t);
void take(const max_h<S>& other);
- void untake(const argument& x);
+ void untake(const argument& t);
unsigned card() const { return h_.sum(); }
@@ -76,7 +76,7 @@
mutable std::size_t sum_;
mutable bool valid_;
mutable std::size_t i_; // the max index
- mutable argument x_; // the max argument
+ mutable argument t_; // the max argument
// Auxiliary methods
void update_() const;
@@ -105,15 +105,15 @@
template <typename S>
void
- max_h<S>::take(const argument& x)
+ max_h<S>::take(const argument& t)
{
- h_.take(x);
+ h_.take(t);
if (h_.sum() == 1)
{
- this->take_as_init(x);
+ this->take_as_init(t);
return;
}
- if (x > x_)
+ if (t > t_)
{
++sum_;
valid_ = false;
@@ -134,23 +134,23 @@
template <typename S>
void
- max_h<S>::untake(const argument& x)
+ max_h<S>::untake(const argument& t)
{
- mln_precondition(h_(x) != 0);
- h_.untake(x);
+ mln_precondition(h_(t) != 0);
+ h_.untake(t);
if (h_.sum() == 0)
{
init();
return;
}
- if (x > x_)
+ if (t > t_)
{
mln_invariant(sum_ >= 1);
--sum_;
valid_ = false;
}
else
- if (x == x_ && h_[i_] == 0)
+ if (t == t_ && h_[i_] == 0)
valid_ = false;
}
@@ -173,7 +173,7 @@
do
--i_;
while (h_[i_] == 0);
- x_ = s_[i_];
+ t_ = s_[i_];
}
template <typename S>
@@ -186,7 +186,7 @@
if (h_[i_] != 0)
sum_ -= h_[i_];
} while (sum_ != 0);
- x_ = s_[i_];
+ t_ = s_[i_];
}
template <typename S>
@@ -196,18 +196,18 @@
h_.init();
sum_ = 0;
i_ = mln_min(argument);
- x_ = s_[i_];
+ t_ = s_[i_];
valid_ = true;
}
template <typename S>
void
- max_h<S>::take_as_init(const argument& x)
+ max_h<S>::take_as_init(const argument& t)
{
- h_.take(x);
+ h_.take(t);
sum_ = 0;
- i_ = s_.index_of(x);
- x_ = x;
+ i_ = s_.index_of(t);
+ t_ = t;
valid_ = true;
}
@@ -217,7 +217,7 @@
{
if (! valid_)
update_();
- return x_;
+ return t_;
}
template <typename S>
Index: trunk/milena/mln/accu/median.hh
===================================================================
--- trunk/milena/mln/accu/median.hh (revision 1247)
+++ trunk/milena/mln/accu/median.hh (revision 1248)
@@ -57,9 +57,9 @@
median();
void init();
- void take(const argument& x);
+ void take(const argument& t);
void take(const median<S>& other);
- void untake(const argument& x);
+ void untake(const argument& t);
unsigned card() const { return h_.sum(); }
@@ -76,7 +76,7 @@
mutable bool valid_;
mutable std::size_t i_; // the median index
- mutable argument x_; // the median value
+ mutable argument t_; // the median value
// Auxiliary methods
void update_() const;
@@ -105,13 +105,13 @@
template <typename S>
void
- median<S>::take(const argument& x)
+ median<S>::take(const argument& t)
{
- h_.take(x);
+ h_.take(t);
- if (x < x_)
+ if (t < t_)
++sum_minus_;
- else if (x > x_)
+ else if (t > t_)
++sum_plus_;
if (valid_)
@@ -139,14 +139,14 @@
template <typename S>
void
- median<S>::untake(const argument& x)
+ median<S>::untake(const argument& t)
{
- mln_precondition(h_(x) != 0);
- h_.untake(x);
+ mln_precondition(h_(t) != 0);
+ h_.untake(t);
- if (x < x_)
+ if (t < t_)
--sum_minus_;
- else if (x > x_)
+ else if (t > t_)
--sum_plus_;
if (valid_)
@@ -191,7 +191,7 @@
sum_minus_ -= h_[i_];
}
while (2 * sum_minus_ > h_.sum());
- x_ = s_[i_];
+ t_ = s_[i_];
}
template <typename S>
@@ -207,7 +207,7 @@
sum_plus_ -= h_[i_];
}
while (2 * sum_plus_ > h_.sum());
- x_ = s_[i_];
+ t_ = s_[i_];
}
template <typename S>
@@ -218,7 +218,7 @@
sum_minus_ = 0;
sum_plus_ = 0;
i_ = (mln_max(argument) - mln_min(argument)) / 2;
- x_ = s_[i_];
+ t_ = s_[i_];
valid_ = true;
}
@@ -228,7 +228,7 @@
{
if (! valid_)
update_();
- return x_;
+ return t_;
}
template <typename S>
Index: trunk/milena/mln/accu/median_alt.hh
===================================================================
--- trunk/milena/mln/accu/median_alt.hh (revision 1247)
+++ trunk/milena/mln/accu/median_alt.hh (revision 1248)
@@ -54,8 +54,8 @@
median_alt(const Value_Set<S>& s);
- void take(const argument& x);
- void untake(const argument& x);
+ void take(const argument& t);
+ void untake(const argument& t);
void init();
argument to_result() const;
@@ -64,7 +64,7 @@
void debug__() const
{
std::cout << " i = " << i_
- << " x = " << x_
+ << " t = " << t_
<< " s = " << sum_minus_ << " ; " <<
h_[i_] << " ; " << sum_plus_ << " = " <<
h_.sum()
<< std::endl;
}
@@ -77,7 +77,7 @@
std::size_t sum_minus_, sum_plus_;
std::size_t i_; // the median index
- argument x_; // the median argument
+ argument t_; // the median argument
// Auxiliary methods
void go_minus_();
@@ -109,24 +109,24 @@
template <typename S>
void
- median_alt<S>::take(const argument& x)
+ median_alt<S>::take(const argument& t)
{
// update h_
- h_.take(x);
+ h_.take(t);
// particular case:
// current state was initialization
if (h_[i_] == 0)
{
// std::cout << "init!" << std::endl;
- i_ = s_.index_of(x);
- x_ = x;
+ i_ = s_.index_of(t);
+ t_ = t;
return;
}
// particular case:
// the median does not change
- if (x == x_)
+ if (t == t_)
{
// std::cout << "no change!" << std::endl;
return;
@@ -134,14 +134,14 @@
// general case:
- if (x < x_)
+ if (t < t_)
{
++sum_minus_;
if (2 * sum_minus_ > h_.sum())
go_minus_();
}
else
- // x > x_
+ // t > t_
{
++sum_plus_;
if (2 * sum_plus_ > h_.sum())
@@ -152,12 +152,12 @@
template <typename S>
void
- median_alt<S>::untake(const argument& x)
+ median_alt<S>::untake(const argument& t)
{
- mln_precondition(h_(x) != 0);
+ mln_precondition(h_(t) != 0);
// update h_
- h_.untake(x);
+ h_.untake(t);
// particular case:
// the only value has been removed
@@ -168,20 +168,20 @@
}
// general case:
- if (x < x_)
+ if (t < t_)
{
--sum_minus_;
if (2 * sum_plus_ > h_.sum())
go_plus_();
}
- else if (x > x_)
+ else if (t > t_)
{
--sum_plus_;
if (2 * sum_minus_ > h_.sum())
go_minus_();
}
else
- // x == x_
+ // t == t_
{
if (h_[i_] == 0)
{
@@ -216,7 +216,7 @@
sum_minus_ -= h_[i_];
}
while (2 * sum_minus_ > h_.sum());
- x_ = s_[i_];
+ t_ = s_[i_];
}
@@ -233,7 +233,7 @@
sum_plus_ -= h_[i_];
}
while (2 * sum_plus_ > h_.sum());
- x_ = s_[i_];
+ t_ = s_[i_];
}
@@ -245,14 +245,14 @@
sum_minus_ = 0;
sum_plus_ = 0;
i_ = (mln_max(argument) - mln_min(argument)) / 2;
- x_ = s_[i_];
+ t_ = s_[i_];
}
template <typename S>
typename median_alt<S>::argument
median_alt<S>::to_result() const
{
- return x_;
+ return t_;
}
template <typename S>
Index: trunk/milena/mln/accu/p.hh
===================================================================
--- trunk/milena/mln/accu/p.hh (revision 1247)
+++ trunk/milena/mln/accu/p.hh (revision 1248)
@@ -61,8 +61,8 @@
p_(const A& a);
void init();
- void take_as_init(const argument& x);
- void take(const argument& x);
+ void take_as_init(const argument& t);
+ void take(const argument& t);
void take(const p_<A>& other);
result to_result() const;
@@ -109,16 +109,16 @@
template <typename A>
void
- p_<A>::take_as_init(const argument& x)
+ p_<A>::take_as_init(const argument& t)
{
- a_.take_as_init(x.p()); // FIXME: Generalize with "psite(x)".
+ a_.take_as_init(t.p()); // FIXME: Generalize with "psite(t)".
}
template <typename A>
void
- p_<A>::take(const argument& x)
+ p_<A>::take(const argument& t)
{
- a_.take(x.p());
+ a_.take(t.p());
}
template <typename A>
Index: trunk/milena/mln/accu/sum.hh
===================================================================
--- trunk/milena/mln/accu/sum.hh (revision 1247)
+++ trunk/milena/mln/accu/sum.hh (revision 1248)
@@ -50,21 +50,21 @@
/*! Generic sum accumulator class.
*
- * Parameter \c V is the type of values that we sum. Parameter \c
+ * Parameter \c T is the type of values that we sum. Parameter \c
* S is the type to store the value sum; the default type of
- * \c S is the summation type (property) of \c V.
+ * \c S is the summation type (property) of \c T.
*/
- template <typename V, typename S = mln_sum(V)>
- struct sum_ : public mln::accu::internal::base_< S, sum_<V,S> >
+ template <typename T, typename S = mln_sum(T)>
+ struct sum_ : public mln::accu::internal::base_< S, sum_<T,S> >
{
- typedef V argument;
+ typedef T argument;
typedef S result;
sum_();
void init();
- void take(const argument& x);
- void take(const sum_<V,S>& other);
+ void take(const argument& t);
+ void take(const sum_<T,S>& other);
S to_result() const;
@@ -81,10 +81,10 @@
// FIXME: Doc!
struct sum : public Meta_Accumulator< sum >
{
- template <typename V, typename S = mln_sum(V)>
+ template <typename T, typename S = mln_sum(T)>
struct with
{
- typedef sum_<V, S> ret;
+ typedef sum_<T, S> ret;
};
};
@@ -92,35 +92,35 @@
# ifndef MLN_INCLUDE_ONLY
- template <typename V, typename S>
- sum_<V,S>::sum_()
+ template <typename T, typename S>
+ sum_<T,S>::sum_()
{
init();
}
- template <typename V, typename S>
+ template <typename T, typename S>
void
- sum_<V,S>::init()
+ sum_<T,S>::init()
{
s_ = literal::zero;
}
- template <typename V, typename S>
- void sum_<V,S>::take(const argument& x)
+ template <typename T, typename S>
+ void sum_<T,S>::take(const argument& t)
{
- s_ += x;
+ s_ += t;
}
- template <typename V, typename S>
+ template <typename T, typename S>
void
- sum_<V,S>::take(const sum_<V,S>& other)
+ sum_<T,S>::take(const sum_<T,S>& other)
{
s_ += other.s_;
}
- template <typename V, typename S>
+ template <typename T, typename S>
S
- sum_<V,S>::to_result() const
+ sum_<T,S>::to_result() const
{
return s_;
}
Index: trunk/milena/mln/accu/v.hh
===================================================================
--- trunk/milena/mln/accu/v.hh (revision 1247)
+++ trunk/milena/mln/accu/v.hh (revision 1248)
@@ -57,8 +57,8 @@
val_(const A& a);
void init();
- void take_as_init(const argument& x);
- void take(const argument& x);
+ void take_as_init(const argument& t);
+ void take(const argument& t);
void take(const val_<A>& other);
template <typename I>
@@ -118,16 +118,16 @@
template <typename A>
void
- val_<A>::take_as_init(const argument& x)
+ val_<A>::take_as_init(const argument& t)
{
- a_.take_as_init(x);
+ a_.take_as_init(t);
}
template <typename A>
void
- val_<A>::take(const argument& x)
+ val_<A>::take(const argument& t)
{
- a_.take(x);
+ a_.take(t);
}
template <typename A>
Index: trunk/milena/mln/accu/mean.hh
===================================================================
--- trunk/milena/mln/accu/mean.hh (revision 1247)
+++ trunk/milena/mln/accu/mean.hh (revision 1248)
@@ -49,32 +49,32 @@
/*! Generic mean accumulator class.
*
- * Parameter \c V is the type of values that we sum. Parameter \c
+ * Parameter \c T is the type of values that we sum. Parameter \c
* S is the type to store the sum of values; the default type of
- * \c S is the summation type (property) of \c V. Parameter \c M
+ * \c S is the summation type (property) of \c T. Parameter \c M
* is the type of the mean value; the default type of \c M is \c
* S.
*/
- template <typename V,
- typename S = mln_sum(V),
+ template <typename T,
+ typename S = mln_sum(T),
typename M = S>
- struct mean_ : public mln::accu::internal::base_< M , mean_<V,S,M> >
+ struct mean_ : public mln::accu::internal::base_< M , mean_<T,S,M> >
{
- typedef V argument;
+ typedef T argument;
typedef M result;
mean_();
void init();
- void take(const argument& x);
- void take(const mean_<V,S,M>& other);
+ void take(const argument& t);
+ void take(const mean_<T,S,M>& other);
M to_result() const;
protected:
- accu::count_<V> count_;
- accu::sum_<V,S> sum_;
+ accu::count_<T> count_;
+ accu::sum_<T,S> sum_;
};
@@ -87,50 +87,50 @@
// FIXME: Doc!
struct mean : public Meta_Accumulator< mean >
{
- template < typename V,
- typename S = mln_sum(V),
+ template < typename T,
+ typename S = mln_sum(T),
typename M = S >
struct with
{
- typedef mean_<V,S,M> ret;
+ typedef mean_<T,S,M> ret;
};
};
# ifndef MLN_INCLUDE_ONLY
- template <typename V, typename S, typename M>
- mean_<V,S,M>::mean_()
+ template <typename T, typename S, typename M>
+ mean_<T,S,M>::mean_()
{
init();
}
- template <typename V, typename S, typename M>
+ template <typename T, typename S, typename M>
void
- mean_<V,S,M>::init()
+ mean_<T,S,M>::init()
{
count_.init();
sum_.init();
}
- template <typename V, typename S, typename M>
- void mean_<V,S,M>::take(const argument& x)
+ template <typename T, typename S, typename M>
+ void mean_<T,S,M>::take(const argument& t)
{
- count_.take(x);
- sum_.take(x);
+ count_.take(t);
+ sum_.take(t);
}
- template <typename V, typename S, typename M>
+ template <typename T, typename S, typename M>
void
- mean_<V,S,M>::take(const mean_<V,S,M>& other)
+ mean_<T,S,M>::take(const mean_<T,S,M>& other)
{
count_.take(other.count_);
sum_.take(other.sum_);
}
- template <typename V, typename S, typename M>
+ template <typename T, typename S, typename M>
M
- mean_<V,S,M>::to_result() const
+ mean_<T,S,M>::to_result() const
{
return sum_.to_result() / count_.to_result();
}