Jpp 19.3.0-rc.2
the software that should make you happy
Loading...
Searching...
No Matches
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< JAbscissa_t > JTOOLS::JSet< JAbscissa_t > JOSCPROB::JOscillogramAxis

Public Types

typedef JAbscissa_t abscissa_type
 

Public Member Functions

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

Friends

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

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 >
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()

◆ getX()

◆ getXmin()

◆ getXmax()

◆ 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 Symbol 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 }

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