76fa6b6d390ba514b9a2e8d0b55fcdabc1b5e609
[cs356-p1-elevator.git] / position.hpp
1 /*
2  * CS356 Project 01 -- Elevator Simulator
3  *
4  * Position Class Specification
5  */
6
7 #ifndef POSITION_HPP
8 #define POSITION_HPP
9
10 class Position
11 {
12         public:
13                 /*
14                  * PURPOSE: Construct a new Position object
15                  *
16                  * REQUIRE: Nothing
17                  *
18                  * PROMISE: A new Position object will be created, that
19                  * PROMISE: starts at position 0.
20                  */
21                 Position ();
22
23                 /*
24                  * PURPOSE: Construct a new Position object
25                  *
26                  * REQUIRE: Nothing
27                  *
28                  * PROMISE: A new Position object will be created, and will
29                  * PROMISE: start at position initial_position
30                  */
31                 Position (int initial_position);
32
33                 /*
34                  * PURPOSE: Compare two position objects
35                  *
36                  * REQUIRE: rhs is a valid Position object
37                  *
38                  * PROMISE: True if rhs is at the same position, false otherwise
39                  */
40                 bool operator== (const Position& rhs);
41
42                 /*
43                  * PURPOSE: Compare a Position and a float
44                  *
45                  * REQUIRE: Nothing
46                  *
47                  * PROMISE: True if rhs is within 0.05 of this Position
48                  */
49                 bool operator== (const int rhs);
50
51                 /*
52                  * PURPOSE: Add to this Position
53                  *
54                  * REQUIRE: Nothing
55                  *
56                  * PROMISE: This Position will have the rhs added to it
57                  */
58                 Position& operator+= (const float rhs);
59
60                 /*
61                  * PURPOSE: Subtract from this Position
62                  *
63                  * REQUIRE: Nothing
64                  *
65                  * PROMISE: This Position will have the rhs added to it
66                  */
67                 Position& operator-= (const float rhs);
68
69         protected:
70         private:
71                 int _major;
72                 int _minor;
73 };
74
75 #endif /* POSITION_HPP */
76
77 /* vim: set ts=4 sts=4 sw=4 noexpandtab textwidth=112: */