Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
JTOOLS::JHistogramMap_t< JKey_t, JHistogram_t, JDistance_t > Struct Template Referenceabstract

Type definition of a JHistogramMap based on JMap implementation. More...

#include <JHistogramMap_t.hh>

Inheritance diagram for JTOOLS::JHistogramMap_t< JKey_t, JHistogram_t, JDistance_t >:
JTOOLS::JHistogramMap< JKey_t, JHistogram_t, JMap, JDistance_t > JTOOLS::JMap< JKey_t, JHistogram_t, JDistance_t > JTOOLS::JHistogram< JKey_t, JHistogram_t::contents_type > JTOOLS::JCollection< JElement2D< JKey_t, JHistogram_t >, JDistance_t > JMATH::JMath< JMap< JKey_t, JHistogram_t, JDistance_t > > std::vector< JElement_t, JAllocator_t > JTOOLS::JMappableCollection< JKey_t, JValue_t > JTOOLS::JAbstractCollection< JAbscissa_t > JMATH::JMath< JFirst_t, JSecond_t >

Public Types

typedef JMap< JKey_t,
JHistogram_t, JDistance_t > 
collection_type
 
typedef JHistogram< JKey_t,
typename
JHistogram_t::contents_type > 
histogram_type
 
typedef
collection_type::abscissa_type 
abscissa_type
 
typedef
collection_type::ordinate_type 
ordinate_type
 
typedef collection_type::value_type value_type
 
typedef
collection_type::const_iterator 
const_iterator
 
typedef
collection_type::const_reverse_iterator 
const_reverse_iterator
 
typedef collection_type::iterator iterator
 
typedef
collection_type::reverse_iterator 
reverse_iterator
 
typedef
histogram_type::contents_type 
contents_type
 
typedef JKey_t key_type
 
typedef JHistogram_t mapped_type
 
typedef JCollection
< JElement2D< JKey_t,
JHistogram_t >, JDistance_t > 
container_type
 
typedef JDistance_t distance_type
 
typedef
JCollectionElementTransformer
< value_type
transformer_type
 
typedef std::pair
< const_iterator, bool > 
pair_type
 

Public Member Functions

virtual void evaluate (const abscissa_type *pX, typename JLANG::JClass< contents_type >::argument_type w)
 Fill histogram. More...
 
virtual void evaluate (const abscissa_type *pX, typename JLANG::JClass< contents_type >::argument_type w)=0
 Histogram filling. More...
 
JHistogramMapmul (typename JLANG::JClass< contents_type >::argument_type factor)
 Scale contents. More...
 
JMapmul (const double value)
 Scale contents. More...
 
JFirst_t & mul (const JSecond_t &object)
 Multiply with object. More...
 
JMap< JKey_t, JHistogram_t,
JDistance_t > & 
mul (const JNullType &object)
 Multiply with object. More...
 
JHistogrammul (const double value)
 Scale histogram. More...
 
JHistogramMapdiv (typename JLANG::JClass< contents_type >::argument_type factor)
 Scale contents. More...
 
JMapdiv (const double value)
 Scale contents. More...
 
JHistogramdiv (double value)
 Scale histogram. More...
 
JMapadd (const JMap &map)
 Add map. More...
 
JCollectionadd (const JCollection &collection)
 Add collection. More...
 
JCollectionadd (typename JClass< ordinate_type >::argument_type value)
 Add offset. More...
 
JCollectionadd (const JFunction1D_t &function)
 Add function. More...
 
JHistogramadd (const JHistogram &histogram)
 Add histogram. More...
 
JMapsub (const JMap &map)
 Subtract map. More...
 
JCollectionsub (const JCollection &collection)
 Subtract collection. More...
 
JCollectionsub (typename JClass< ordinate_type >::argument_type value)
 Subtract offset. More...
 
JCollectionsub (const JFunction1D_t &function)
 Subtract function. More...
 
JHistogramsub (const JHistogram &histogram)
 Subtract histogram. More...
 
virtual void clear ()
 Clear. More...
 
virtual ordinate_typeget (typename JClass< abscissa_type >::argument_type x)
 Get ordinate value. More...
 
virtual mapped_typeget (typename JClass< key_type >::argument_type key)=0
 Get mapped value. More...
 
virtual int getSize () const
 Get number of elements. More...
 
virtual abscissa_type getX (int index) const
 Get abscissa value. More...
 
virtual abscissa_type getXmin () const
 Get minimal abscissa value. More...
 
virtual abscissa_type getXmax () const
 Get maximal abscissa value. More...
 
const ordinate_typegetY (int index) const
 Get ordinate value. More...
 
ordinate_typegetY (int index)
 Get ordinate value. More...
 
void transform (const transformer_type &transformer)
 Transform collection. More...
 
void sort ()
 Sort elements. More...
 
const_iterator lower_bound (typename JClass< abscissa_type >::argument_type x) const
 Get first position of element i, where x >= i->getX(). More...
 
