-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathLimit.cpp
70 lines (50 loc) · 966 Bytes
/
Limit.cpp
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
#include "Limit.h"
Limit::Limit(){name="<NoName>";prev=0;};
Limit::Limit(char* m,Limit* pr){
name=m;
prev=pr;
}
int
Limit::okSegment(Segment *t){return 1;}
char *
Limit::print()
{
if(prev!=0)
return ( new RString( getName(),prev->getName() ))->print();
return getName();
}
char *
Limit::getName(){return (new RString(name,getParameters()))->print();}
double
Limit::getValue(){return 0;}
char *
Limit::getParameters(){return "1";}
int
Limit::checkLimit(Segment *t)
{
//check previous limit (recursively!!!)
if(prev!=0)
if(prev->checkLimit(t)==0) return 0;
//check actual limit
return okSegment(t);
}
double
OrderLimit::getValue()
{
return order;
}
int
OrderLimit::okSegment(Segment *t)
{
if(t->getOrder()==order)
return 1;
return 0;
}
char *
OrderLimit::getName(){return (new RString(name,getParameters()))->print();}
char *
OrderLimit::getParameters()
{
return (new RString(order))->print();
}
;