Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JCollection.hh
Go to the documentation of this file.
1 #ifndef __JTOOLS__JCOLLECTION__
2 #define __JTOOLS__JCOLLECTION__
3 
4 #include <vector>
5 #include <cmath>
6 #include <limits>
7 #include <algorithm>
8 
9 #include "JLang/JClass.hh"
10 #include "JLang/JException.hh"
11 #include "JLang/JLangToolkit.hh"
12 #include "JMath/JZero.hh"
13 #include "JMath/JMath.hh"
14 #include "JIO/JSerialisable.hh"
15 #include "JTools/JDistance.hh"
16 #include "JTools/JTransformer.hh"
19 
20 /**
21  * \file
22  *
23  * General purpose class for a collection of sorted elements.
24  * \author mdejong
25  */
26 namespace JTOOLS {}
27 namespace JPP { using namespace JTOOLS; }
28 
29 namespace JTOOLS {
30 
32  using JIO::JReader;
33  using JIO::JWriter;
34  using JLANG::JClass;
35  using JLANG::JException;
36 
37 
38  /**
39  * General purpose class for collection of elements, see:
40  \htmlonly
41  <a href="JTools.PDF";>Collection of elements.</a>
42  \endhtmlonly
43  *
44  * This class implements the JMappableCollection and JAbstractCollection interfaces.
45  *
46  * The data type of the elements of the collection should have the following policy
47  * type definition and member methods.
48  * <pre>
49  * typedef <abscissa type> abscissa_type;
50  * typedef <ordinate type> ordinate_type;
51  *
52  * (constructor)(abscissa_type, ordinate_type);
53  *
54  * abscissa_type %getX() const;
55  * ordinate_type %getY() const;
56  * ordinate_type& %getY();
57  * </pre>
58  *
59  * The elements in a collection are sorted according to their abscissa values and
60  * the given distance operator.
61  * The distance operator constitues a binary method returning the distance between
62  * two abscissa values; The default distance operator is JDistance.
63  *
64  * For the binary I/O of a collection of elements, the data structure of the elements
65  * should provide for an implementation of the following operators:
66  * <pre>
67  * JReader& operator>>(JReader& in);
68  * JWriter& operator<<(JWriter& out);
69  * </pre>
70  */
71  template<class JElement_t, class JDistance_t = JDistance<typename JElement_t::abscissa_type> >
72  class JCollection :
73  public std::vector<JElement_t>,
74  public JMappableCollection<typename JElement_t::abscissa_type,
75  typename JElement_t::ordinate_type>,
76  public JAbstractCollection<typename JElement_t::abscissa_type>,
77  public JMATH::JMath< JCollection<JElement_t, JDistance_t> >
78  {
79  public:
80 
81  typedef typename JElement_t::abscissa_type abscissa_type;
82  typedef typename JElement_t::ordinate_type ordinate_type;
83  typedef JElement_t value_type;
84  typedef JDistance_t distance_type;
85 
87 
89 
90  typedef typename container_type::const_iterator const_iterator;
91  typedef typename container_type::const_reverse_iterator const_reverse_iterator;
92  typedef typename container_type::iterator iterator;
93  typedef typename container_type::reverse_iterator reverse_iterator;
94 
97 
99 
100 
101  /**
102  * Auxiliary class for ordering of objects in the collection by their abscissa values.
103  */
104  struct JComparator {
105  /**
106  * Comparison of elements.
107  *
108  * \param first first element
109  * \param second second element
110  * \return true if first element less than second element; else false
111  */
112  inline bool operator()(const JElement_t& first,
113  const JElement_t& second) const
114  {
115  return this->getDistance(first.getX(), second.getX()) > 0.0;
116  }
117 
118 
119  /**
120  * Comparison of element and abscissa value.
121  *
122  * \param element element
123  * \param x abscissa value
124  * \return true if element less than abscissa value; else false
125  */
126  inline bool operator()(const JElement_t& element, typename JClass<abscissa_type>::argument_type x) const
127  {
128  return this->getDistance(element.getX(), x) > 0.0;
129  }
130 
131 
132  /**
133  * Function object for distance evaluation.
134  */
135  JDistance_t getDistance;
136  };
137 
138 
139  /**
140  * Default constructor.
141  */
143  {}
144 
145 
146  /**
147  * Clear.
148  */
149  virtual void clear()
150  {
151  container_type::clear();
152  }
153 
154 
155  /**
156  * Get ordinate value.
157  *
158  * \param x abscissa value
159  * \return ordinate value
160  */
161  virtual const ordinate_type& get(typename JClass<abscissa_type>::argument_type x) const
162  {
163  const_iterator i = this->lower_bound(x);
164 
165  if (i == this->end() || this->getDistance(x, i->getX()) > distance_type::precision) {
166  THROW(JValueOutOfRange, "Invalid abscissa value " << x);
167  }
168 
169  return i->getY();
170  }
171 
172 
173  /**
174  * Get ordinate value.
175  *
176  * \param x abscissa value
177  * \return ordinate value
178  */
180  {
181  iterator i = this->lower_bound(x);
182 
183  if (i == this->end() || this->getDistance(x, i->getX()) > distance_type::precision) {
184  i = container_type::insert(i, value_type(x, ordinate_type()));
185  }
186 
187  return i->getY();
188  }
189 
190 
191  /**
192  * Get number of elements.
193  *
194  * \return number of elements
195  */
196  virtual int getSize() const
197  {
198  return (int) this->size();
199  }
200 
201 
202  /**
203  * Get abscissa value.
204  *
205  * \param index index
206  * \return abscissa value
207  */
208  virtual abscissa_type getX(int index) const
209  {
210  return this->at(index).getX();
211  }
212 
213 
214  /**
215  * Get minimal abscissa value.
216  *
217  * \return abscissa value
218  */
219  virtual abscissa_type getXmin() const
220  {
221  return this->begin()->getX();
222  }
223 
224 
225  /**
226  * Get maximal abscissa value.
227  *
228  * \return abscissa value
229  */
230  virtual abscissa_type getXmax() const
231  {
232  return this->rbegin()->getX();
233  }
234 
235 
236 
237  /**
238  * Get ordinate value.
239  *
240  * \param index index
241  * \return ordinate value
242  */
243  const ordinate_type& getY(int index) const
244  {
245  return this->at(index).getY();
246  }
247 
248 
249  /**
250  * Get ordinate value.
251  *
252  * \param index index
253  * \return ordinate value
254  */
255  ordinate_type& getY(int index)
256  {
257  return this->at(index).getY();
258  }
259 
260 
261  /**
262  * Transform collection.
263  *
264  * \param transformer element transformer
265  */
266  void transform(const transformer_type& transformer)
267  {
268  collection_type buffer;
269 
270  this->swap(buffer);
271 
272  for (const_iterator i = buffer.begin(); i != buffer.end(); ++i) {
273  this->insert(transformer(*i));
274  }
275  }
276 
277 
278  /**
279  * Sort elements.
280  */
281  void sort()
282  {
283  std::sort(this->begin(), this->end(), compare);
284  }
285 
286 
287  /**
288  * Get first position of element <tt>i</tt>, where <tt>x >= i->getX()</tt>.
289  *
290  * \param x abscissa value
291  * \return position of corresponding element
292  */
294  {
295  return std::lower_bound(this->begin(), this->end(), x, compare);
296  }
297 
298 
299  /**
300  * Get first position of element <tt>i</tt>, where <tt>x >= i->getX()</tt>.
301  *
302  * \param x abscissa value
303  * \return position of corresponding element
304  */
306  {
307  return std::lower_bound(this->begin(), this->end(), x, compare);
308  }
309 
310 
311  /**
312  * Insert element.
313  *
314  * \param element element
315  * \return (iterator, status), where status is true if inserted; else false
316  */
317  pair_type insert(const value_type& element)
318  {
319  iterator i = this->lower_bound(element.getX());
320 
321  if (i == this->end() || this->getDistance(element.getX(), i->getX()) > 0.0)
322  return pair_type(container_type::insert(i, element), true);
323  else
324  return pair_type(this->end(), false);
325  }
326 
327 
328  /**
329  * Configure collection.
330  *
331  * \param bounds abscissa values
332  */
334  {
335  configure(bounds, JMATH::getZero<ordinate_type>());
336  }
337 
338 
339  /**
340  * Configure collection.
341  *
342  * \param bounds abscissa values
343  * \param value ordinate value
344  */
347  {
348  this->resize(bounds.getSize());
349 
350  for (iterator i = this->begin(); i != this->end(); ++i) {
351 
352  const abscissa_type x = bounds.getX(std::distance(this->begin(),i));
353 
354  *i = value_type(x,value);
355  }
356  }
357 
358 
359  /**
360  * Configure collection.
361  *
362  * \param bounds abscissa values
363  * \param function function
364  */
365  template<class JFunction1D_t>
367  const JFunction1D_t& function)
368  {
369  using namespace JLANG;
370 
371  collection_type* out = (is_identical(*this, function) ? new collection_type() : this);
372 
373  for (int i = 0; i != bounds.getSize(); ++i) {
374 
375  const abscissa_type x = bounds.getX(i);
376 
377  out->put(x, function(x));
378  }
379 
380  if (is_identical(*this, function)) {
381 
382  this->swap(*out);
383 
384  delete out;
385  }
386  }
387 
388 
389  /**
390  * Test whether collections are compatible.
391  *
392  * \param collection collection
393  * \return true if collections are compatible; else false
394  */
395  bool is_compatible(const JCollection& collection) const
396  {
397  if (this->empty() || collection.empty()) {
398 
399  return true;
400 
401  } else {
402 
403  const double precision = JDistance<abscissa_type>::precision;
404 
405  const_iterator p = this->begin();
406  const_iterator q = collection.begin();
407 
408  if (getDistance(p->getX(), q->getX()) > precision) {
409 
410  do {
411  ++p;
412  } while (p != this->end() && getDistance(p->getX(), q->getX()) > precision);
413 
414  } else if (getDistance(q->getX(), p->getX()) > precision) {
415 
416  do {
417  ++q;
418  } while (q != collection.end() && getDistance(q->getX(), p->getX()) > precision);
419  }
420 
421  for ( ; p != this->end() && q != collection.end(); ++p, ++q) {
422  if (fabs(getDistance(p->getX(), q->getX())) > precision) {
423  return false;
424  }
425  }
426 
427  return true;
428  }
429  }
430 
431 
432  /**
433  * Negate collection.
434  *
435  * \return this collection
436  */
438  {
439  for (iterator i = this->begin(); i != this->end(); ++i) {
440  i->getY() = -i->getY();
441  }
442 
443  return *this;
444  }
445 
446 
447  /**
448  * Add collection.
449  *
450  * \param collection collection
451  * \return this collection
452  */
453  JCollection& add(const JCollection& collection)
454  {
455  if (!collection.empty()) {
456 
457  if (this->empty()) {
458 
459  for (const_iterator i = collection.begin(); i != collection.end(); ++i) {
460  this->put(i->getX(), +i->getY());
461  }
462 
463  } else if (this->is_compatible(collection)) {
464 
465  const double precision = JDistance<abscissa_type>::precision;
466 
467  iterator p = this->begin();
468  const_iterator q = collection.begin();
469 
470  if (getDistance(p->getX(), q->getX()) > precision) {
471 
472  do {
473  ++p;
474  } while (p != this->end() && getDistance(p->getX(), q->getX()) > precision);
475 
476  } else if (getDistance(q->getX(), p->getX()) > precision) {
477 
478  do {
479  ++q;
480  } while (q != collection.end() && getDistance(q->getX(), p->getX()) > precision);
481  }
482 
483  const_iterator i = q;
484 
485  for ( ; p != this->end() && i != collection.end(); ++p, ++i) {
486  p->getY() += i->getY();
487  }
488 
489  for ( ; i != collection.end(); ++i) {
490  this->put(i->getX(), +i->getY());
491  }
492 
493  for (i = collection.begin(); i != q; ++i) {
494  this->put(i->getX(), +i->getY());
495  }
496  }
497  }
498 
499  return *this;
500  }
501 
502 
503  /**
504  * Subtract collection.
505  *
506  * \param collection collection
507  * \return this collection
508  */
509  JCollection& sub(const JCollection& collection)
510  {
511  if (!collection.empty()) {
512 
513  if (this->empty()) {
514 
515  for (const_iterator i = collection.begin(); i != collection.end(); ++i) {
516  this->put(i->getX(), -i->getY());
517  }
518 
519  } else if (this->is_compatible(collection)) {
520 
521  const double precision = JDistance<abscissa_type>::precision;
522 
523  iterator p = this->begin();
524  const_iterator q = collection.begin();
525 
526  if (getDistance(p->getX(), q->getX()) > precision) {
527 
528  do {
529  ++p;
530  } while (p != this->end() && getDistance(p->getX(), q->getX()) > precision);
531 
532  } else if (getDistance(q->getX(), p->getX()) > precision) {
533 
534  do {
535  ++q;
536  } while (q != collection.end() && getDistance(q->getX(), p->getX()) > precision);
537  }
538 
539  const_iterator i = q;
540 
541  for ( ; p != this->end() && i != collection.end(); ++p, ++i) {
542  p->getY() -= i->getY();
543  }
544 
545  for ( ; i != collection.end(); ++i) {
546  this->put(i->getX(), -i->getY());
547  }
548 
549  for (i = collection.begin(); i != q; ++i) {
550  this->put(i->getX(), -i->getY());
551  }
552 
553  } else {
554 
555  throw JException("JCollection::add() collections incompatible.");
556  }
557  }
558 
559  return *this;
560  }
561 
562 
563  /**
564  * Scale contents.
565  *
566  * \param value multiplication factor
567  * \return this collection
568  */
569  JCollection& mul(const double value)
570  {
571  for (iterator i = this->begin(); i != this->end(); ++i) {
572  i->getY() *= value;
573  }
574 
575  return *this;
576  }
577 
578 
579  /**
580  * Scale contents.
581  *
582  * \param value division factor
583  * \return this collection
584  */
585  JCollection& div(const double value)
586  {
587  for (iterator i = this->begin(); i != this->end(); ++i) {
588  i->getY() /= value;
589  }
590 
591  return *this;
592  }
593 
594 
595  /**
596  * Add offset.
597  *
598  * \param value offset
599  * \return this collection
600  */
602  {
603  for (iterator i = this->begin(); i != this->end(); ++i) {
604  i->getY() += value;
605  }
606 
607  return *this;
608  }
609 
610 
611  /**
612  * Subtract offset.
613  *
614  * \param value offset
615  * \return this collection
616  */
618  {
619  for (iterator i = this->begin(); i != this->end(); ++i) {
620  i->getY() -= value;
621  }
622 
623  return *this;
624  }
625 
626 
627  /**
628  * Add function.
629  *
630  * \param function function
631  * \return this collection
632  */
633  template<class JFunction1D_t>
634  JCollection& add(const JFunction1D_t& function)
635  {
636  for (iterator i = this->begin(); i != this->end(); ++i) {
637  i->getY() += function(i->getX());
638  }
639 
640  return *this;
641  }
642 
643 
644  /**
645  * Subtract function.
646  *
647  * \param function function
648  * \return this collection
649  */
650  template<class JFunction1D_t>
651  JCollection& sub(const JFunction1D_t& function)
652  {
653  for (iterator i = this->begin(); i != this->end(); ++i) {
654  i->getY() -= function(i->getX());
655  }
656 
657  return *this;
658  }
659 
660 
661  /**
662  * Add offset to collaction.
663  *
664  * \param collection collection
665  * \param value offset
666  * \return collection
667  */
669  {
670  return collection.add(value);
671  }
672 
673 
674  /**
675  * Subtract offset from collaction.
676  *
677  * \param collection collection
678  * \param value offset
679  * \return collection
680  */
682  {
683  return collection.sub(value);
684  }
685 
686 
687  /**
688  * Add function.
689  *
690  * \param collection collection
691  * \param function function
692  * \return this collection
693  */
694  template<class JFunction1D_t>
695  friend JCollection& operator+=(JCollection& collection, const JFunction1D_t& function)
696  {
697  return collection.add(function);
698  }
699 
700 
701  /**
702  * Subtract function.
703  *
704  * \param collection collection
705  * \param function function
706  * \return this collection
707  */
708  template<class JFunction1D_t>
709  friend JCollection& operator-=(JCollection& collection, const JFunction1D_t& function)
710  {
711  return collection.sub(function);
712  }
713 
714 
715  /**
716  * Read collection from input.
717  *
718  * \param in reader
719  * \param collection collection
720  * \return reader
721  */
722  friend inline JReader& operator>>(JReader& in, JCollection& collection)
723  {
724  int n;
725 
726  in >> n;
727 
728  collection.resize(n);
729 
730  for (typename JCollection::iterator i = collection.begin(); i != collection.end(); ++i) {
731  in >> *i;
732  }
733 
734  return in;
735  }
736 
737 
738  /**
739  * Write collection to output.
740  *
741  * \param out writer
742  * \param collection collection
743  * \return writer
744  */
745  friend inline JWriter& operator<<(JWriter& out, const JCollection& collection)
746  {
747  const int n = collection.size();
748 
749  out << n;
750 
751  for (typename JCollection::const_iterator i = collection.begin(); i != collection.end(); ++i) {
752  out << *i;
753  }
754 
755  return out;
756  }
757 
758 
759  /**
760  * Get comparator.
761  *
762  * \return comparator
763  */
764  const JComparator& getComparator() const
765  {
766  return compare;
767  }
768 
769 
770  /**
771  * Function object for distance evaluation.
772  */
773  JDistance_t getDistance;
774 
775 
776  protected:
777  /**
778  * Function object for comparison.
779  */
781 
782 
783  /**
784  * Resize collection
785  *
786  * \param size size
787  */
788  void resize(typename container_type::size_type size)
789  {
790  container_type::resize(size);
791  }
792 
793  private:
794  void erase();
795  void push_back();
796  void pop_back();
797  };
798 
799 
800  /**
801  * Conversion of data points to integral values.
802  *
803  * The integration is based on the trapezoidal rule applied to the input data points.
804  *
805  * \param input collection
806  * \param output mappable collection
807  * \return integral
808  */
809  template<class JElement_t,
810  class JDistance_t>
811  inline typename JElement_t::ordinate_type
813  {
814  typedef typename JElement_t::ordinate_type ordinate_type;
816 
817  ordinate_type V(JMATH::zero);
818 
819  if (input.getSize() > 1) {
820 
821  output.put(input.begin()->getX(), V);
822 
823  for (const_iterator j = input.begin(), i = j++; j != input.end(); ++i, ++j) {
824 
825  V += 0.5 * input.getDistance(i->getX(), j->getX()) * (i->getY() + j->getY());
826 
827  output.put(j->getX(), V);
828  }
829  }
830 
831  return V;
832  }
833 }
834 
835 #endif
virtual abscissa_type getXmin() const
Get minimal abscissa value.
Definition: JCollection.hh:219
std::pair< const_iterator, bool > pair_type
Definition: JCollection.hh:96
container_type::reverse_iterator reverse_iterator
Definition: JCollection.hh:93
JCollection & add(const JFunction1D_t &function)
Add function.
Definition: JCollection.hh:634
General exception.
Definition: JException.hh:23
void sort()
Sort elements.
Definition: JCollection.hh:281
JCollection< JElement_t, JDistance_t > collection_type
Definition: JCollection.hh:86
Exceptions.
Interface for binary output.
Auxiliary class for ordering of objects in the collection by their abscissa values.
Definition: JCollection.hh:104
Auxiliary base class for aritmetic operations of derived class types.
Definition: JMath.hh:26
JCollection & sub(typename JClass< ordinate_type >::argument_type value)
Subtract offset.
Definition: JCollection.hh:617
JElement_t value_type
Definition: JCollection.hh:83
General purpose class for collection of elements, see: &lt;a href=&quot;JTools.PDF&quot;;&gt;Collection of elements...
Definition: JCollection.hh:72
JCollection & mul(const double value)
Scale contents.
Definition: JCollection.hh:569
Abstract interface for abscissa values of a collection of elements.
friend JCollection & operator+=(JCollection &collection, const JFunction1D_t &function)
Add function.
Definition: JCollection.hh:695
JCollection & add(const JCollection &collection)
Add collection.
Definition: JCollection.hh:453
Template class for distance evaluation.
Definition: JDistance.hh:24
friend JReader & operator>>(JReader &in, JCollection &collection)
Read collection from input.
Definition: JCollection.hh:722
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
friend JCollection & operator-=(JCollection &collection, const JFunction1D_t &function)
Subtract function.
Definition: JCollection.hh:709
JDistance_t getDistance
Function object for distance evaluation.
Definition: JCollection.hh:773
virtual int getSize() const
Get number of elements.
Definition: JCollection.hh:196
void configure(const JAbstractCollection< abscissa_type > &bounds, typename JClass< ordinate_type >::argument_type value)
Configure collection.
Definition: JCollection.hh:345
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:670
esac print_variable DETECTOR INPUT_FILE OUTPUT_FILE CDF for TYPE in
Definition: JSirene.sh:45
Template interface definition for associative collection of elements.
friend JWriter & operator<<(JWriter &out, const JCollection &collection)
Write collection to output.
Definition: JCollection.hh:745
JCollection & sub(const JFunction1D_t &function)
Subtract function.
Definition: JCollection.hh:651
static const JZero zero
Function object to assign zero value.
Definition: JZero.hh:105
bool operator()(const JElement_t &first, const JElement_t &second) const
Comparison of elements.
Definition: JCollection.hh:112
JCollection & add(typename JClass< ordinate_type >::argument_type value)
Add offset.
Definition: JCollection.hh:601
Definition of zero value for any class.
void resize(typename container_type::size_type size)
Resize collection.
Definition: JCollection.hh:788
JElement_t::abscissa_type abscissa_type
Definition: JCollection.hh:81
JCollection & negate()
Negate collection.
Definition: JCollection.hh:437
then echo The file $DIR KM3NeT_00000001_00000000 root already please rename or remove it first
void transform(const transformer_type &transformer)
Transform collection.
Definition: JCollection.hh:266
JComparator compare
Function object for comparison.
Definition: JCollection.hh:780
bool is_compatible(const JCollection &collection) const
Test whether collections are compatible.
Definition: JCollection.hh:395
const_iterator lower_bound(typename JClass< abscissa_type >::argument_type x) const
Get first position of element i, where x &gt;= i-&gt;getX().
Definition: JCollection.hh:293
bool is_identical(JFirst_t &first, JSecond_t &second)
Check if two objects are indentical.
Definition: JLangToolkit.hh:46
JArgument< T >::argument_type argument_type
Definition: JClass.hh:82
virtual void clear()
Clear.
Definition: JCollection.hh:149
virtual abscissa_type getX(int index) const
Get abscissa value.
Definition: JCollection.hh:208
bool operator()(const JElement_t &element, typename JClass< abscissa_type >::argument_type x) const
Comparison of element and abscissa value.
Definition: JCollection.hh:126
JCollection & div(const double value)
Scale contents.
Definition: JCollection.hh:585
container_type::iterator iterator
Definition: JCollection.hh:92
friend JCollection & operator+=(JCollection &collection, typename JClass< ordinate_type >::argument_type value)
Add offset to collaction.
Definition: JCollection.hh:668
JDistance_t getDistance
Function object for distance evaluation.
Definition: JCollection.hh:135
Template definition of auxiliary class to compare objects.
Definition: JComparator.hh:23
void configure(const JAbstractCollection< abscissa_type > &bounds)
Configure collection.
Definition: JCollection.hh:333
container_type::const_reverse_iterator const_reverse_iterator
Definition: JCollection.hh:91
virtual abscissa_type getX(int index) const =0
Get abscissa value.
iterator lower_bound(typename JClass< abscissa_type >::argument_type x)
Get first position of element i, where x &gt;= i-&gt;getX().
Definition: JCollection.hh:305
void put(typename JClass< key_type >::argument_type key, typename JClass< mapped_type >::argument_type value)
Put pair-wise element (key,value) into collection.
Interface for binary input.
friend JCollection & operator-=(JCollection &collection, typename JClass< ordinate_type >::argument_type value)
Subtract offset from collaction.
Definition: JCollection.hh:681
JCollection & sub(const JCollection &collection)
Subtract collection.
Definition: JCollection.hh:509
Interface for transformation of collection of elements.
Definition: JTransformer.hh:18
JDistance_t distance_type
Definition: JCollection.hh:84
const ordinate_type & getY(int index) const
Get ordinate value.
Definition: JCollection.hh:243
virtual abscissa_type getXmax() const
Get maximal abscissa value.
Definition: JCollection.hh:230
std::vector< value_type > container_type
Definition: JCollection.hh:88
Template for generic class types.
Definition: JClass.hh:80
JElement_t::ordinate_type ordinate_type
Definition: JCollection.hh:82
alias put_queue eval echo n
Definition: qlib.csh:19
Base class for data structures with artithmetic capabilities.
2D Element.
Definition: JElement.hh:44
virtual int getSize() const =0
Get number of elements.
container_type::const_iterator const_iterator
Definition: JCollection.hh:90
int j
Definition: JPolint.hh:634
pair_type insert(const value_type &element)
Insert element.
Definition: JCollection.hh:317
Exception for accessing a value in a collection that is outside of its range.
Definition: JException.hh:162
JCollection()
Default constructor.
Definition: JCollection.hh:142
void configure(const JAbstractCollection< abscissa_type > &bounds, const JFunction1D_t &function)
Configure collection.
Definition: JCollection.hh:366
abscissa_type getX() const
Get abscissa value.
Definition: JElement.hh:77
JCollectionElementTransformer< value_type > transformer_type
Definition: JCollection.hh:95
ordinate_type & getY(int index)
Get ordinate value.
Definition: JCollection.hh:255
const JComparator & getComparator() const
Get comparator.
Definition: JCollection.hh:764
JElement_t::ordinate_type integrate(const JCollection< JElement_t, JDistance_t > &input, typename JMappable< JElement_t >::map_type &output)
Conversion of data points to integral values.
Definition: JCollection.hh:812