iterator lower_bound (typename JClass< abscissa_type >::argument_type x)
 Get first position of element i, where x >= i->getX(). More...
 
pair_type insert (const value_type &element)
 Insert element. More...
 
void configure (const JAbstractCollection< abscissa_type > &bounds)
 Configure collection. More...
 
void configure (const JAbstractCollection< abscissa_type > &bounds, typename JClass< ordinate_type >::argument_type value)
 Configure collection. More...
 
void configure (const JAbstractCollection< abscissa_type > &bounds, const JFunction1D_t &function)
 Configure collection. More...
 
bool is_compatible (const JCollection &collection) const
 Test whether collections are compatible. More...
 
JCollectionnegate ()
 Negate collection. More...
 
const JComparatorgetComparator () const
 Get comparator. More...
 
mapped_typeoperator[] (typename JClass< key_type >::argument_type key)
 Get mapped value. More...
 
void put (typename JClass< key_type >::argument_type key, typename JClass< mapped_type >::argument_type value)
 Put pair-wise element (key,value) into collection. More...
 
bool is_equal (const JAbstractCollection &collection) const
 Test whether abstract collections are equal. More...
 
const contents_typegetUnderflow () const
 Get contents below lower limit. More...
 
const contents_typegetOverflow () const
 Get contents above upper limit. More...
 
const contents_typegetIntegral () const
 Get contents above upper limit. More...
 

Public Attributes

JDistance_t getDistance
 Function object for distance evaluation. More...
 

Protected Member Functions

void resize (typename container_type::size_type size)
 Resize collection. More...
 

Protected Attributes

JComparator compare
 Function object for comparison. More...
 
contents_type underflow
 
contents_type overflow
 
contents_type integral
 

Detailed Description

template<class JKey_t, class JHistogram_t, class JDistance_t = JDistance<JKey_t>>
struct JTOOLS::JHistogramMap_t< JKey_t, JHistogram_t, JDistance_t >

Type definition of a JHistogramMap based on JMap implementation.

Definition at line 25 of file JHistogramMap_t.hh.

Member Typedef Documentation

typedef JMap <JKey_t , JHistogram_t , JDistance_t> JTOOLS::JHistogramMap< JKey_t , JHistogram_t , JMap , JDistance_t >::collection_type
inherited

Definition at line 34 of file JHistogramMap.hh.

typedef JHistogram<JKey_t , typename JHistogram_t ::contents_type> JTOOLS::JHistogramMap< JKey_t , JHistogram_t , JMap , JDistance_t >::histogram_type
inherited

Definition at line 35 of file JHistogramMap.hh.

typedef collection_type::abscissa_type JTOOLS::JHistogramMap< JKey_t , JHistogram_t , JMap , JDistance_t >::abscissa_type
inherited

Definition at line 37 of file JHistogramMap.hh.

typedef collection_type::ordinate_type JTOOLS::JHistogramMap< JKey_t , JHistogram_t , JMap , JDistance_t >::ordinate_type
inherited

Definition at line 38 of file JHistogramMap.hh.

typedef collection_type::value_type JTOOLS::JHistogramMap< JKey_t , JHistogram_t , JMap , JDistance_t >::value_type
inherited

Definition at line 39 of file JHistogramMap.hh.

typedef collection_type::const_iterator JTOOLS::JHistogramMap< JKey_t , JHistogram_t , JMap , JDistance_t >::const_iterator
inherited

Definition at line 41 of file JHistogramMap.hh.

typedef collection_type::const_reverse_iterator JTOOLS::JHistogramMap< JKey_t , JHistogram_t , JMap , JDistance_t >::const_reverse_iterator
inherited

Definition at line 42 of file JHistogramMap.hh.

typedef collection_type::iterator JTOOLS::JHistogramMap< JKey_t , JHistogram_t , JMap , JDistance_t >::iterator
inherited

Definition at line 43 of file JHistogramMap.hh.

typedef collection_type::reverse_iterator JTOOLS::JHistogramMap< JKey_t , JHistogram_t , JMap , JDistance_t >::reverse_iterator
inherited

Definition at line 44 of file JHistogramMap.hh.

typedef histogram_type::contents_type JTOOLS::JHistogramMap< JKey_t , JHistogram_t , JMap , JDistance_t >::contents_type
inherited

Definition at line 47 of file JHistogramMap.hh.

typedef JKey_t JTOOLS::JMap< JKey_t, JHistogram_t , JDistance_t >::key_type
inherited

Definition at line 33 of file JMap.hh.

typedef JHistogram_t JTOOLS::JMap< JKey_t, JHistogram_t , JDistance_t >::mapped_type
inherited

Definition at line 34 of file JMap.hh.

typedef JCollection<JElement2D<JKey_t, JHistogram_t >, JDistance_t> JTOOLS::JMap< JKey_t, JHistogram_t , JDistance_t >::container_type
inherited

