Jpp  19.1.0
the software that should make you happy
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::JGrid< double > JTOOLS::JGrid< JAbscissa_t > JTOOLS::JSet< JAbscissa_t > JOSCPROB::JOscillogramAxis

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

◆ abscissa_type

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

Definition at line 23 of file JAbstractCollection.hh.

Constructor & Destructor Documentation

◆ ~JAbstractCollection()

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

◆ getSize()

template<class JAbscissa_t >
virtual int JTOOLS::JAbstractCollection< JAbscissa_t >::getSize ( ) const
pure virtual

◆ getX()

template<class JAbscissa_t >
virtual abscissa_type JTOOLS::JAbstractCollection< JAbscissa_t >::getX ( int  index) const
pure virtual

◆ getXmin()

template<class JAbscissa_t >
virtual abscissa_type JTOOLS::JAbstractCollection< JAbscissa_t >::getXmin ( ) const
pure virtual

◆ getXmax()

template<class JAbscissa_t >
virtual abscissa_type JTOOLS::JAbstractCollection< JAbscissa_t >::getXmax ( ) const
pure virtual

◆ is_equal()

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 int getSize() const =0
Get number of elements.
virtual abscissa_type getX(int index) const =0
Get abscissa value.

Friends And Related Function Documentation

◆ operator<

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  }
Definition: JSTDTypes.hh:14
virtual abscissa_type getXmax() const =0
Get maximal abscissa value.
virtual abscissa_type getXmin() const =0
Get minimal abscissa value.

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