Samchon Framework for CPP  1.0.0
samchon::library::CaseGenerator Class Referenceabstract

Case generator. More...

#include <CaseGenerator.hpp>

Public Member Functions

 CaseGenerator (size_t n, size_t r)
 Construct from size of N and R. More...
 
auto size () const -> size_t
 Get size of all cases. More...
 
virtual auto operator[] (size_t) const -> std::vector< size_t >=0
 Get x'th case. More...
 
auto at (size_t) const -> std::vector< size_t >
 
auto n () const -> size_t
 Get size of the N. More...
 
auto r () const -> size_t
 Get size of the R. More...
 
auto toMatrix () const -> std::vector< std::vector< size_t >>
 Create a matrix containing all cases. More...
 

Protected Attributes

size_t n_
 N, size of the candidates. More...
 
size_t r_
 R, size of elements of each case. More...
 
size_t size_
 Size, the number of all cases. More...
 

Detailed Description

Case generator.

An abstract case generator using like a matrix

Example Sources
See also
samchon::library
Author
Jeongho Nam http://samchon.org

Definition at line 25 of file CaseGenerator.hpp.

Constructor & Destructor Documentation

CaseGenerator::CaseGenerator ( size_t  n,
size_t  r 
)

Construct from size of N and R.

Parameters
nSize of candidates
rSize of elements of each case

Definition at line 9 of file CaseGenerator.cpp.

Member Function Documentation

auto CaseGenerator::size ( ) const -> size_t

Get size of all cases.

Returns
Get a number of the all cases

Definition at line 18 of file CaseGenerator.cpp.

Referenced by samchon::example::packer::Packer::optimize().

Here is the caller graph for this function:

virtual auto samchon::library::CaseGenerator::operator[] ( size_t  ) const -> std::vector< size_t >
pure virtual

Get x'th case.

Returns
The row of the x'th in combined permuation case

Implemented in samchon::library::CombinedPermutationGenerator, and samchon::library::PermutationGenerator.

auto CaseGenerator::at ( size_t  index) const -> std::vector<size_t>

CaseGenerator::operator[]()

Definition at line 22 of file CaseGenerator.cpp.

auto CaseGenerator::n ( ) const -> size_t

Get size of the N.

Definition at line 30 of file CaseGenerator.cpp.

Referenced by samchon::library::PermutationGenerator::PermutationGenerator().

Here is the caller graph for this function:

auto CaseGenerator::r ( ) const -> size_t

Get size of the R.

Definition at line 34 of file CaseGenerator.cpp.

Referenced by samchon::library::CombinedPermutationGenerator::CombinedPermutationGenerator(), and samchon::library::PermutationGenerator::PermutationGenerator().

Here is the caller graph for this function:

auto CaseGenerator::toMatrix ( ) const -> std::vector<std::vector<size_t>>

Create a matrix containing all cases.

Warning
Size of n or r is enourmouse, then stack overflow can be occured.
Returns
A matrix containing all cases.

Definition at line 42 of file CaseGenerator.cpp.

Member Data Documentation

size_t samchon::library::CaseGenerator::n_
protected

N, size of the candidates.

Definition at line 31 of file CaseGenerator.hpp.

Referenced by samchon::library::CombinedPermutationGenerator::operator[]().

size_t samchon::library::CaseGenerator::r_
protected
size_t samchon::library::CaseGenerator::size_
protected

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