Definition at line 36 of file JMap.hh.

typedef JDistance_t JTOOLS::JCollection< JElement2D< JKey_t, JHistogram_t > , JDistance_t >::distance_type
inherited

Definition at line 83 of file JCollection.hh.

typedef JCollectionElementTransformer<value_type> JTOOLS::JCollection< JElement2D< JKey_t, JHistogram_t > , JDistance_t >::transformer_type
inherited

Definition at line 94 of file JCollection.hh.

typedef std::pair<const_iterator, bool> JTOOLS::JCollection< JElement2D< JKey_t, JHistogram_t > , JDistance_t >::pair_type
inherited

Definition at line 95 of file JCollection.hh.

Member Function Documentation

virtual void JTOOLS::JHistogramMap< JKey_t , JHistogram_t , JMap , JDistance_t >::evaluate ( const abscissa_type pX,
typename JLANG::JClass< contents_type >::argument_type  w 
)
inlinevirtualinherited

Fill histogram.

Parameters
pXpointer to abscissa values
wweight

Definition at line 63 of file JHistogramMap.hh.

65  {
66  const abscissa_type x = *pX;
67 
68  iterator p = this->lower_bound(x);
69 
70  this->integral += w;
71 
72  if (p == this->begin())
73  this->underflow += w;
74  else if (p == this->end())
75  this->overflow += w;
76  else
77  (--p)->getY().evaluate(++pX, w);
78  }
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:274
virtual void JTOOLS::JHistogram< JKey_t , JHistogram_t::contents_type >::evaluate ( const abscissa_type pX,
typename JLANG::JClass< contents_type >::argument_type  w 
)
pure virtualinherited

Histogram filling.

Parameters
pXpointer to abscissa values
wweight
JHistogramMap& JTOOLS::JHistogramMap< JKey_t , JHistogram_t , JMap , JDistance_t >::mul ( typename JLANG::JClass< contents_type >::argument_type  factor)
inlineinherited

Scale contents.

Parameters
factormultiplication factor
Returns
this histogram

Definition at line 87 of file JHistogramMap.hh.

88  {
89  collection_type::mul(factor);
90  histogram_type ::mul(factor);
91 
92  return *this;
93  }
JMap& JTOOLS::JMap< JKey_t, JHistogram_t , JDistance_t >::mul ( const double  value)
inlineinherited

Scale contents.

Parameters
valuemultiplication factor
Returns
this map

Definition at line 85 of file JMap.hh.

86  {
87  static_cast<container_type&>(*this).mul(value);
88 
89  return *this;
90  }
JCollection & mul(const double value)
Scale contents.
Definition: JCollection.hh:550
JCollection< JElement2D< JKey_t, JHistogram_t >, JDistance_t > container_type
Definition: JMap.hh:36
template<class JFirst_t, class JSecond_t = JNullType>
JFirst_t& JMATH::JMath< JFirst_t, JSecond_t >::mul ( const JSecond_t &  object)
inlineinherited

Multiply with object.

Parameters
objectobject
Returns
result object

Definition at line 273 of file JMath.hh.

274  {
275  return static_cast<JFirst_t&>(*this) = JCalculator<JFirst_t>::calculator.mul(static_cast<const JFirst_t&>(*this), object);
276  }
Auxiliary class for product evaluation of objects.
Definition: JCalculator.hh:18
JMap< JKey_t, JHistogram_t, JDistance_t > & JMATH::JMath< JMap< JKey_t, JHistogram_t, JDistance_t > , JNullType >::mul ( const JNullType object)
inlineinherited

Multiply with object.

Parameters
objectobject
Returns
result object

Definition at line 273 of file JMath.hh.

274  {
275  return static_cast<JFirst_t&>(*this) = JCalculator<JFirst_t>::calculator.mul(static_cast<const JFirst_t&>(*this), object);
276  }
Auxiliary class for product evaluation of objects.
Definition: JCalculator.hh:18
JHistogram& JTOOLS::JHistogram< JKey_t , JHistogram_t::contents_type >::mul ( const double  value)
inlineinherited

Scale histogram.

Parameters
valuemultiplication factor
Returns
this histogram

Definition at line 101 of file JHistogram.hh.

102  {
103  this->underflow *= value;
104  this->overflow *= value;
105  this->integral *= value;
106 
107  return *this;
108  }
JHistogramMap& JTOOLS::JHistogramMap< JKey_t , JHistogram_t , JMap , JDistance_t >::div ( typename JLANG::JClass< contents_type >::argument_type  factor)
inlineinherited

Scale contents.

Parameters
factordivision factor
Returns
this histogram

Definition at line 102 of file JHistogramMap.hh.

103  {
104  collection_type::div(factor);
105  histogram_type ::div(factor);
106 
107  return *this;
108  }
JMap& JTOOLS::JMap< JKey_t, JHistogram_t , JDistance_t >::div ( const double  value)
inlineinherited

