-
Notifications
You must be signed in to change notification settings - Fork 1
/
TGTupleto.h
52 lines (41 loc) · 1.06 KB
/
TGTupleto.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
#ifndef TG_TUPLE_TO
#define TG_TUPLE_TO
#include "TGFactory.h"
class TGTupleto
{
protected:
int enters;
int times;
public:
TGTupleto() { enters = 1; times = 1; }
int getEnters() { return enters; }
void setEnters(int _enters) { enters = _enters; }
int getTimes() { return times; }
void setTimes(int _times) { times = _times; }
long convertTime(long _time) { return _time * times / enters; }
bool isEqual(TGTupleto* tupleto)
{
return (tupleto->getEnters() == getEnters() &&
tupleto->getTimes() == getTimes());
}
bool isEqualToNormal()
{
return enters == 1 && times == 1;
}
TGTupleto *clone(TGFactory *factory){
TGTupleto *tupleto = factory->newTupleto();
copy(tupleto);
return tupleto;
}
void copy(TGTupleto *tupleto){
tupleto->setEnters(enters);
tupleto->setTimes(times);
}
static TGTupleto* newTupleto(int enters,int times){
TGTupleto *tupleto = TGFactory::newTupleto2();
tupleto->setEnters(enters);
tupleto->setTimes(times);
return tupleto;
}
};
#endif