1#ifndef __JTOOLS__JCOLLECTION__ 
    2#define __JTOOLS__JCOLLECTION__ 
   72  template<
class JElement_t, 
class JDistance_t = JDistance<
typename JElement_t::abscissa_type> >
 
   76                               typename JElement_t::ordinate_type>,
 
   78    public JMath< JCollection<JElement_t, JDistance_t> >
 
   93    typedef typename container_type::iterator                    
iterator;
 
  114                             const JElement_t& second)
 const 
  116        return this->
getDistance(first.getX(), second.getX()) > 0.0;
 
 
 
  152      container_type::clear();
 
 
  166      if (i == this->end() || this->
getDistance(x, i->getX()) > distance_type::precision) {
 
 
  184      if (i == this->end() || this->
getDistance(x, i->getX()) > distance_type::precision) {
 
 
  199      return (
int) this->size();
 
 
  211      return this->at(index).getX();
 
 
  222      return this->begin()->getX();
 
 
  233      return this->rbegin()->getX();
 
 
  246      return this->at(index).getY();
 
 
  258      return this->at(index).getY();
 
 
  269      for (
iterator i = this->begin(); i != this->end(); ++i) {
 
  270        *i = transformer(*i);
 
 
  282      std::sort(this->begin(), this->end(), 
compare);
 
 
  294      return std::lower_bound(this->begin(), this->end(), x, 
compare);
 
 
  306      return std::lower_bound(this->begin(), this->end(), x, 
compare);
 
 
  320      if (i == this->end() || this->
getDistance(element.getX(), i->getX()) > 0.0)
 
  321        return pair_type(container_type::insert(i, element), 
true);
 
 
  349      for (
iterator i = this->begin(); i != this->end(); ++i) {
 
 
  364    template<
class JFunction1D_t>
 
  366                   const JFunction1D_t&                      function)
 
  368      using namespace JLANG;
 
  372      for (
int i = 0; i != bounds.
getSize(); ++i) {
 
  376        out->
put(x, function(x));
 
  379      if (is_identical(*
this, function)) {
 
 
  396      if (this->empty() || collection.empty()) {
 
  407        if        (
getDistance(p->getX(), q->getX()) > precision) { 
 
  411          } 
while (p != this->end()      && 
getDistance(p->getX(), q->getX()) > precision); 
 
  413        } 
else if (
getDistance(q->getX(), p->getX()) > precision) { 
 
  417          } 
while (q != collection.end() && getDistance(q->getX(), p->getX()) > precision); 
 
  420        for ( ; p != this->end() && q != collection.end(); ++p, ++q) {
 
  421          if (fabs(
getDistance(p->getX(), q->getX())) > precision) {
 
 
  454      for (
iterator i = this->begin(); i != this->end(); ++i) {
 
  455        i->getY() = -i->getY();
 
 
  470      if (!collection.empty()) {
 
  474          for (
const_iterator i = collection.begin(); i != collection.end(); ++i) {
 
  475            this->
put(i->getX(), +i->getY());
 
  485          if        (
getDistance(p->getX(), q->getX()) > precision) { 
 
  489            } 
while (p != this->end()      && 
getDistance(p->getX(), q->getX()) > precision); 
 
  491          } 
else if (
getDistance(q->getX(), p->getX()) > precision) { 
 
  495            } 
while (q != collection.end() && getDistance(q->getX(), p->getX()) > precision); 
 
  500          for ( ; p != this->end() && i != collection.end(); ++p, ++i) {
 
  501            p->getY() += i->getY();
 
  504          for ( ; i != collection.end(); ++i) {
 
  505            this->
put(i->getX(), +i->getY());
 
  508          for (i = collection.begin(); i != q; ++i) {
 
  509            this->
put(i->getX(), +i->getY());
 
 
  526      if (!collection.empty()) {
 
  530          for (
const_iterator i = collection.begin(); i != collection.end(); ++i) {
 
  531            this->
put(i->getX(), -i->getY());
 
  541          if        (
getDistance(p->getX(), q->getX()) > precision) { 
 
  545            } 
while (p != this->end()      && 
getDistance(p->getX(), q->getX()) > precision); 
 
  547          } 
else if (
getDistance(q->getX(), p->getX()) > precision) { 
 
  551            } 
while (q != collection.end() && getDistance(q->getX(), p->getX()) > precision); 
 
  556          for ( ; p != this->end() && i != collection.end(); ++p, ++i) {
 
  557            p->getY() -= i->getY();
 
  560          for ( ; i != collection.end(); ++i) {
 
  561            this->
put(i->getX(), -i->getY());
 
  564          for (i = collection.begin(); i != q; ++i) {
 
  565            this->
put(i->getX(), -i->getY());
 
 
  586      for (
iterator i = this->begin(); i != this->end(); ++i) {
 
 
  602      for (
iterator i = this->begin(); i != this->end(); ++i) {
 
 
  618      for (
iterator i = this->begin(); i != this->end(); ++i) {
 
 
  634      for (
iterator i = this->begin(); i != this->end(); ++i) {
 
 
  648    template<
class JFunction1D_t>
 
  651      for (
iterator i = this->begin(); i != this->end(); ++i) {
 
  652        i->getY() += function(i->getX());
 
 
  665    template<
class JFunction1D_t>
 
  668      for (
iterator i = this->begin(); i != this->end(); ++i) {
 
  669        i->getY() -= function(i->getX());
 
 
  685      return collection.add(value);
 
 
  698      return collection.sub(value);
 
 
  709    template<
class JFunction1D_t>
 
  712      return collection.add(function);
 
 
  723    template<
class JFunction1D_t>
 
  726      return collection.sub(function);
 
 
  743        collection.resize(
n);
 
 
  763      const int n = collection.size();
 
 
  804    void resize(
typename container_type::size_type size)
 
  806      container_type::resize(size);
 
 
  825  template<
class JElement_t,
 
  827  inline typename JElement_t::ordinate_type 
 
  830    typedef typename JElement_t::ordinate_type                             ordinate_type;
 
  835    if (input.getSize() > 1) {
 
  837      output.
put(input.begin()->getX(), V);
 
  839      for (const_iterator 
j = input.begin(), i = 
j++; 
j != input.end(); ++i, ++
j) {
 
  841        V += 0.5 * input.getDistance(i->getX(), 
j->getX()) * (i->getY() + 
j->getY());
 
  843        output.
put(
j->getX(), V);
 
 
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
 
Base class for data structures with artithmetic capabilities.
 
Definition of zero value for any class.
 
Interface for binary input.
 
Interface for binary output.
 
Exception for accessing a value in a collection that is outside of its range.
 
Auxiliary classes and methods for language specific functionality.
 
T getZero()
Get zero value for a given data type.
 
static const JZero zero
Function object to assign zero value.
 
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
 
Template for generic class types.
 
JArgument< T >::argument_type argument_type
 
Auxiliary base class for aritmetic operations of derived class types.