Scale contents.

Parameters
valuedivision factor
Returns
this map

Definition at line 98 of file JMap.hh.

99  {
100  static_cast<container_type&>(*this).div(value);
101 
102  return *this;
103  }
JCollection & div(const double value)
Scale contents.
Definition: JCollection.hh:566
JCollection< JElement2D< JKey_t, JHistogram_t >, JDistance_t > container_type
Definition: JMap.hh:36
JHistogram& JTOOLS::JHistogram< JKey_t , JHistogram_t::contents_type >::div ( double  value)
inlineinherited

Scale histogram.

Parameters
valuedivision factor
Returns
this histogram

Definition at line 117 of file JHistogram.hh.

118  {
119  this->underflow /= value;
120  this->overflow /= value;
121  this->integral /= value;
122 
123  return *this;
124  }
JMap& JTOOLS::JMap< JKey_t, JHistogram_t , JDistance_t >::add ( const JMap< JKey_t, JHistogram_t, JDistance_t > &  map)
inlineinherited

Add map.

Parameters
mapmap
Returns
this map

Definition at line 57 of file JMap.hh.

58  {
59  static_cast<container_type&>(*this).add(static_cast<const container_type&>(map));
60 
61  return *this;
62  }
JCollection & add(const JCollection &collection)
Add collection.
Definition: JCollection.hh:434
JCollection< JElement2D< JKey_t, JHistogram_t >, JDistance_t > container_type
Definition: JMap.hh:36
JCollection& JTOOLS::JCollection< JElement2D< JKey_t, JHistogram_t > , JDistance_t >::add ( const JCollection< JElement2D< JKey_t, JHistogram_t >, JDistance_t > &  collection)
inlineinherited

Add collection.

Parameters
collectioncollection
Returns
this collection

Definition at line 434 of file JCollection.hh.

435  {
436  if (!collection.empty()) {
437 
438  if (this->empty()) {
439 
440  for (const_iterator i = collection.begin(); i != collection.end(); ++i) {
441  this->put(i->getX(), +i->getY());
442  }
443 
444  } else if (this->is_compatible(collection)) {
445 
446  const double precision = JDistance<abscissa_type>::precision;
447 
448  iterator p = this->begin();
449  const_iterator q = collection.begin();
450 
451  if (getDistance(p->getX(), q->getX()) > precision) {
452 
453  do {
454  ++p;
455  } while (p != this->end() && getDistance(p->getX(), q->getX()) > precision);
456 
457  } else if (getDistance(q->getX(), p->getX()) > precision) {
458 
459  do {
460  ++q;
461  } while (q != collection.end() && getDistance(q->getX(), p->getX()) > precision);
462  }
463 
464  const_iterator i = q;
465 
466  for ( ; p != this->end() && i != collection.end(); ++p, ++i) {
467  p->getY() += i->getY();
468  }
469 
470  for ( ; i != collection.end(); ++i) {
471  this->put(i->getX(), +i->getY());
472  }
473 
474  for (i = collection.begin(); i != q; ++i) {
475  this->put(i->getX(), +i->getY());
476  }
477  }
478  }
479 
480  return *this;
481  }
Template class for distance evaluation.
Definition: JDistance.hh:24
JDistance_t getDistance
Function object for distance evaluation.
Definition: JCollection.hh:754
bool is_compatible(const JCollection &collection) const
Test whether collections are compatible.
Definition: JCollection.hh:376
void put(typename JClass< key_type >::argument_type key, typename JClass< mapped_type >::argument_type value)
Put pair-wise element (key,value) into collection.
JCollection& JTOOLS::JCollection< JElement2D< JKey_t, JHistogram_t > , JDistance_t >::add ( typename JClass< ordinate_type >::argument_type  value)
inlineinherited

Add offset.

Parameters
valueoffset
Returns
this collection

Definition at line 582 of file JCollection.hh.

583  {
584  for (iterator i = this->begin(); i != this->end(); ++i) {
585  i->getY() += value;
586  }
587 
588  return *this;
589  }
JCollection& JTOOLS::JCollection< JElement2D< JKey_t, JHistogram_t > , JDistance_t >::add ( const JFunction1D_t &  function)
inlineinherited

Add function.

Parameters
functionfunction
Returns
this collection

Definition at line 615 of file JCollection.hh.

616  {
617  for (iterator i = this->begin(); i != this->end(); ++i) {
618  i->getY() += function(i->getX());
619  }
620 
621  return *this;
622  }
JHistogram& JTOOLS::JHistogram< JKey_t , JHistogram_t::contents_type >::add ( const JHistogram< JKey_t, JHistogram_t::contents_type > &  histogram)
inlineinherited

Add histogram.

Parameters
histogramhistogram
Returns
this histogram

