Arkanjo 0.2
A tool for find code duplicated functions in codebases
Loading...
Searching...
No Matches
RandomSelector Class Reference

Random pair selector for similar code segments. More...

#include <random_selector.hpp>

+ Inheritance diagram for RandomSelector:
+ Collaboration diagram for RandomSelector:

Public Member Functions

 COMMAND_DESCRIPTION ("Select random pairs of functions within a specified similarity range. " "The provided MIN_SIMILARITY and MAX_SIMILARITY parameters define the " "inclusive similarity interval, and up to MAX_QUANTITY pairs are randomly " "selected and displayed.") explicit RandomSelector(Similarity_Table *_similarity_table)
 Constructs selector with configuration.
 
bool validate (const ParsedOptions &options) override
 Validate the arguments already analyzed.
 
bool run (const ParsedOptions &options) override
 Handles random selection command.
 
- Public Member Functions inherited from CommandBase< RandomSelector >
virtual void print_help (const std::string command_name, const OptionsCollector *collector) const
 
const CliOptionoptions () const final
 
bool do_run (const std::string command_name, const ParsedOptions &options, const OptionsCollector *collector=nullptr) override
 
- Public Member Functions inherited from ICommand
virtual ~ICommand ()=default
 
virtual std::string_view description () const =0
 

Static Public Attributes

static constexpr CliOption options_ []
 

Detailed Description

Random pair selector for similar code segments.

Selects and displays random pairs of similar functions within configurable similarity thresholds, with formatted output and color-coded display options.

Definition at line 34 of file random_selector.hpp.

Member Function Documentation

◆ COMMAND_DESCRIPTION()

RandomSelector::COMMAND_DESCRIPTION ( "Select random pairs of functions within a specified similarity range. " "The provided MIN_SIMILARITY and MAX_SIMILARITY parameters define the " "inclusive similarity interval,
and up to MAX_QUANTITY pairs are randomly " "selected and displayed."  )

Constructs selector with configuration.

Parameters
_similarity_tableSource of similarity data
_minimum_similarityMinimum similarity threshold (0-100)
_maximum_similarityMaximum similarity threshold (0-100)
_maximum_quantityMaximum number of pairs to select

◆ run()

bool RandomSelector::run ( const ParsedOptions & options)
overridevirtual

Handles random selection command.

Implements ICommand.

Definition at line 73 of file random_selector.cpp.

◆ validate()

bool RandomSelector::validate ( const ParsedOptions & options)
overridevirtual

Validate the arguments already analyzed.

Verify that all required options have been selected and that the values ​​provided are valid.

Parameters
optionsThe ParsedOptions structure will be populated with the arguments.
Returns
True if the arguments are valid, false otherwise.

Implements ICommand.

Definition at line 61 of file random_selector.cpp.

Member Data Documentation

◆ options_

CliOption RandomSelector::options_[]
staticconstexpr
Initial value:
= {
{"minimum_similarity", 0, PositionalArgument, nullptr},
{"maximum_similarity", 0, PositionalArgument, nullptr},
{"maximum_quantity", 0, PositionalArgument, nullptr},
}
#define OPTION_END
This marks the end of a long array of options.
@ PositionalArgument

Definition at line 73 of file random_selector.hpp.


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