Yesoda Sanka 5 年 前
コミット
42d3218752

+ 3
- 2
src/main/java/rocks/zipcode/io/quiz3/collections/Lab.java ファイルの表示

@@ -8,7 +8,7 @@ public class Lab {
8 8
       String labStatus;
9 9
 
10 10
     public Lab() {
11
-        this(null);
11
+        //this(null);
12 12
     }
13 13
 
14 14
     public Lab(String labName) {
@@ -16,12 +16,13 @@ public class Lab {
16 16
         this.labName =labName ;
17 17
     }
18 18
 
19
-    public String getLabStatus() {
19
+   public String getLabStatus() {
20 20
 
21 21
         return labStatus ;
22 22
     }
23 23
 
24 24
     public void setLabStatus(String labStatus) {
25
+
25 26
         this.labStatus =labStatus ;
26 27
     }
27 28
 

+ 15
- 6
src/main/java/rocks/zipcode/io/quiz3/collections/Student.java ファイルの表示

@@ -1,7 +1,9 @@
1 1
 package rocks.zipcode.io.quiz3.collections;
2 2
 
3
+import javafx.scene.Parent;
3 4
 import rocks.zipcode.io.quiz3.objectorientation.enums.LabStatus;
4 5
 
6
+import javax.xml.soap.SOAPPart;
5 7
 import java.util.HashMap;
6 8
 import java.util.Map;
7 9
 
@@ -10,26 +12,33 @@ import java.util.Map;
10 12
  */
11 13
 public class Student {
12 14
 
13
-    Map<Lab,LabStatus >map=new HashMap<>();
15
+    Map<Lab, LabStatus >hm;
14 16
 
15 17
     public Student() {
16
-        this(null);
18
+
19
+        this.hm =new HashMap<>();
20
+        //this(null);
17 21
     }
18 22
 
19 23
     public Student(Map<Lab, LabStatus> map) {
20 24
 
21
-        this.map=map;
25
+        this.hm=map;
22 26
     }
23 27
 
24 28
     public void setLabStatus(Lab lab, LabStatus labStatus) {
25
-      map.put(lab,labStatus );
29
+      hm.put(lab,labStatus );
26 30
 
27 31
     }
28 32
     public void forkLab(Lab lab) {
29
-        lab.getName();
33
+        LabStatus temp = hm.put(lab, LabStatus.PENDING);
34
+        System .out.println(temp);
30 35
     }
31 36
 
32 37
     public LabStatus getLabStatus(String labName) {
33
-        throw new UnsupportedOperationException("Method not yet implemented");
38
+        try {
39
+            return hm.get(labName);
40
+        } catch (Exception e) {
41
+            throw new UnsupportedOperationException("Method not yet implemented");
42
+        }
34 43
     }
35 44
 }

+ 2
- 4
src/main/java/rocks/zipcode/io/quiz3/objectorientation/enums/LabStatus.java ファイルの表示

@@ -4,9 +4,7 @@ package rocks.zipcode.io.quiz3.objectorientation.enums;
4 4
  * @author leon on 10/12/2018.
5 5
  */
6 6
 public enum LabStatus {
7
-    //ADD_ENUMERATIONS_HERE;
8
-
9
-    ROCK, PAPER, SCISSOR;
10
-
7
+    // ADD_ENUMERATIONS_HERE;
8
+    PENDING,COMPLETED,INCOMPLETE,
11 9
 }
12 10