Definition at line 69 of file JHistogram.hh.

70  {
71  this->underflow += histogram.underflow;
72  this->overflow += histogram.overflow;
73  this->integral += histogram.integral;
74 
75  return *this;
76  }
JMap& JTOOLS::JMap< JKey_t, JHistogram_t , JDistance_t >::sub ( const JMap< JKey_t, JHistogram_t, JDistance_t > &  map)
inlineinherited

Subtract map.

Parameters
mapmap
Returns
this map

Definition at line 71 of file JMap.hh.

72  {
73  static_cast<container_type&>(*this).sub(static_cast<const container_type&>(map));
74 
75  return *this;
76  }
JCollection & sub(const JCollection &collection)
Subtract collection.
Definition: JCollection.hh:490
JCollection< JElement2D< JKey_t, JHistogram_t >, JDistance_t > container_type
Definition: JMap.hh:36
JCollection& JTOOLS::JCollection< JElement2D< JKey_t, JHistogram_t > , JDistance_t >::sub ( const JCollection< JElement2D< JKey_t, JHistogram_t >, JDistance_t > &  collection)
inlineinherited

Subtract collection.

Parameters
collectioncollection
Returns
this collection

Definition at line 490 of file JCollection.hh.

491  {
492  if (!collection.empty()) {
493 
494  if (this->empty()) {
495 
496  for (const_iterator i = collection.begin(); i != collection.end(); ++i) {
497  this->put(i->getX(), -i->getY());
498  }
499 
500  } else if (this->is_compatible(collection)) {
501 
502  const double precision = JDistance<abscissa_type>::precision;
503 
504  iterator p = this->begin();
505  const_iterator q = collection.begin();
506 
507  if (getDistance(p->getX(), q->getX()) > precision) {
508 
509  do {
510  ++p;
511  } while (p != this->end() && getDistance(p->getX(), q->getX()) > precision);
512 
513  } else if (getDistance(q->getX(), p->getX()) > precision) {
514 
515  do {
516  ++q;
517  } while (q != collection.end() && getDistance(q->getX(), p->getX()) > precision);
518  }
519 
520  const_iterator i = q;
521 
522  for ( ; p != this->end() && i != collection.end(); ++p, ++i) {
523  p->getY() -= i->getY();
524  }
525 
526  for ( ; i != collection.end(); ++i) {
527  this->put(i->getX(), -i->getY());
528  }
529 
530  for (i = collection.begin(); i != q; ++i) {
531  this->put(i->getX(), -i->getY());
532  }
533 
534  } else {
535 
536  throw JException("JCollection::add() collections incompatible.");
537  }
538  }
539 
540  return *this;
541  }
General exception.
Definition: JException.hh:40
Template class for distance evaluation.
Definition: JDistance.hh:24
JDistance_t getDistance
Function object for distance evaluation.
Definition: JCollection.hh:754
bool is_compatible(const JCollection &collection) const
Test whether collections are compatible.
Definition: JCollection.hh:376
void put(typename JClass< key_type >::argument_type key, typename JClass< mapped_type >::argument_type value)
Put pair-wise element (key,value) into collection.
JCollection& JTOOLS::JCollection< JElement2D< JKey_t, JHistogram_t > , JDistance_t >::sub ( typename JClass< ordinate_type >::argument_type  value)
inlineinherited

Subtract offset.

Parameters
valueoffset
Returns
this collection

Definition at line 598 of file JCollection.hh.

599  {
600  for (iterator i = this->begin(); i != this->end(); ++i) {
601  i->getY() -= value;
602  }
603 
604  return *this;
605  }
JCollection& JTOOLS::JCollection< JElement2D< JKey_t, JHistogram_t > , JDistance_t >::sub ( const JFunction1D_t &  function)
inlineinherited

Subtract function.

Parameters
functionfunction
Returns
this collection

Definition at line 632 of file JCollection.hh.

633  {
634  for (iterator i = this->begin(); i != this->end(); ++i) {
635  i->getY() -= function(i->getX());
636  }
637 
638  return *this;
639  }
JHistogram& JTOOLS::JHistogram< JKey_t , JHistogram_t::contents_type >::sub ( const JHistogram< JKey_t, JHistogram_t::contents_type > &  histogram)
inlineinherited

Subtract histogram.

Parameters
histogramhistogram
Returns
this histogram

Definition at line 85 of file JHistogram.hh.

86  {
87  this->underflow -= histogram.underflow;
88  this->overflow -= histogram.overflow;
89  this->integral -= histogram.integral;
90 
91  return *this;
92  }
virtual void JTOOLS::JCollection< JElement2D< JKey_t, JHistogram_t > , JDistance_t >::clear ( )
inlinevirtualinherited

Clear.

Implements JTOOLS::JMappableCollection< JKey_t, JValue_t >.

Definition at line 148 of file JCollection.hh.

