-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFrame.java
More file actions
92 lines (88 loc) · 2 KB
/
Copy pathFrame.java
File metadata and controls
92 lines (88 loc) · 2 KB
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
/*
* Jiarong Xu
*/
public class Frame {
//instance Variables
private double size;
private FrameType type;
//default constructor
public Frame()
{
this.size = 18.5;
this.type = FrameType.Diamond;
}
//Parameterized
public Frame(double aS, String aT)
{
this.setSize(aS);
this.setType(aT);
}
//getter
public double getSize()
{
return this.size;
}
public FrameType getType()
{
return this.type;
}
//setter
public void setSize(double aS)
{
if(aS >= 18.5 && aS <= 60)
this.size = aS;
else
this.size = 18.5;
}
/*
public FrameType type(String aS)
{
if(aS.equalsIgnoreCase("Diamond"))
return FrameType.Diamond;
else if(aS.equalsIgnoreCase("Step-Through"))
return FrameType.Step_Through;
else if(aS.equalsIgnoreCase("Truss"))
return FrameType.Truss;
else if(aS.equalsIgnoreCase("Penny-Farthing"))
return FrameType.Penny_Farthing;
else
return FrameType.Diamond;
}
public void setType(String aS)
{
FrameType aT = type(aS);
if(aT == FrameType.Diamond)
this.type = FrameType.Diamond;
else if(aT == FrameType.Step_Through)
this.type = FrameType.Step_Through;
else if(aT == FrameType.Truss)
this.type = FrameType.Truss;
else if(aT == FrameType.Penny_Farthing)
this.type = FrameType.Penny_Farthing;
else
this.type = FrameType.Diamond;
}
*/
public void setType(String aT)
{
if(aT.equalsIgnoreCase("Diamond"))
this.type = FrameType.Diamond;
else if(aT.equalsIgnoreCase("Step-Through"))
this.type = FrameType.Step_Through;
else if(aT.equalsIgnoreCase("Truss"))
this.type = FrameType.Truss;
else if(aT.equalsIgnoreCase("Penny-Farthing"))
this.type = FrameType.Penny_Farthing;
else
this.type = FrameType.Diamond;
}
//other methods
public boolean equals(Frame a)
{
return a != null &&
this.size == a.getSize() &&
this.type == a.getType();
}
public String toString() {
return "[Frame] Size: "+this.size+" Type: "+this.type;
}}