Tariq Hook 7 年之前
父節點
當前提交
7af1ca3e15
共有 3 個文件被更改,包括 3 次插入19 次删除
  1. 0
    13
      src/main/java/io/zipcoder/Item.java
  2. 1
    6
      src/main/java/io/zipcoder/ItemParser.java
  3. 2
    0
      src/main/java/io/zipcoder/Main.java

+ 0
- 13
src/main/java/io/zipcoder/Item.java 查看文件

26
         return name;
26
         return name;
27
     }
27
     }
28
 
28
 
29
-    public void setName(String name) {
30
-        this.name = name;
31
-    }
32
 
29
 
33
     public Double getPrice() {
30
     public Double getPrice() {
34
         return price;
31
         return price;
35
     }
32
     }
36
 
33
 
37
-    public void setPrice(Double price) {
38
-        this.price = price;
39
-    }
40
 
34
 
41
     public String getType() {
35
     public String getType() {
42
         return type;
36
         return type;
43
     }
37
     }
44
 
38
 
45
-    public void setType(String type) {
46
-        this.type = type;
47
-    }
48
 
39
 
49
     public String getExpiration() {
40
     public String getExpiration() {
50
         return expiration;
41
         return expiration;
51
     }
42
     }
52
 
43
 
53
-    public void setExpiration(String expiration) {
54
-        this.expiration = expiration;
55
-    }
56
-
57
     @Override
44
     @Override
58
     public String toString(){
45
     public String toString(){
59
         return "name:" + name + " price:" + price + " type:" + type + " expiration:" + expiration;
46
         return "name:" + name + " price:" + price + " type:" + type + " expiration:" + expiration;

+ 1
- 6
src/main/java/io/zipcoder/ItemParser.java 查看文件

5
 
5
 
6
 public class ItemParser {
6
 public class ItemParser {
7
 
7
 
8
-    /**
9
-     *
10
-     * @param rawData
11
-     * @return
12
-     */
13
 
8
 
14
     public ArrayList<String> parseRawDataIntoStringArray(String rawData){
9
     public ArrayList<String> parseRawDataIntoStringArray(String rawData){
15
         String stringPattern = "##";
10
         String stringPattern = "##";
22
     }
17
     }
23
 
18
 
24
     public ArrayList<String> findKeyValuePairsInRawItemData(String rawItem){
19
     public ArrayList<String> findKeyValuePairsInRawItemData(String rawItem){
25
-        String stringPattern = ";";
20
+        String stringPattern = "[;|^]";
26
         ArrayList<String> response = splitStringWithRegexPattern(stringPattern , rawItem);
21
         ArrayList<String> response = splitStringWithRegexPattern(stringPattern , rawItem);
27
         return response;
22
         return response;
28
     }
23
     }

+ 2
- 0
src/main/java/io/zipcoder/Main.java 查看文件

2
 
2
 
3
 import org.apache.commons.io.IOUtils;
3
 import org.apache.commons.io.IOUtils;
4
 
4
 
5
+
5
 public class Main {
6
 public class Main {
6
 
7
 
7
     public String readRawDataToString() throws Exception{
8
     public String readRawDataToString() throws Exception{
12
 
13
 
13
     public static void main(String[] args) throws Exception{
14
     public static void main(String[] args) throws Exception{
14
         String output = (new Main()).readRawDataToString();
15
         String output = (new Main()).readRawDataToString();
16
+        System.out.println(output);
15
         // TODO: parse the data in output into items, and display to console.
17
         // TODO: parse the data in output into items, and display to console.
16
     }
18
     }
17
 }
19
 }