149  {
150  container_type::clear();
151  }
virtual ordinate_type& JTOOLS::JCollection< JElement2D< JKey_t, JHistogram_t > , JDistance_t >::get ( typename JClass< abscissa_type >::argument_type  x)
inlinevirtualinherited

Get ordinate value.

Parameters
xabscissa value
Returns
ordinate value

Definition at line 160 of file JCollection.hh.

161  {
162  iterator i = this->lower_bound(x);
163 
164  if (i == this->end() || this->getDistance(x, i->getX()) > 0.0) {
165  i = container_type::insert(i, value_type(x, ordinate_type()));
166  }
167 
168  return i->getY();
169  }
JDistance_t getDistance
Function object for distance evaluation.
Definition: JCollection.hh:754
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:274
JElement2D< JKey_t, JHistogram_t >::ordinate_type ordinate_type
Definition: JCollection.hh:81
template<class JKey_t, class JValue_t>
virtual mapped_type& JTOOLS::JMappableCollection< JKey_t, JValue_t >::get ( typename JClass< key_type >::argument_type  key)
pure virtualinherited
virtual int JTOOLS::JCollection< JElement2D< JKey_t, JHistogram_t > , JDistance_t >::getSize ( ) const
inlinevirtualinherited

Get number of elements.

Returns
number of elements

Implements JTOOLS::JAbstractCollection< JAbscissa_t >.

Definition at line 177 of file JCollection.hh.

178  {
179  return (int) this->size();
180  }
virtual abscissa_type JTOOLS::JCollection< JElement2D< JKey_t, JHistogram_t > , JDistance_t >::getX ( int  index) const
inlinevirtualinherited

Get abscissa value.

Parameters
indexindex
Returns
abscissa value

Implements JTOOLS::JAbstractCollection< JAbscissa_t >.

Definition at line 189 of file JCollection.hh.

190  {
191  return this->at(index).getX();
192  }
virtual abscissa_type JTOOLS::JCollection< JElement2D< JKey_t, JHistogram_t > , JDistance_t >::getXmin ( ) const
inlinevirtualinherited

Get minimal abscissa value.

Returns
abscissa value

Implements JTOOLS::JAbstractCollection< JAbscissa_t >.

Definition at line 200 of file JCollection.hh.

201  {
202  return this->begin()->getX();
203  }
virtual abscissa_type JTOOLS::JCollection< JElement2D< JKey_t, JHistogram_t > , JDistance_t >::getXmax ( ) const
inlinevirtualinherited

Get maximal abscissa value.

Returns
abscissa value

Implements JTOOLS::JAbstractCollection< JAbscissa_t >.

Definition at line 211 of file JCollection.hh.

212  {
213  return this->rbegin()->getX();
214  }
const ordinate_type& JTOOLS::JCollection< JElement2D< JKey_t, JHistogram_t > , JDistance_t >::getY ( int  index) const
inlineinherited

Get ordinate value.

Parameters
indexindex
Returns
ordinate value

Definition at line 224 of file JCollection.hh.

225  {
226  return this->at(index).getY();
227  }
ordinate_type& JTOOLS::JCollection< JElement2D< JKey_t, JHistogram_t > , JDistance_t >::getY ( int  index)
inlineinherited

Get ordinate value.

Parameters
indexindex
Returns
ordinate value

Definition at line 236 of file JCollection.hh.

237  {
238  return this->at(index).getY();
239  }
void JTOOLS::JCollection< JElement2D< JKey_t, JHistogram_t > , JDistance_t >::transform ( const transformer_type transformer)
inlineinherited

Transform collection.

Parameters
transformerelement transformer

Definition at line 247 of file JCollection.hh.

248  {
249  collection_type buffer;
250 
251  this->swap(buffer);
252 
253  for (const_iterator i = buffer.begin(); i != buffer.end(); ++i) {
254  this->insert(transformer(*i));
255  }
256  }
JCollection< JElement2D< JKey_t, JHistogram_t >, JDistance_t > collection_type
Definition: JCollection.hh:85
pair_type insert(const value_type &element)
Insert element.
Definition: JCollection.hh:298
void JTOOLS::JCollection< JElement2D< JKey_t, JHistogram_t > , JDistance_t >::sort ( )
inlineinherited

Sort elements.

Definition at line 262 of file JCollection.hh.

263  {
264  std::sort(this->begin(), this->end(), compare);
265  }
const_iterator JTOOLS::JCollection< JElement2D< JKey_t, JHistogram_t > , JDistance_t >::lower_bound ( typename JClass< abscissa_type >::argument_type  x) const
inlineinherited

Get first position of element i, where x >= i->getX().

Parameters
xabscissa value
Returns
position of corresponding element

Definition at line 274 of file JCollection.hh.

275  {
276  return std::lower_bound(this->begin(), this->end(), x, compare);
277  }
iterator JTOOLS::JCollection< JElement2D< JKey_t, JHistogram_t > , JDistance_t >::lower_bound ( typename JClass< abscissa_type >::argument_type  x)
inlineinherited

