OpenMS
|
Collection of utility functions for management of vectors. More...
#include <OpenMS/DATASTRUCTURES/ListUtils.h>
Classes | |
struct | DoubleTolerancePredicate_ |
Predicate to check double equality with a given tolerance. More... | |
Public Types | |
enum class | CASE { SENSITIVE , INSENSITIVE } |
Public Member Functions | |
template<> | |
std::vector< String > | create (const std::vector< String > &s) |
create specialization for String since we do not need to cast here More... | |
Static Public Member Functions | |
template<typename T > | |
static std::vector< T > | create (const String &str, const char splitter=',') |
Returns a list that is created by splitting the given comma-separated string. More... | |
template<typename T > | |
static std::vector< T > | create (const std::vector< String > &s) |
Converts a vector of strings to a vector of the target type T. More... | |
template<typename T > | |
static std::vector< String > | toStringList (const std::vector< T > &s) |
Converts a vector of T's to a vector of Strings. More... | |
template<typename T , typename E > | |
static bool | contains (const std::vector< T > &container, const E &elem) |
Checks whether the element elem is contained in the given container. More... | |
static bool | contains (const std::vector< double > &container, const double &elem, double tolerance=0.00001) |
Checks whether the element elem is contained in the given container of floating point numbers. More... | |
static bool | contains (const std::vector< String > &container, String elem, const CASE case_sensitive) |
Checks whether the String elem is contained in the given container (potentially case insensitive) More... | |
template<typename T > | |
static String | concatenate (const std::vector< T > &container, const String &glue="") |
Concatenates all elements of the container and puts the glue string between elements. More... | |
template<typename T > | |
static String | concatenate (const T &container, const String &glue="") |
Concatenates all elements of the container and puts the glue string between elements. More... | |
template<typename T , typename E > | |
static Int | getIndex (const std::vector< T > &container, const E &elem) |
Get the index of the first occurrence of an element in the vector (or -1 if not found) More... | |
Collection of utility functions for management of vectors.
|
strong |
|
inlinestatic |
Concatenates all elements of the container
and puts the glue
string between elements.
container | The container to concatenate; |
glue | The string to add in between elements. |
Referenced by ProteinIdentification::Mapping::create(), and NucleicAcidSearchEngine::generateLFQInput_().
Concatenates all elements of the container
and puts the glue
string between elements.
container | The container to concatenate; must have begin() and end() iterator. |
glue | The string to add in between elements. |
|
inlinestatic |
Checks whether the element elem
is contained in the given container of floating point numbers.
container | The container of doubles to check. |
elem | The element to check whether it is in the container or not. |
tolerance | The allowed tolerance for the double. |
elem
is contained in container
, false otherwise.
|
inlinestatic |
Checks whether the String elem
is contained in the given container (potentially case insensitive)
container | The container of String to check. |
elem | The element to check whether it is in the container or not. |
case_sensitive | Do the comparison case sensitive or insensitive |
elem
is contained in container
, false otherwise. References OpenMS::Math::contains(), and String::toLower().
|
inlinestatic |
Checks whether the element elem
is contained in the given container.
container | The container to check. |
elem | The element to check whether it is in the container or not. |
elem
is contained in container
, false otherwise. Referenced by HasActivationMethod< SpectrumType >::operator()().
|
inlinestatic |
Converts a vector of strings to a vector of the target type T.
s | The vector of strings that should be converted. |
References OpenMS::Constants::c, and String::trim().
create specialization for String since we do not need to cast here
|
inlinestatic |
Returns a list that is created by splitting the given comma-separated string.
str | The string that should be split and converted to a list. |
splitter | The separator to look for in str |
References String::split().
|
inlinestatic |
Get the index of the first occurrence of an element in the vector (or -1 if not found)
|
inlinestatic |
Converts a vector of T's to a vector of Strings.
s | The vector of T's that should be converted. |