AutoPas  3.0.0
Loading...
Searching...
No Matches
NumberSet.h
Go to the documentation of this file.
1
7#pragma once
8
9#include <set>
10#include <sstream>
11#include <vector>
12
15
16namespace autopas {
17
21template <class Number>
22class NumberSet {
23 public:
24 virtual ~NumberSet() = default;
25
30 virtual std::unique_ptr<NumberSet> clone() const = 0;
31
36 virtual void resetValues(const std::set<Number> &numbers) = 0;
37
42 virtual std::string to_string() const = 0;
43
50 friend std::ostream &operator<<(std::ostream &os, const NumberSet &numberSet) {
51 os << numberSet.to_string();
52 return os;
53 }
54
59 virtual bool isEmpty() const = 0;
60
65 virtual bool isFinite() const = 0;
66
71 virtual bool isInterval() const = 0;
72
78 virtual size_t size() const = 0;
79
84 virtual Number getMin() const = 0;
89 virtual Number getMax() const = 0;
90
96 virtual std::set<Number> getAll() const = 0;
97
103 virtual Number getRandom(Random &rng) const = 0;
111 virtual std::vector<Number> uniformSample(size_t n, Random &rng) const = 0;
112
120 virtual std::set<Number> uniformSampleSet(size_t n, Random &rng) const = 0;
121
126 virtual Number getMedian() const = 0;
127
133 virtual bool operator==(const NumberSet<Number> &rhs) const = 0;
134};
135
136} // namespace autopas
Virtual class describing a finite or infinite set of numbers.
Definition: NumberSet.h:22
virtual size_t size() const =0
Get size of set.
virtual Number getMin() const =0
Get the smallest number in the set.
virtual std::set< Number > uniformSampleSet(size_t n, Random &rng) const =0
Sample up to n points from the set.
virtual bool isEmpty() const =0
Indicates if the set is empty.
virtual bool isFinite() const =0
Indicates if the set is finite.
virtual Number getMax() const =0
Get the largest number in the set.
virtual bool isInterval() const =0
Function to distinguish between NumberSetFinite and NumberInterval.
virtual std::set< Number > getAll() const =0
Get all numbers in the set.
virtual std::unique_ptr< NumberSet > clone() const =0
Create a copy of a NumberSet.
virtual std::vector< Number > uniformSample(size_t n, Random &rng) const =0
Sample n points from the set.
virtual std::string to_string() const =0
Get a string representation of the set.
friend std::ostream & operator<<(std::ostream &os, const NumberSet &numberSet)
Stream operator.
Definition: NumberSet.h:50
virtual bool operator==(const NumberSet< Number > &rhs) const =0
Comparison operator.
virtual Number getMedian() const =0
Get the median of the set.
virtual void resetValues(const std::set< Number > &numbers)=0
A unified setter for all derived classes.
virtual Number getRandom(Random &rng) const =0
Get a random number in the set.
Class for random algorithms.
Definition: Random.h:22
This is the main namespace of AutoPas.
Definition: AutoPasDecl.h:32