Get first position of element i, where x >= i->getX().

Parameters
xabscissa value
Returns
position of corresponding element

Definition at line 286 of file JCollection.hh.

287  {
288  return std::lower_bound(this->begin(), this->end(), x, compare);
289  }
pair_type JTOOLS::JCollection< JElement2D< JKey_t, JHistogram_t > , JDistance_t >::insert ( const value_type element)
inlineinherited

Insert element.

Parameters
elementelement
Returns
(iterator, status), where status is true if inserted; else false

Definition at line 298 of file JCollection.hh.

299  {
300  iterator i = this->lower_bound(element.getX());
301 
302  if (i == this->end() || this->getDistance(element.getX(), i->getX()) > 0.0)
303  return pair_type(container_type::insert(i, element), true);
304  else
305  return pair_type(this->end(), false);
306  }
JDistance_t getDistance
Function object for distance evaluation.
Definition: JCollection.hh:754
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:274
void JTOOLS::JCollection< JElement2D< JKey_t, JHistogram_t > , JDistance_t >::configure ( const JAbstractCollection< abscissa_type > &  bounds)
inlineinherited

Configure collection.

Parameters
boundsabscissa values

Definition at line 314 of file JCollection.hh.

315  {
316  configure(bounds, JMATH::getZero<ordinate_type>());
317  }
void configure(const JAbstractCollection< abscissa_type > &bounds)
Configure collection.
Definition: JCollection.hh:314
void JTOOLS::JCollection< JElement2D< JKey_t, JHistogram_t > , JDistance_t >::configure ( const JAbstractCollection< abscissa_type > &  bounds,
typename JClass< ordinate_type >::argument_type  value 
)
inlineinherited

Configure collection.

Parameters
boundsabscissa values
valueordinate value

Definition at line 326 of file JCollection.hh.

328  {
329  this->resize(bounds.getSize());
330 
331  for (iterator i = this->begin(); i != this->end(); ++i) {
332 
333  const abscissa_type x = bounds.getX(std::distance(this->begin(),i));
334 
335  *i = value_type(x,value);
336  }
337  }
void resize(typename container_type::size_type size)
Resize collection.
Definition: JCollection.hh:769
JElement2D< JKey_t, JHistogram_t >::abscissa_type abscissa_type
Definition: JCollection.hh:80
virtual abscissa_type getX(int index) const =0
Get abscissa value.
virtual int getSize() const =0
Get number of elements.
void JTOOLS::JCollection< JElement2D< JKey_t, JHistogram_t > , JDistance_t >::configure ( const JAbstractCollection< abscissa_type > &  bounds,
const JFunction1D_t &  function 
)
inlineinherited

Configure collection.

Parameters
boundsabscissa values
functionfunction

Definition at line 347 of file JCollection.hh.

349  {
350  using namespace JLANG;
351 
352  collection_type* out = (is_identical(*this, function) ? new collection_type() : this);
353 
354  for (int i = 0; i != bounds.getSize(); ++i) {
355 
356  const abscissa_type x = bounds.getX(i);
357 
358  out->put(x, function(x));
359  }
360 
361  if (is_identical(*this, function)) {
362 
363  this->swap(*out);
364 
365  delete out;
366  }
367  }
JCollection< JElement2D< JKey_t, JHistogram_t >, JDistance_t > collection_type
Definition: JCollection.hh:85
JElement2D< JKey_t, JHistogram_t >::abscissa_type abscissa_type
Definition: JCollection.hh:80
bool is_identical(JFirst_t &first, JSecond_t &second)
Check if two objects are indentical.
Definition: JLangToolkit.hh:46
virtual abscissa_type getX(int index) const =0
Get abscissa value.
virtual int getSize() const =0
Get number of elements.
bool JTOOLS::JCollection< JElement2D< JKey_t, JHistogram_t > , JDistance_t >::is_compatible ( const JCollection< JElement2D< JKey_t, JHistogram_t >, JDistance_t > &  collection) const
inlineinherited

Test whether collections are compatible.

Parameters
collectioncollection
Returns
true if collections are compatible; else false

Definition at line 376 of file JCollection.hh.

377  {
378  if (this->empty() || collection.empty()) {
379 
380  return true;
381 
382  } else {
383 
384  const double precision = JDistance<abscissa_type>::precision;
385 
386  const_iterator p = this->begin();
387  const_iterator q = collection.begin();
388 
389  if (getDistance(p->getX(), q->getX()) > precision) {
390 
391  do {
392  ++p;
393  } while (p != this->end() && getDistance(p->getX(), q->getX()) > precision);
394 
395  } else if (getDistance(q->getX(), p->getX()) > precision) {
396 
397  do {
398  ++q;
399  } while (q != collection.end() && getDistance(q->getX(), p->getX()) > precision);
400  }
401 
402  for ( ; p != this->end() && q != collection.end(); ++p, ++q) {
403  if (fabs(getDistance(p->getX(), q->getX())) > precision) {
404  return false;
405  }
406  }
407 
408  return true;
409  }
410  }
Template class for distance evaluation.
Definition: JDistance.hh:24
JDistance_t getDistance
Function object for distance evaluation.
Definition: JCollection.hh:754
JCollection& JTOOLS::JCollection< JElement2D< JKey_t, JHistogram_t > , JDistance_t >::negate ( )
inlineinherited

