Jpp  15.0.1-rc.1-highQE
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  collection_type buffer;
270 
271  this->swap(buffer);
272 
273  for (const_iterator i = buffer.begin(); i != buffer.end(); ++i) {
274  this->insert(transformer(*i));
275  }
276  }
277 
278 
279  /**
280  * Sort elements.
281  */
282  void sort()
283  {
284  std::sort(this->begin(), this->end(), compare);
285  }
286 
287 
288  /**
289  * Get first position of element <tt>i</tt>, where <tt>x >= i->getX()</tt>.
290  *
291  * \param x abscissa value
292  * \return position of corresponding element
293  */
295  {
296  return std::lower_bound(this->begin(), this->end(), x, compare);
297  }
298 
299 
300  /**
301  * Get first position of element <tt>i</tt>, where <tt>x >= i->getX()</tt>.
302  *
303  * \param x abscissa value
304  * \return position of corresponding element
305  */
307  {
308  return std::lower_bound(this->begin(), this->end(), x, compare);
309  }
310 
311 
312  /**
313  * Insert element.
314  *
315  * \param element element
316  * \return (iterator, status), where status is true if inserted; else false
317  */
318  pair_type insert(const value_type& element)
319  {
320  iterator i = this->lower_bound(element.getX());
321 
322  if (i == this->end() || this->getDistance(element.getX(), i->getX()) > 0.0)
323  return pair_type(container_type::insert(i, element), true);
324  else
325  return pair_type(this->end(), false);
326  }
327 
328 
329  /**
330  * Configure collection.
331  *
332  * \param bounds abscissa values
333  */
335  {
336  configure(bounds, JMATH::getZero<ordinate_type>());
337  }
338 
339 
340  /**
341  * Configure collection.
342  *
343  * \param bounds abscissa values
344  * \param value ordinate value
345  */
348  {
349  this->resize(bounds.getSize());
350 
351  for (iterator i = this->begin(); i != this->end(); ++i) {
352 
353  const abscissa_type x = bounds.getX(std::distance(this->begin(),i));
354 
355  *i = value_type(x,value);
356  }
357  }
358 
359 
360  /**
361  * Configure collection.
362  *
363  * \param bounds abscissa values
364  * \param function function
365  */
366  template<class JFunction1D_t>
368  const JFunction1D_t& function)
369  {
370  using namespace JLANG;
371 
372  collection_type* out = (is_identical(*this, function) ? new collection_type() : this);
373 
374  for (int i = 0; i != bounds.getSize(); ++i) {
375 
376  const abscissa_type x = bounds.getX(i);
377 
378  out->put(x, function(x));
379  }
380 
381  if (is_identical(*this, function)) {
382 
383  this->swap(*out);
384 
385  delete out;
386  }
387  }
388 
389 
390  /**
391  * Test whether collections are compatible.
392  *
393  * \param collection collection
394  * \return true if collections are compatible; else false
395  */
396  bool is_compatible(const JCollection& collection) const
397  {
398  if (this->empty() || collection.empty()) {
399 
400  return true;
401 
402  } else {
403 
404  const double precision = JDistance<abscissa_type>::precision;
405 
406  const_iterator p = this->begin();
407  const_iterator q = collection.begin();
408 
409  if (getDistance(p->getX(), q->getX()) > precision) {
410 
411  do {
412  ++p;
413  } while (p != this->end() && getDistance(p->getX(), q->getX()) > precision);
414 
415  } else if (getDistance(q->getX(), p->getX()) > precision) {
416 
417  do {
418  ++q;
419  } while (q != collection.end() && getDistance(q->getX(), p->getX()) > precision);
420  }
421 
422  for ( ; p != this->end() && q != collection.end(); ++p, ++q) {
423  if (fabs(getDistance(p->getX(), q->getX())) > precision) {
424  return false;
425  }
426  }
427 
428  return true;
429  }
430  }
431 
432 
433  /**
434  * Negate collection.
435  *
436  * \return this collection
437  */
439  {
440  for (iterator i = this->begin(); i != this->end(); ++i) {
441  i->getY() = -i->getY();
442  }
443 
444  return *this;
445  }
446 
447 
448  /**
449  * Add collection.
450  *
451  * \param collection collection
452  * \return this collection
453  */
454  JCollection& add(const JCollection& collection)
455  {
456  if (!collection.empty()) {
457 
458  if (this->empty()) {
459 
460  for (const_iterator i = collection.begin(); i != collection.end(); ++i) {
461  this->put(i->getX(), +i->getY());
462  }
463 
464  } else if (this->is_compatible(collection)) {
465 
466  const double precision = JDistance<abscissa_type>::precision;
467 
468  iterator p = this->begin();
469  const_iterator q = collection.begin();
470 
471  if (getDistance(p->getX(), q->getX()) > precision) {
472 
473  do {
474  ++p;
475  } while (p != this->end() && getDistance(p->getX(), q->getX()) > precision);
476 
477  } else if (getDistance(q->getX(), p->getX()) > precision) {
478 
479  do {
480  ++q;
481  } while (q != collection.end() && getDistance(q->getX(), p->getX()) > precision);
482  }
483 
484  const_iterator i = q;
485 
486  for ( ; p != this->end() && i != collection.end(); ++p, ++i) {
487  p->getY() += i->getY();
488  }
489 
490  for ( ; i != collection.end(); ++i) {
491  this->put(i->getX(), +i->getY());
492  }
493 
494  for (i = collection.begin(); i != q; ++i) {
495  this->put(i->getX(), +i->getY());
496  }
497  }
498  }
499 
500  return *this;
501  }
502 
503 
504  /**
505  * Subtract collection.
506  *
507  * \param collection collection
508  * \return this collection
509  */
510  JCollection& sub(const JCollection& collection)
511  {
512  if (!collection.empty()) {
513 
514  if (this->empty()) {
515 
516  for (const_iterator i = collection.begin(); i != collection.end(); ++i) {
517  this->put(i->getX(), -i->getY());
518  }
519 
520  } else if (this->is_compatible(collection)) {
521 
522  const double precision = JDistance<abscissa_type>::precision;
523 
524  iterator p = this->begin();
525  const_iterator q = collection.begin();
526 
527  if (getDistance(p->getX(), q->getX()) > precision) {
528 
529  do {
530  ++p;
531  } while (p != this->end() && getDistance(p->getX(), q->getX()) > precision);
532 
533  } else if (getDistance(q->getX(), p->getX()) > precision) {
534 
535  do {
536  ++q;
537  } while (q != collection.end() && getDistance(q->getX(), p->getX()) > precision);
538  }
539 
540  const_iterator i = q;
541 
542  for ( ; p != this->end() && i != collection.end(); ++p, ++i) {
543  p->getY() -= i->getY();
544  }
545 
546  for ( ; i != collection.end(); ++i) {
547  this->put(i->getX(), -i->getY());
548  }
549 
550  for (i = collection.begin(); i != q; ++i) {
551  this->put(i->getX(), -i->getY());
552  }
553 
554  } else {
555 
556  throw JException("JCollection::add() collections incompatible.");
557  }
558  }
559 
560  return *this;
561  }
562 
563 
564  /**
565  * Scale contents.
566  *
567  * \param value multiplication factor
568  * \return this collection
569  */
570  JCollection& mul(const double value)
571  {
572  for (iterator i = this->begin(); i != this->end(); ++i) {
573  i->getY() *= value;
574  }
575 
576  return *this;
577  }
578 
579 
580  /**
581  * Scale contents.
582  *
583  * \param value division factor
584  * \return this collection
585  */
586  JCollection& div(const double value)
587  {
588  for (iterator i = this->begin(); i != this->end(); ++i) {
589  i->getY() /= value;
590  }
591 
592  return *this;
593  }
594 
595 
596  /**
597  * Add offset.
598  *
599  * \param value offset
600  * \return this collection
601  */
603  {
604  for (iterator i = this->begin(); i != this->end(); ++i) {
605  i->getY() += value;
606  }
607 
608  return *this;
609  }
610 
611 
612  /**
613  * Subtract offset.
614  *
615  * \param value offset
616  * \return this collection
617  */
619  {
620  for (iterator i = this->begin(); i != this->end(); ++i) {
621  i->getY() -= value;
622  }
623 
624  return *this;
625  }
626 
627 
628  /**
629  * Add function.
630  *
631  * \param function function
632  * \return this collection
633  */
634  template<class JFunction1D_t>
635  JCollection& add(const JFunction1D_t& function)
636  {
637  for (iterator i = this->begin(); i != this->end(); ++i) {
638  i->getY() += function(i->getX());
639  }
640 
641  return *this;
642  }
643 
644 
645  /**
646  * Subtract function.
647  *
648  * \param function function
649  * \return this collection
650  */
651  template<class JFunction1D_t>
652  JCollection& sub(const JFunction1D_t& function)
653  {
654  for (iterator i = this->begin(); i != this->end(); ++i) {
655  i->getY() -= function(i->getX());
656  }
657 
658  return *this;
659  }
660 
661 
662  /**
663  * Add offset to collaction.
664  *
665  * \param collection collection
666  * \param value offset
667  * \return collection
668  */
670  {
671  return collection.add(value);
672  }
673 
674 
675  /**
676  * Subtract offset from collaction.
677  *
678  * \param collection collection
679  * \param value offset
680  * \return collection
681  */
683  {
684  return collection.sub(value);
685  }
686 
687 
688  /**
689  * Add function.
690  *
691  * \param collection collection
692  * \param function function
693  * \return this collection
694  */
695  template<class JFunction1D_t>
696  friend JCollection& operator+=(JCollection& collection, const JFunction1D_t& function)
697  {
698  return collection.add(function);
699  }
700 
701 
702  /**
703  * Subtract function.
704  *
705  * \param collection collection
706  * \param function function
707  * \return this collection
708  */
709  template<class JFunction1D_t>
710  friend JCollection& operator-=(JCollection& collection, const JFunction1D_t& function)
711  {
712  return collection.sub(function);
713  }
714 
715 
716  /**
717  * Read collection from input.
718  *
719  * \param in reader
720  * \param collection collection
721  * \return reader
722  */
723  friend inline JReader& operator>>(JReader& in, JCollection& collection)
724  {
725  int n;
726 
727  in >> n;
728 
729  collection.resize(n);
730 
731  for (typename JCollection::iterator i = collection.begin(); i != collection.end(); ++i) {
732  in >> *i;
733  }
734 
735  return in;
736  }
737 
738 
739  /**
740  * Write collection to output.
741  *
742  * \param out writer
743  * \param collection collection
744  * \return writer
745  */
746  friend inline JWriter& operator<<(JWriter& out, const JCollection& collection)
747  {
748  const int n = collection.size();
749 
750  out << n;
751 
752  for (typename JCollection::const_iterator i = collection.begin(); i != collection.end(); ++i) {
753  out << *i;
754  }
755 
756  return out;
757  }
758 
759 
760  /**
761  * Get comparator.
762  *
763  * \return comparator
764  */
765  const JComparator& getComparator() const
766  {
767  return compare;
768  }
769 
770 
771  /**
772  * Function object for distance evaluation.
773  */
774  JDistance_t getDistance;
775 
776 
777  protected:
778  /**
779  * Function object for comparison.
780  */
782 
783 
784  /**
785  * Resize collection
786  *
787  * \param size size
788  */
789  void resize(typename container_type::size_type size)
790  {
791  container_type::resize(size);
792  }
793 
794  private:
795  void erase();
796  void push_back();
797  void pop_back();
798  };
799 
800 
801  /**
802  * Conversion of data points to integral values.
803  *
804  * The integration is based on the trapezoidal rule applied to the input data points.
805  *
806  * \param input collection
807  * \param output mappable collection
808  * \return integral
809  */
810  template<class JElement_t,
811  class JDistance_t>
812  inline typename JElement_t::ordinate_type
814  {
815  typedef typename JElement_t::ordinate_type ordinate_type;
817 
818  ordinate_type V(JMATH::zero);
819 
820  if (input.getSize() > 1) {
821 
822  output.put(input.begin()->getX(), V);
823 
824  for (const_iterator j = input.begin(), i = j++; j != input.end(); ++i, ++j) {
825 
826  V += 0.5 * input.getDistance(i->getX(), j->getX()) * (i->getY() + j->getY());
827 
828  output.put(j->getX(), V);
829  }
830  }
831 
832  return V;
833  }
834 }
835 
836 #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:635
General exception.
Definition: JException.hh:23
void sort()
Sort elements.
Definition: JCollection.hh:282
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:110
JCollection & sub(typename JClass< ordinate_type >::argument_type value)
Subtract offset.
Definition: JCollection.hh:618
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:570
Abstract interface for abscissa values of a collection of elements.
friend JCollection & operator+=(JCollection &collection, const JFunction1D_t &function)
Add function.
Definition: JCollection.hh:696
JCollection & add(const JCollection &collection)
Add collection.
Definition: JCollection.hh:454
Template class for distance evaluation.
Definition: JDistance.hh:24
friend JReader & operator>>(JReader &in, JCollection &collection)
Read collection from input.
Definition: JCollection.hh:723
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:710
JDistance_t getDistance
Function object for distance evaluation.
Definition: JCollection.hh:774
void configure(const JAbstractCollection< abscissa_type > &bounds, typename JClass< ordinate_type >::argument_type value)
Configure collection.
Definition: JCollection.hh:346
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:670
Template interface definition for associative collection of elements.
friend JWriter & operator<<(JWriter &out, const JCollection &collection)
Write collection to output.
Definition: JCollection.hh:746
JCollection & sub(const JFunction1D_t &function)
Subtract function.
Definition: JCollection.hh:652
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:602
Definition of zero value for any class.
void resize(typename container_type::size_type size)
Resize collection.
Definition: JCollection.hh:789
JElement_t::abscissa_type abscissa_type
Definition: JCollection.hh:82
JCollection & negate()
Negate collection.
Definition: JCollection.hh:438
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:781
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:396
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:294
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:660
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:586
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:669
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:334
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:306
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:682
virtual void clear() override
Clear.
Definition: JCollection.hh:150
JCollection & sub(const JCollection &collection)
Subtract collection.
Definition: JCollection.hh:510
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:666
pair_type insert(const value_type &element)
Insert element.
Definition: JCollection.hh:318
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:367
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 source JAcoustics sh $DETECTOR_ID CHECK_EXIT_CODE typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
Definition: JCanberra.sh:41
const JComparator & getComparator() const
Get comparator.
Definition: JCollection.hh:765
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:813
virtual int getSize() const override
Get number of elements.
Definition: JCollection.hh:197