-
Notifications
You must be signed in to change notification settings - Fork 1
/
User.h
128 lines (102 loc) · 2.54 KB
/
User.h
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#pragma once
#include "Stack.h"
#include "UnsortedList.h"
#include "DoublySortedLinkedList.h"
#include <iostream>
using namespace std;
class Ride;
class Admin;
class User {
public:
/**
* 기본 생성자 입니다.
*/
User();
/**
* @brief 생성자입니다.
* @post ticketRank(0~9), age(0~99)의 값 랜덤 생성,
id에 Admin의 numOfEnterPeople을 넣음, wantToRide를 조건에 따라 생성함.
나머지 변수 초기화도 진행
*/
User(int numOfEnterPeople, DoublySortedLinkedList<Ride>* ride);
/*
복사생성자
*/
User(const User& user);
/**
* @brief 무슨 함수인지 모르겠어요~ wantToRide가
비었는지에 대한 여부를 알려주는건가?
* @pre
* @post
* @return
*/
bool WantToRide();
/**
* @brief 이 User의 정보를 출력합니다.
*/
void printInfo();
/**
* @brief age 설정
* @post age가 입력한 값으로 변합니다.
* @return 성공하면 true, 실패하면 false
*/
bool setAge(int _age);
/**
* @brief id 설정 - 이거 바꾸면 안되지 않나요?
* @post id가 입력한 값으로 변합니다.
* @return 성공하면 true, 실패하면 false
*/
bool setID();
/**
* @brief 입력 받은 _location으로 User의 위치를 옮깁니다.
* @pre wantToRide에 _location의 값이 존재해야 합니다.
* @post wantToRide에서 해당 값을 찾아 제거 후 hadRide로 옮깁니다.
nowLocation이 입력한 값으로 변경됩니다.
* @return 성공하면 true, 실패하면 false
*/
bool setNowLocation(int _location);
/**
* @brief age를 반환합니다.
* @pre age가 존재해야함.
* @return age를 리턴함.
*/
int getAge() const;
/**
* @brief id를 반환합니다.
* @pre id가 존재해야함.
* @return id를 리턴함.
*/
int getId() const;
/**
* @brief nowLocation을 반환합니다.
* @pre nowLocation이 존재해야함.
* @return nowLocation을 리턴함.
*/
int getNowLocation() const;
void setAllFromKB() {
}
/*wanted to ride list의 포인터를 반환*/
UnsortedList* WantToRidePointer()
{
return &wantToRide;
}
void setRideListPointer(DoublySortedLinkedList<Ride>* _ridelistpointer)
{
rideListPointer = _ridelistpointer;
}
friend class Ride;
bool operator==(const User& rhs) const;
bool operator!=(const User& rhs) const;
bool operator<(const User& rhs) const;
bool operator>(const User& rhs) const;
bool operator<=(const User& rhs) const;
bool operator>=(const User& rhs) const;
User& operator= (const User& rhs);
private:
int id; //고유 번호, numOfEnterPeople로 정함
int age; //ticketRank와 함께 탈 수 있는 Ride 결정
int nowLocation; //현재 위치한 놀이기구 id, 초기 값은 -1, 놀이공원 바깥은 -2
DoublySortedLinkedList<Ride>* rideListPointer;
UnsortedList wantToRide; //타고 싶은 놀이기구 id가 담긴 배열
Stack<int> hadRide; //이미 탑승한 놀이기구가 담긴 스택
};