Negate collection.

Returns
this collection

Definition at line 418 of file JCollection.hh.

419  {
420  for (iterator i = this->begin(); i != this->end(); ++i) {
421  i->getY() = -i->getY();
422  }
423 
424  return *this;
425  }
const JComparator& JTOOLS::JCollection< JElement2D< JKey_t, JHistogram_t > , JDistance_t >::getComparator ( ) const
inlineinherited

Get comparator.

Returns
comparator

Definition at line 745 of file JCollection.hh.

746  {
747  return compare;
748  }
void JTOOLS::JCollection< JElement2D< JKey_t, JHistogram_t > , JDistance_t >::resize ( typename container_type::size_type  size)
inlineprotectedinherited

Resize collection.

Parameters
sizesize

Definition at line 769 of file JCollection.hh.

770  {
771  container_type::resize(size);
772  }
template<class JKey_t, class JValue_t>
mapped_type& JTOOLS::JMappableCollection< JKey_t, JValue_t >::operator[] ( typename JClass< key_type >::argument_type  key)
inlineinherited

Get mapped value.

Parameters
keykey
Returns
value

Definition at line 64 of file JMappableCollection.hh.

65  {
66  return get(key);
67  }
template<class JKey_t, class JValue_t>
void JTOOLS::JMappableCollection< JKey_t, JValue_t >::put ( typename JClass< key_type >::argument_type  key,
typename JClass< mapped_type >::argument_type  value 
)
inlineinherited

Put pair-wise element (key,value) into collection.

Parameters
keykey
valuevalue

Definition at line 76 of file JMappableCollection.hh.

78  {
79  get(key) = value;
80  }
template<class JAbscissa_t>
bool JTOOLS::JAbstractCollection< JAbscissa_t >::is_equal ( const JAbstractCollection< JAbscissa_t > &  collection) const
inlineinherited

Test whether abstract collections are equal.

Parameters
collectionabstract collection
Returns
true if collections are equals; else false

Definition at line 69 of file JAbstractCollection.hh.

70  {
71  if (this->getSize() == collection.getSize()) {
72 
73  for (int i = 0; i != this->getSize(); ++i) {
74 
75  if (this->getX(i) != collection.getX(i)) {
76  return false;
77  }
78  }
79 
80  return true;
81  }
82 
83  return false;
84  }
virtual abscissa_type getX(int index) const =0
Get abscissa value.
virtual int getSize() const =0
Get number of elements.
const contents_type& JTOOLS::JHistogram< JKey_t , JHistogram_t::contents_type >::getUnderflow ( ) const
inlineinherited

Get contents below lower limit.

Returns
contents

Definition at line 132 of file JHistogram.hh.

133  {
134  return underflow;
135  }
const contents_type& JTOOLS::JHistogram< JKey_t , JHistogram_t::contents_type >::getOverflow ( ) const
inlineinherited

Get contents above upper limit.

Returns
contents

Definition at line 143 of file JHistogram.hh.

144  {
145  return overflow;
146  }
const contents_type& JTOOLS::JHistogram< JKey_t , JHistogram_t::contents_type >::getIntegral ( ) const
inlineinherited

Get contents above upper limit.

Returns
contents

Definition at line 154 of file JHistogram.hh.

155  {
156  return integral;
157  }

Member Data Documentation

JDistance_t JTOOLS::JCollection< JElement2D< JKey_t, JHistogram_t > , JDistance_t >::getDistance
inherited

Function object for distance evaluation.

Definition at line 754 of file JCollection.hh.

JComparator JTOOLS::JCollection< JElement2D< JKey_t, JHistogram_t > , JDistance_t >::compare
protectedinherited

Function object for comparison.

Definition at line 761 of file JCollection.hh.

contents_type JTOOLS::JHistogram< JKey_t , JHistogram_t::contents_type >::underflow
protectedinherited

Definition at line 195 of file JHistogram.hh.

contents_type JTOOLS::JHistogram< JKey_t , JHistogram_t::contents_type >::overflow
protectedinherited

Definition at line 196 of file JHistogram.hh.

contents_type JTOOLS::JHistogram< JKey_t , JHistogram_t::contents_type >::integral
protectedinherited

Definition at line 197 of file JHistogram.hh.


The documentation for this struct was generated from the following file: