forked from hxmhuang/OpenArray_Dev
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRange.hpp
More file actions
50 lines (36 loc) · 965 Bytes
/
Copy pathRange.hpp
File metadata and controls
50 lines (36 loc) · 965 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
* Range.hpp
* Range [lower, upper)
*
=======================================================*/
#ifndef __RANGE_HPP__
#define __RANGE_HPP__
#include <iostream>
class Range {
private:
int m_lower; // lower range
int m_upper; // upper range
public:
// Constructor
Range();
Range(int st, int ed);
// get methods
int get_lower() const;
int get_upper() const;
// check two range is equal or not
bool equal(int st, int ed) const;
bool equal(const Range &rg) const;
// get range's size
int size() const;
// display range with prefix string(exp. name)
void display(char const *prefix = "") const;
// check if Range is inside u
bool is_inside(const Range &u);
// [lower, upper) + num = [lower + num, upper + num)
void shift(int num);
// check if Range has intersection with u
bool intersection(const Range &u);
// get intersection Range with u
Range get_intersection(const Range &u);
};
#endif