Go to the documentation of this file.    1 #ifndef __JTOOLS__JCOLLECTION__ 
    2 #define __JTOOLS__JCOLLECTION__ 
   70   template<
class JElement_t, 
class JDistance_t = JDistance<
typename JElement_t::abscissa_type> >
 
   74                                typename JElement_t::ordinate_type>,
 
   76     public JMATH::JMath< JCollection<JElement_t, JDistance_t> >
 
   91     typedef typename container_type::iterator                    
iterator;
 
  112                              const JElement_t& second)
 const 
  114         return this->
getDistance(first.getX(), second.getX()) > 0.0;
 
  150       container_type::clear();
 
  164       if (i == this->end() || this->
getDistance(x, i->getX()) > distance_type::precision) {
 
  179       return (
int) this->size();
 
  191       return this->at(index).getX();
 
  202       return this->begin()->getX();
 
  213       return this->rbegin()->getX();
 
  226       return this->at(index).getY();
 
  238       return this->at(index).getY();
 
  254         this->
insert(transformer(*i));
 
  264       std::sort(this->begin(), this->end(), 
compare);
 
  276       return std::lower_bound(this->begin(), this->end(), x, 
compare);
 
  288       return std::lower_bound(this->begin(), this->end(), x, 
compare);
 
  302       if (i == this->end() || this->
getDistance(element.
getX(), i->getX()) > 0.0)
 
  303         return pair_type(container_type::insert(i, element), 
true);
 
  316       configure(bounds, JMATH::getZero<ordinate_type>());
 
  331       for (
iterator i = this->begin(); i != this->end(); ++i) {
 
  346     template<
class JFunction1D_t>
 
  348                    const JFunction1D_t&                      
function)
 
  350       using namespace JLANG;
 
  354       for (
int i = 0; i != bounds.
getSize(); ++i) {
 
  358         out->
put(x, 
function(x));
 
  378       if (this->empty() || collection.empty()) {
 
  389         if        (
getDistance(p->getX(), q->getX()) > precision) { 
 
  393           } 
while (p != this->end()      && 
getDistance(p->getX(), q->getX()) > precision); 
 
  395         } 
else if (
getDistance(q->getX(), p->getX()) > precision) { 
 
  399           } 
while (q != collection.end() && 
getDistance(q->getX(), p->getX()) > precision); 
 
  402         for ( ; p != this->end() && q != collection.end(); ++p, ++q) {
 
  403           if (fabs(
getDistance(p->getX(), q->getX())) > precision) {
 
  420       for (
iterator i = this->begin(); i != this->end(); ++i) {
 
  421         i->
getY() = -i->getY();
 
  436       if (!collection.empty()) {
 
  440           for (
const_iterator i = collection.begin(); i != collection.end(); ++i) {
 
  441             this->
put(i->getX(), +i->getY());
 
  451           if        (
getDistance(p->getX(), q->getX()) > precision) { 
 
  455             } 
while (p != this->end()      && 
getDistance(p->getX(), q->getX()) > precision); 
 
  457           } 
else if (
getDistance(q->getX(), p->getX()) > precision) { 
 
  461             } 
while (q != collection.end() && 
getDistance(q->getX(), p->getX()) > precision); 
 
  466           for ( ; p != this->end() && i != collection.end(); ++p, ++i) {
 
  467             p->
getY() += i->getY();
 
  470           for ( ; i != collection.end(); ++i) {
 
  471             this->
put(i->getX(), +i->getY());
 
  474           for (i = collection.begin(); i != q; ++i) {
 
  475             this->
put(i->getX(), +i->getY());
 
  492       if (!collection.empty()) {
 
  496           for (
const_iterator i = collection.begin(); i != collection.end(); ++i) {
 
  497             this->
put(i->getX(), -i->getY());
 
  507           if        (
getDistance(p->getX(), q->getX()) > precision) { 
 
  511             } 
while (p != this->end()      && 
getDistance(p->getX(), q->getX()) > precision); 
 
  513           } 
else if (
getDistance(q->getX(), p->getX()) > precision) { 
 
  517             } 
while (q != collection.end() && 
getDistance(q->getX(), p->getX()) > precision); 
 
  522           for ( ; p != this->end() && i != collection.end(); ++p, ++i) {
 
  523             p->
getY() -= i->getY();
 
  526           for ( ; i != collection.end(); ++i) {
 
  527             this->
put(i->getX(), -i->getY());
 
  530           for (i = collection.begin(); i != q; ++i) {
 
  531             this->
put(i->getX(), -i->getY());
 
  536           throw JException(
"JCollection::add() collections incompatible.");
 
  552       for (
iterator i = this->begin(); i != this->end(); ++i) {
 
  568       for (
iterator i = this->begin(); i != this->end(); ++i) {
 
  584       for (
iterator i = this->begin(); i != this->end(); ++i) {
 
  600       for (
iterator i = this->begin(); i != this->end(); ++i) {
 
  614     template<
class JFunction1D_t>
 
  617       for (
iterator i = this->begin(); i != this->end(); ++i) {
 
  618         i->
getY() += 
function(i->getX());
 
  631     template<
class JFunction1D_t>
 
  634       for (
iterator i = this->begin(); i != this->end(); ++i) {
 
  635         i->
getY() -= 
function(i->getX());
 
  651       return collection.
add(value);
 
  664       return collection.
sub(value);
 
  675     template<
class JFunction1D_t>
 
  678       return collection.
add(
function);
 
  689     template<
class JFunction1D_t>
 
  692       return collection.
sub(
function);
 
  728       const int n = collection.size();
 
  769     void resize(
typename container_type::size_type size)
 
  771       container_type::resize(size);
 
  790   template<
class JElement_t,
 
  792   inline typename JElement_t::ordinate_type 
 
  802       output.
put(input.begin()->
getX(), V);
 
  806         V += 0.5 * input.
getDistance(i->getX(), 
j->getX()) * (i->getY() + 
j->getY());
 
  808         output.
put(
j->getX(), V);
 
 
Interface for binary input.
 
JArgument< T >::argument_type argument_type
 
Template for generic class types.
 
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
 
Auxiliary base class for aritmetic operations of derived class types.
 
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
 
Interface for binary output.
 
Template definition of auxiliary class to compare objects.
 
static const JZero zero
Function object to assign zero value.
 
Auxiliary classes and methods for language specific functionality.
 
bool is_identical(JFirst_t &first, JSecond_t &second)
Check if two objects are indentical.