Jpp  18.4.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Friends | List of all members
JTOOLS::JAbstractCollection< JAbscissa_t > Struct Template Referenceabstract

Abstract interface for abscissa values of a collection of elements. More...

#include <JAbstractCollection.hh>

Inheritance diagram for JTOOLS::JAbstractCollection< JAbscissa_t >:
JTOOLS::JCollection< JElement2D< JKey_t, JHistogram_t >, JDistance_t > JTOOLS::JCollection< JElement2D< JKey_t, JValue_t >, JDistance_t > JTOOLS::JCollection< JElement2D_t > JTOOLS::JGrid< JAbscissa_t > JTOOLS::JSet< JAbscissa_t > JTOOLS::JGridCollection< JElement2D< JKey_t, JHistogram_t >, JDistance_t > JTOOLS::JMap< JKey_t, JHistogram_t, JDistance_t > JTOOLS::JGridCollection< JElement2D< JKey_t, JValue_t >, JDistance_t > JTOOLS::JMap< JKey_t, JValue_t, JDistance_t > JTOOLS::JQuadrature JOSCPROB::JOscillogramAxis JTOOLS::JGridMap< JKey_t, JHistogram_t, JDistance_t > JTOOLS::JHistogramMap< JKey_t, JHistogram_t, JMap, JDistance_t > JTOOLS::JGridMap< JKey_t, JValue_t, JDistance_t > JTOOLS::JSplineMap< JKey_t, JValue_t, JMap, JResultDerivative< JResultType< JValue_t >::result_type >, JDistance_t > JTOOLS::JSplineMap< JKey_t, JValue_t, JMap, JResultType< JValue_t >::result_type, JDistance_t > JTOOLS::JBitangent JTOOLS::JCotangent JTOOLS::JGaussHermite JTOOLS::JGaussLaguerre JTOOLS::JGaussLegendre JTOOLS::JHenyeyGreenstein JTOOLS::JRayleigh

Public Types

typedef JAbscissa_t abscissa_type
 

Public Member Functions

virtual ~JAbstractCollection ()
 Virtual destructor. More...
 
virtual int getSize () const =0
 Get number of elements. More...
 
virtual abscissa_type getX (int index) const =0
 Get abscissa value. More...
 
virtual abscissa_type getXmin () const =0
 Get minimal abscissa value. More...
 
virtual abscissa_type getXmax () const =0
 Get maximal abscissa value. More...
 
bool is_equal (const JAbstractCollection &collection) const
 Test whether abstract collections are equal. More...
 

Friends

bool operator< (const JAbstractCollection &first, const JAbstractCollection &second)
 Less than method. More...
 

Detailed Description

template<class JAbscissa_t>
struct JTOOLS::JAbstractCollection< JAbscissa_t >

Abstract interface for abscissa values of a collection of elements.

Definition at line 21 of file JAbstractCollection.hh.

Member Typedef Documentation

template<class JAbscissa_t>
typedef JAbscissa_t JTOOLS::JAbstractCollection< JAbscissa_t >::abscissa_type

Definition at line 23 of file JAbstractCollection.hh.

Constructor & Destructor Documentation

template<class JAbscissa_t>
virtual JTOOLS::JAbstractCollection< JAbscissa_t >::~JAbstractCollection ( )
inlinevirtual

Virtual destructor.

Definition at line 29 of file JAbstractCollection.hh.

30  {}

Member Function Documentation

template<class JAbscissa_t>
virtual int JTOOLS::JAbstractCollection< JAbscissa_t >::getSize ( ) const
pure virtual
template<class JAbscissa_t>
virtual abscissa_type JTOOLS::JAbstractCollection< JAbscissa_t >::getX ( int  index) const
pure virtual
template<class JAbscissa_t>
virtual abscissa_type JTOOLS::JAbstractCollection< JAbscissa_t >::getXmin ( ) const
pure virtual
template<class JAbscissa_t>
virtual abscissa_type JTOOLS::JAbstractCollection< JAbscissa_t >::getXmax ( ) const
pure virtual
template<class JAbscissa_t>
bool JTOOLS::JAbstractCollection< JAbscissa_t >::is_equal ( const JAbstractCollection< JAbscissa_t > &  collection) const
inline

Test whether abstract collections are equal.

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

Definition at line 72 of file JAbstractCollection.hh.

73  {
74  if (this->getSize() == collection.getSize()) {
75 
76  for (int i = 0; i != this->getSize(); ++i) {
77 
78  if (this->getX(i) != collection.getX(i)) {
79  return false;
80  }
81  }
82 
83  return true;
84  }
85 
86  return false;
87  }
virtual abscissa_type getX(int index) const =0
Get abscissa value.
virtual int getSize() const =0
Get number of elements.

Friends And Related Function Documentation

template<class JAbscissa_t>
bool operator< ( const JAbstractCollection< JAbscissa_t > &  first,
const JAbstractCollection< JAbscissa_t > &  second 
)
friend

Less than method.

Parameters
firstfirst abstract collection
secondsecond abstract collection
Returns
true if first collection is less than second collection; else false

Definition at line 97 of file JAbstractCollection.hh.

99  {
100  using namespace std;
101 
102  if (first.getSize() == second.getSize()) {
103 
104  if (fabs(first.getXmin() - second.getXmin()) > 0.0) {
105  return first.getXmin() < second.getXmin();
106  } else {
107  return first.getXmax() < second.getXmax();
108  }
109 
110  } else {
111 
112  return first.getSize() < second.getSize();
113  }
114  }
virtual abscissa_type getXmin() const =0
Get minimal abscissa value.
virtual abscissa_type getXmax() const =0
Get maximal abscissa value.
virtual int getSize() const =0
Get number of elements.

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