Jpp  17.2.0
the software that should make you happy
 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 
31  using JMATH::JMath;
32  using JIO::JReader;
33  using JIO::JWriter;
35  using JLANG::JClass;
36  using JLANG::JException;
37 
38 
39  /**
40  * General purpose class for collection of elements, see:
41  \htmlonly
42  <a href="JTools.PDF";>Collection of elements.</a>
43  \endhtmlonly
44  *
45  * This class implements the JMappableCollection and JAbstractCollection interfaces.
46  *
47  * The data type of the elements of the collection should have the following policy
48  * type definition and member methods.
49  * <pre>
50  * typedef <abscissa type> abscissa_type;
51  * typedef <ordinate type> ordinate_type;
52  *
53  * (constructor)(abscissa_type, ordinate_type);
54  *
55  * abscissa_type %getX() const;
56  * ordinate_type %getY() const;
57  * ordinate_type& %getY();
58  * </pre>
59  *
60  * The elements in a collection are sorted according to their abscissa values and
61  * the given distance operator.
62  * The distance operator constitues a binary method returning the distance between
63  * two abscissa values; The default distance operator is JDistance.
64  *
65  * For the binary I/O of a collection of elements, the data structure of the elements
66  * should provide for an implementation of the following operators:
67  * <pre>
68  * JReader& operator>>(JReader& in);
69  * JWriter& operator<<(JWriter& out);
70  * </pre>
71  */
72  template<class JElement_t, class JDistance_t = JDistance<typename JElement_t::abscissa_type> >
73  class JCollection :
74  public std::vector<JElement_t>,
75  public JMappableCollection<typename JElement_t::abscissa_type,
76  typename JElement_t::ordinate_type>,
77  public JAbstractCollection<typename JElement_t::abscissa_type>,
78  public JMath< JCollection<JElement_t, JDistance_t> >
79  {
80  public:
81 
82  typedef typename JElement_t::abscissa_type abscissa_type;
83  typedef typename JElement_t::ordinate_type ordinate_type;
84  typedef JElement_t value_type;
85  typedef JDistance_t distance_type;
86 
88 
90 
91  typedef typename container_type::const_iterator const_iterator;
92  typedef typename container_type::const_reverse_iterator const_reverse_iterator;
93  typedef typename container_type::iterator iterator;
94  typedef typename container_type::reverse_iterator reverse_iterator;
95 
98 
100 
101 
102  /**
103  * Auxiliary class for ordering of objects in the collection by their abscissa values.
104  */
105  struct JComparator {
106  /**
107  * Comparison of elements.
108  *
109  * \param first first element
110  * \param second second element
111  * \return true if first element less than second element; else false
112  */
113  inline bool operator()(const JElement_t& first,
114  const JElement_t& second) const
115  {
116  return this->getDistance(first.getX(), second.getX()) > 0.0;
117  }
118 
119 
120  /**
121  * Comparison of element and abscissa value.
122  *
123  * \param element element
124  * \param x abscissa value
125  * \return true if element less than abscissa value; else false
126  */
127  inline bool operator()(const JElement_t& element, typename JClass<abscissa_type>::argument_type x) const
128  {
129  return this->getDistance(element.getX(), x) > 0.0;
130  }
131 
132 
133  /**
134  * Function object for distance evaluation.
135  */
136  JDistance_t getDistance;
137  };
138 
139 
140  /**
141  * Default constructor.
142  */
144  {}
145 
146 
147  /**
148  * Clear.
149  */
150  virtual void clear() override
151  {
152  container_type::clear();
153  }
154 
155 
156  /**
157  * Get ordinate value.
158  *
159  * \param x abscissa value
160  * \return ordinate value
161  */
162  virtual const ordinate_type& get(typename JClass<abscissa_type>::argument_type x) const override
163  {
164  const_iterator i = this->lower_bound(x);
165 
166  if (i == this->end() || this->getDistance(x, i->getX()) > distance_type::precision) {
167  THROW(JValueOutOfRange, "Invalid abscissa value " << x);
168  }
169 
170  return i->getY();
171  }
172 
173 
174  /**
175  * Get ordinate value.
176  *
177  * \param x abscissa value
178  * \return ordinate value
179  */
180  virtual ordinate_type& get(typename JClass<abscissa_type>::argument_type x) override
181  {
182  iterator i = this->lower_bound(x);
183 
184  if (i == this->end() || this->getDistance(x, i->getX()) > distance_type::precision) {
185  i = container_type::insert(i, value_type(x, ordinate_type()));
186  }
187 
188  return i->getY();
189  }
190 
191 
192  /**
193  * Get number of elements.
194  *
195  * \return number of elements
196  */
197  virtual int getSize() const override
198  {
199  return (int) this->size();
200  }
201 
202 
203  /**
204  * Get abscissa value.
205  *
206  * \param index index
207  * \return abscissa value
208  */
209  virtual abscissa_type getX(int index) const override
210  {
211  return this->at(index).getX();
212  }
213 
214 
215  /**
216  * Get minimal abscissa value.
217  *
218  * \return abscissa value
219  */
220  virtual abscissa_type getXmin() const override
221  {
222  return this->begin()->getX();
223  }
224 
225 
226  /**
227  * Get maximal abscissa value.
228  *
229  * \return abscissa value
230  */
231  virtual abscissa_type getXmax() const override
232  {
233  return this->rbegin()->getX();
234  }
235 
236 
237 
238  /**
239  * Get ordinate value.
240  *
241  * \param index index
242  * \return ordinate value
243  */
244  const ordinate_type& getY(int index) const
245  {
246  return this->at(index).getY();
247  }
248 
249 
250  /**
251  * Get ordinate value.
252  *
253  * \param index index
254  * \return ordinate value
255  */
256  ordinate_type& getY(int index)
257  {
258  return this->at(index).getY();
259  }
260 
261 
262  /**
263  * Transform collection.
264  *
265  * \param transformer element transformer
266  */
267  void transform(const transformer_type& transformer)
268  {
269  for (iterator i = this->begin(); i != this->end(); ++i) {
270  *i = transformer(*i);
271  }
272 
273  sort();
274  }
275 
276 
277  /**
278  * Sort elements.
279  */
280  void sort()
281  {
282  std::sort(this->begin(), this->end(), compare);
283  }
284 
285 
286  /**
287  * Get first position of element <tt>i</tt>, where <tt>x >= i->getX()</tt>.
288  *
289  * \param x abscissa value
290  * \return position of corresponding element
291  */
293  {
294  return std::lower_bound(this->begin(), this->end(), x, compare);
295  }
296 
297 
298  /**
299  * Get first position of element <tt>i</tt>, where <tt>x >= i->getX()</tt>.
300  *
301  * \param x abscissa value
302  * \return position of corresponding element
303  */
305  {
306  return std::lower_bound(this->begin(), this->end(), x, compare);
307  }
308 
309 
310  /**
311  * Insert element.
312  *
313  * \param element element
314  * \return (iterator, status), where status is true if inserted; else false
315  */
316  pair_type insert(const value_type& element)
317  {
318  iterator i = this->lower_bound(element.getX());
319 
320  if (i == this->end() || this->getDistance(element.getX(), i->getX()) > 0.0)
321  return pair_type(container_type::insert(i, element), true);
322  else
323  return pair_type(this->end(), false);
324  }
325 
326 
327  /**
328  * Configure collection.
329  *
330  * \param bounds abscissa values
331  */
333  {
334  configure(bounds, JMATH::getZero<ordinate_type>());
335  }
336 
337 
338  /**
339  * Configure collection.
340  *
341  * \param bounds abscissa values
342  * \param value ordinate value
343  */
346  {
347  this->resize(bounds.getSize());
348 
349  for (iterator i = this->begin(); i != this->end(); ++i) {
350 
351  const abscissa_type x = bounds.getX(std::distance(this->begin(),i));
352 
353  *i = value_type(x,value);
354  }
355  }
356 
357 
358  /**
359  * Configure collection.
360  *
361  * \param bounds abscissa values
362  * \param function function
363  */
364  template<class JFunction1D_t>
366  const JFunction1D_t& function)
367  {
368  using namespace JLANG;
369 
370  collection_type* out = (is_identical(*this, function) ? new collection_type() : this);
371 
372  for (int i = 0; i != bounds.getSize(); ++i) {
373 
374  const abscissa_type x = bounds.getX(i);
375 
376  out->put(x, function(x));
377  }
378 
379  if (is_identical(*this, function)) {
380 
381  this->swap(*out);
382 
383  delete out;
384  }
385  }
386 
387 
388  /**
389  * Test whether collections are compatible.
390  *
391  * \param collection collection
392  * \return true if collections are compatible; else false
393  */
394  bool is_compatible(const JCollection& collection) const
395  {
396  if (this->empty() || collection.empty()) {
397 
398  return true;
399 
400  } else {
401 
402  const double precision = JDistance<abscissa_type>::precision;
403 
404  const_iterator p = this->begin();
405  const_iterator q = collection.begin();
406 
407  if (getDistance(p->getX(), q->getX()) > precision) {
408 
409  do {
410  ++p;
411  } while (p != this->end() && getDistance(p->getX(), q->getX()) > precision);
412 
413  } else if (getDistance(q->getX(), p->getX()) > precision) {
414 
415  do {
416  ++q;
417  } while (q != collection.end() && getDistance(q->getX(), p->getX()) > precision);
418  }
419 
420  for ( ; p != this->end() && q != collection.end(); ++p, ++q) {
421  if (fabs(getDistance(p->getX(), q->getX())) > precision) {
422  return false;
423  }
424  }
425 
426  return true;
427  }
428  }
429 
430 
431  /**
432  * Negate collection.
433  *
434  * \return this collection
435  */
437  {
438  for (iterator i = this->begin(); i != this->end(); ++i) {
439  i->getY() = -i->getY();
440  }
441 
442  return *this;
443  }
444 
445 
446  /**
447  * Add collection.
448  *
449  * \param collection collection
450  * \return this collection
451  */
452  JCollection& add(const JCollection& collection)
453  {
454  if (!collection.empty()) {
455 
456  if (this->empty()) {
457 
458  for (const_iterator i = collection.begin(); i != collection.end(); ++i) {
459  this->put(i->getX(), +i->getY());
460  }
461 
462  } else if (this->is_compatible(collection)) {
463 
464  const double precision = JDistance<abscissa_type>::precision;
465 
466  iterator p = this->begin();
467  const_iterator q = collection.begin();
468 
469  if (getDistance(p->getX(), q->getX()) > precision) {
470 
471  do {
472  ++p;
473  } while (p != this->end() && getDistance(p->getX(), q->getX()) > precision);
474 
475  } else if (getDistance(q->getX(), p->getX()) > precision) {
476 
477  do {
478  ++q;
479  } while (q != collection.end() && getDistance(q->getX(), p->getX()) > precision);
480  }
481 
482  const_iterator i = q;
483 
484  for ( ; p != this->end() && i != collection.end(); ++p, ++i) {
485  p->getY() += i->getY();
486  }
487 
488  for ( ; i != collection.end(); ++i) {
489  this->put(i->getX(), +i->getY());
490  }
491 
492  for (i = collection.begin(); i != q; ++i) {
493  this->put(i->getX(), +i->getY());
494  }
495  }
496  }
497 
498  return *this;
499  }
500 
501 
502  /**
503  * Subtract collection.
504  *
505  * \param collection collection
506  * \return this collection
507  */
508  JCollection& sub(const JCollection& collection)
509  {
510  if (!collection.empty()) {
511 
512  if (this->empty()) {
513 
514  for (const_iterator i = collection.begin(); i != collection.end(); ++i) {
515  this->put(i->getX(), -i->getY());
516  }
517 
518  } else if (this->is_compatible(collection)) {
519 
520  const double precision = JDistance<abscissa_type>::precision;
521 
522  iterator p = this->begin();
523  const_iterator q = collection.begin();
524 
525  if (getDistance(p->getX(), q->getX()) > precision) {
526 
527  do {
528  ++p;
529  } while (p != this->end() && getDistance(p->getX(), q->getX()) > precision);
530 
531  } else if (getDistance(q->getX(), p->getX()) > precision) {
532 
533  do {
534  ++q;
535  } while (q != collection.end() && getDistance(q->getX(), p->getX()) > precision);
536  }
537 
538  const_iterator i = q;
539 
540  for ( ; p != this->end() && i != collection.end(); ++p, ++i) {
541  p->getY() -= i->getY();
542  }
543 
544  for ( ; i != collection.end(); ++i) {
545  this->put(i->getX(), -i->getY());
546  }
547 
548  for (i = collection.begin(); i != q; ++i) {
549  this->put(i->getX(), -i->getY());
550  }
551 
552  } else {
553 
554  throw JException("JCollection::add() collections incompatible.");
555  }
556  }
557 
558  return *this;
559  }
560 
561 
562  /**
563  * Scale contents.
564  *
565  * \param value multiplication factor
566  * \return this collection
567  */
568  JCollection& mul(const double value)
569  {
570  for (iterator i = this->begin(); i != this->end(); ++i) {
571  i->getY() *= value;
572  }
573 
574  return *this;
575  }
576 
577 
578  /**
579  * Scale contents.
580  *
581  * \param value division factor
582  * \return this collection
583  */
584  JCollection& div(const double value)
585  {
586  for (iterator i = this->begin(); i != this->end(); ++i) {
587  i->getY() /= value;
588  }
589 
590  return *this;
591  }
592 
593 
594  /**
595  * Add offset.
596  *
597  * \param value offset
598  * \return this collection
599  */
601  {
602  for (iterator i = this->begin(); i != this->end(); ++i) {
603  i->getY() += value;
604  }
605 
606  return *this;
607  }
608 
609 
610  /**
611  * Subtract offset.
612  *
613  * \param value offset
614  * \return this collection
615  */
617  {
618  for (iterator i = this->begin(); i != this->end(); ++i) {
619  i->getY() -= value;
620  }
621 
622  return *this;
623  }
624 
625 
626  /**
627  * Add function.
628  *
629  * \param function function
630  * \return this collection
631  */
632  template<class JFunction1D_t>
633  JCollection& add(const JFunction1D_t& function)
634  {
635  for (iterator i = this->begin(); i != this->end(); ++i) {
636  i->getY() += function(i->getX());
637  }
638 
639  return *this;
640  }
641 
642 
643  /**
644  * Subtract function.
645  *
646  * \param function function
647  * \return this collection
648  */
649  template<class JFunction1D_t>
650  JCollection& sub(const JFunction1D_t& function)
651  {
652  for (iterator i = this->begin(); i != this->end(); ++i) {
653  i->getY() -= function(i->getX());
654  }
655 
656  return *this;
657  }
658 
659 
660  /**
661  * Add offset to collaction.
662  *
663  * \param collection collection
664  * \param value offset
665  * \return collection
666  */
668  {
669  return collection.add(value);
670  }
671 
672 
673  /**
674  * Subtract offset from collaction.
675  *
676  * \param collection collection
677  * \param value offset
678  * \return collection
679  */
681  {
682  return collection.sub(value);
683  }
684 
685 
686  /**
687  * Add function.
688  *
689  * \param collection collection
690  * \param function function
691  * \return this collection
692  */
693  template<class JFunction1D_t>
694  friend JCollection& operator+=(JCollection& collection, const JFunction1D_t& function)
695  {
696  return collection.add(function);
697  }
698 
699 
700  /**
701  * Subtract function.
702  *
703  * \param collection collection
704  * \param function function
705  * \return this collection
706  */
707  template<class JFunction1D_t>
708  friend JCollection& operator-=(JCollection& collection, const JFunction1D_t& function)
709  {
710  return collection.sub(function);
711  }
712 
713 
714  /**
715  * Read collection from input.
716  *
717  * \param in reader
718  * \param collection collection
719  * \return reader
720  */
721  friend inline JReader& operator>>(JReader& in, JCollection& collection)
722  {
723  int n;
724 
725  if (in >> n) {
726 
727  collection.resize(n);
728 
729  for (typename JCollection::iterator i = collection.begin(); i != collection.end(); ++i) {
730  in >> *i;
731  }
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
std::pair< const_iterator, bool > pair_type
Definition: JCollection.hh:97
container_type::reverse_iterator reverse_iterator
Definition: JCollection.hh:94
JCollection & add(const JFunction1D_t &function)
Add function.
Definition: JCollection.hh:633
General exception.
Definition: JException.hh:23
void sort()
Sort elements.
Definition: JCollection.hh:280
JCollection< JElement_t, JDistance_t > collection_type
Definition: JCollection.hh:87
Exceptions.
Interface for binary output.
Auxiliary class for ordering of objects in the collection by their abscissa values.
Definition: JCollection.hh:105
Auxiliary base class for aritmetic operations of derived class types.
Definition: JMath.hh:109
JCollection & sub(typename JClass< ordinate_type >::argument_type value)
Subtract offset.
Definition: JCollection.hh:616
JElement_t value_type
Definition: JCollection.hh:84
General purpose class for collection of elements, see: &lt;a href=&quot;JTools.PDF&quot;;&gt;Collection of elements...
Definition: JCollection.hh:73
JCollection & mul(const double value)
Scale contents.
Definition: JCollection.hh:568
Abstract interface for abscissa values of a collection of elements.
friend JCollection & operator+=(JCollection &collection, const JFunction1D_t &function)
Add function.
Definition: JCollection.hh:694
JCollection & add(const JCollection &collection)
Add collection.
Definition: JCollection.hh:452
Template class for distance evaluation.
Definition: JDistance.hh:24
friend JReader & operator>>(JReader &in, JCollection &collection)
Read collection from input.
Definition: JCollection.hh:721
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:708
JDistance_t getDistance
Function object for distance evaluation.
Definition: JCollection.hh:773
void configure(const JAbstractCollection< abscissa_type > &bounds, typename JClass< ordinate_type >::argument_type value)
Configure collection.
Definition: JCollection.hh:344
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:696
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:650
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:113
virtual abscissa_type getXmin() const override
Get minimal abscissa value.
Definition: JCollection.hh:220
JCollection & add(typename JClass< ordinate_type >::argument_type value)
Add offset.
Definition: JCollection.hh:600
V(JDAQEvent-JTriggerReprocessor)*1.0/(JDAQEvent+1.0e-10)
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:82
JCollection & negate()
Negate collection.
Definition: JCollection.hh:436
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:267
JComparator compare
Function object for comparison.
Definition: JCollection.hh:780
virtual abscissa_type getXmax() const override
Get maximal abscissa value.
Definition: JCollection.hh:231
bool is_compatible(const JCollection &collection) const
Test whether collections are compatible.
Definition: JCollection.hh:394
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:292
bool is_identical(JFirst_t &first, JSecond_t &second)
Check if two objects are indentical.
Definition: JLangToolkit.hh:46
const int n
Definition: JPolint.hh:697
JArgument< T >::argument_type argument_type
Definition: JClass.hh:82
bool operator()(const JElement_t &element, typename JClass< abscissa_type >::argument_type x) const
Comparison of element and abscissa value.
Definition: JCollection.hh:127
JCollection & div(const double value)
Scale contents.
Definition: JCollection.hh:584
container_type::iterator iterator
Definition: JCollection.hh:93
friend JCollection & operator+=(JCollection &collection, typename JClass< ordinate_type >::argument_type value)
Add offset to collaction.
Definition: JCollection.hh:667
JDistance_t getDistance
Function object for distance evaluation.
Definition: JCollection.hh:136
Template definition of auxiliary class to compare objects.
Definition: JComparator.hh:23
void configure(const JAbstractCollection< abscissa_type > &bounds)
Configure collection.
Definition: JCollection.hh:332
container_type::const_reverse_iterator const_reverse_iterator
Definition: JCollection.hh:92
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:304
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:680
virtual void clear() override
Clear.
Definition: JCollection.hh:150
JCollection & sub(const JCollection &collection)
Subtract collection.
Definition: JCollection.hh:508
Interface for transformation of collection of elements.
Definition: JTransformer.hh:18
JDistance_t distance_type
Definition: JCollection.hh:85
const ordinate_type & getY(int index) const
Get ordinate value.
Definition: JCollection.hh:244
std::vector< value_type > container_type
Definition: JCollection.hh:89
Template for generic class types.
Definition: JClass.hh:80
JElement_t::ordinate_type ordinate_type
Definition: JCollection.hh:83
virtual abscissa_type getX(int index) const override
Get abscissa value.
Definition: JCollection.hh:209
Base class for data structures with artithmetic capabilities.
2D Element.
Definition: JElement.hh:46
virtual int getSize() const =0
Get number of elements.
container_type::const_iterator const_iterator
Definition: JCollection.hh:91
int j
Definition: JPolint.hh:703
pair_type insert(const value_type &element)
Insert element.
Definition: JCollection.hh:316
Exception for accessing a value in a collection that is outside of its range.
Definition: JException.hh:162
JCollection()
Default constructor.
Definition: JCollection.hh:143
void configure(const JAbstractCollection< abscissa_type > &bounds, const JFunction1D_t &function)
Configure collection.
Definition: JCollection.hh:365
abscissa_type getX() const
Get abscissa value.
Definition: JElement.hh:79
JCollectionElementTransformer< value_type > transformer_type
Definition: JCollection.hh:96
ordinate_type & getY(int index)
Get ordinate value.
Definition: JCollection.hh:256
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
Definition: JCanberra.sh:46
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
virtual int getSize() const override
Get number of elements.
Definition: JCollection.hh:197