Helios++
Helios software for LiDAR simulations
SurfaceInspector::util::draggers::MinDragger< E > Class Template Reference

Min dragger drags the minimum element. The first time next is called the minimum element is returned, the second time the second minimum element is returned and so on. More...

#include <MinDragger.hpp>

Inheritance diagram for SurfaceInspector::util::draggers::MinDragger< E >:
Collaboration diagram for SurfaceInspector::util::draggers::MinDragger< E >:

Public Member Functions

 MinDragger (vector< E > x)
 Build a minimum dragger. More...
 
virtual ~MinDragger ()
 Default destructor.
 
bool hasNext () override
 
- Public Member Functions inherited from SurfaceInspector::util::draggers::OptimizationDragger< E >
next () override
 Implementation of next method for optimization draggers. More...
 

Protected Member Functions

virtual void initialize ()
 Initialize the minimum dragger to the initial status. More...
 
pick () override
 Pick the minimum element inside \([a, b]\) indices. More...
 
void update () override
 Update the minimum dragger status which basically means updating \(a\) and \(b\) values while partially sorting the collection. More...
 
virtual void partialSort ()
 Do a partial sort. More...
 

Protected Attributes

vector< E > x
 The collection (as vector) to min-drag from.
 
size_t stopSize
 The number of elements in the collection x, minus 1. More...
 
bool initialized = false
 Specify if the min dragger has been initialized (true) or nor (false). More...
 
size_t a = 0
 The start index.
 
size_t b = 0
 The end index.
 
size_t c = 0
 The current index.
 

Detailed Description

template<typename E>
class SurfaceInspector::util::draggers::MinDragger< E >

Min dragger drags the minimum element. The first time next is called the minimum element is returned, the second time the second minimum element is returned and so on.

Author
Alberto M. Esmoris Pena
Version
1.0
Template Parameters
EType of elements to drag

Constructor & Destructor Documentation

◆ MinDragger()

template<typename E >
SurfaceInspector::util::draggers::MinDragger< E >::MinDragger ( vector< E >  x)
inline

Build a minimum dragger.

Parameters
xThe collection to drag over
See also
MinDragger::x

Member Function Documentation

◆ hasNext()

◆ initialize()

template<typename E >
virtual void SurfaceInspector::util::draggers::MinDragger< E >::initialize ( )
protectedvirtual

Initialize the minimum dragger to the initial status.

The initialize method is called on first invocation to update method.

See also
update

◆ partialSort()

template<typename E >
virtual void SurfaceInspector::util::draggers::MinDragger< E >::partialSort ( )
protectedvirtual

Do a partial sort.

Let \(\alpha = \min(\{x_a, \ldots, x_b\})\) and \(\beta = \max(\{x_a, \ldots, x_b\})\). Now, the \(x\) vector is updated swapping element at \(a\) with \(\alpha\) element and then swapping element at \(b\) with \(\beta\) element.

See also
MinDragger::a
MinDragger::b

◆ pick()

template<typename E >
E SurfaceInspector::util::draggers::MinDragger< E >::pick ( )
inlineoverrideprotectedvirtual

Pick the minimum element inside \([a, b]\) indices.

Returns
Minimum element inside \([a, b]\) indices
See also
SurfaceInspector::util::draggers::OptimizationDragger::pick

Implements SurfaceInspector::util::draggers::OptimizationDragger< E >.

◆ update()

template<typename E >
void SurfaceInspector::util::draggers::MinDragger< E >::update ( )
overrideprotectedvirtual

Update the minimum dragger status which basically means updating \(a\) and \(b\) values while partially sorting the collection.

First call to update method will invoke initialize.

See also
initialize
partialSort

Implements SurfaceInspector::util::draggers::OptimizationDragger< E >.

Member Data Documentation

◆ initialized

template<typename E >
bool SurfaceInspector::util::draggers::MinDragger< E >::initialized = false
protected

Specify if the min dragger has been initialized (true) or nor (false).

A min dragger is mean to be initialized after calling update method for the first time.

◆ stopSize

template<typename E >
size_t SurfaceInspector::util::draggers::MinDragger< E >::stopSize
protected

The number of elements in the collection x, minus 1.

It is necessary to handle iterative dragging.


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