Browse Source

RegexLab back and better than ever

miscbits 6 years ago
commit
a8009d23ea
7 changed files with 5478 additions and 0 deletions
  1. 4
    0
      .gitignore
  2. 0
    0
      README.md
  3. 19
    0
      pom.xml
  4. 39
    0
      src/main/java/HamletParser.java
  5. 2
    0
      src/main/java/Match.java
  6. 5383
    0
      src/main/resources/hamlet.txt
  7. 31
    0
      src/test/java/HamletParserTest.java

+ 4
- 0
.gitignore View File

@@ -0,0 +1,4 @@
1
+regex.iml
2
+.idea
3
+.DS_Store
4
+*.class

+ 0
- 0
README.md View File


+ 19
- 0
pom.xml View File

@@ -0,0 +1,19 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project xmlns="http://maven.apache.org/POM/4.0.0"
3
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5
+    <modelVersion>4.0.0</modelVersion>
6
+
7
+    <groupId>com.zipcodewilmington</groupId>
8
+    <artifactId>regex</artifactId>
9
+    <version>1.0-SNAPSHOT</version>
10
+
11
+    <dependencies>
12
+        <dependency>
13
+            <groupId>junit</groupId>
14
+            <artifactId>junit</artifactId>
15
+            <version>4.12</version>
16
+        </dependency>
17
+    </dependencies>
18
+
19
+</project>

+ 39
- 0
src/main/java/HamletParser.java View File

@@ -0,0 +1,39 @@
1
+import java.io.File;
2
+import java.io.IOException;
3
+import java.util.Scanner;
4
+
5
+/**
6
+ * Created by thook on 10/7/15.
7
+ */
8
+public class HamletParser {
9
+
10
+    private String hamletData;
11
+
12
+    public HamletParser(){
13
+        this.hamletData = loadFile();
14
+    }
15
+
16
+    private String loadFile(){
17
+        ClassLoader classLoader = getClass().getClassLoader();
18
+        File file = new File(classLoader.getResource("hamlet.txt").getFile());
19
+        StringBuilder result = new StringBuilder("");
20
+
21
+        try(Scanner scanner = new Scanner(file)){
22
+            while(scanner.hasNextLine()){
23
+                String line = scanner.nextLine();
24
+                result.append(line).append("\n");
25
+            }
26
+
27
+            scanner.close();
28
+        }catch(IOException e){
29
+            e.printStackTrace();
30
+        }
31
+
32
+        return result.toString();
33
+    }
34
+
35
+    public String getHamletData(){
36
+        return hamletData;
37
+    }
38
+
39
+}

+ 2
- 0
src/main/java/Match.java View File

@@ -0,0 +1,2 @@
1
+public class Match {
2
+}

+ 5383
- 0
src/main/resources/hamlet.txt
File diff suppressed because it is too large
View File


+ 31
- 0
src/test/java/HamletParserTest.java View File

@@ -0,0 +1,31 @@
1
+import org.junit.Before;
2
+import org.junit.Test;
3
+
4
+import static org.junit.Assert.*;
5
+
6
+public class HamletParserTest {
7
+    private String hamletText;
8
+    private HamletParser hamletParser;
9
+
10
+    @Before
11
+    public void setUp() {
12
+        this.hamletParser = new HamletParser();
13
+        this.hamletText = hamletParser.getHamletData();
14
+    }
15
+
16
+    @Test
17
+    public void testChangeHamletToLeon() {
18
+    }
19
+
20
+    @Test
21
+    public void testChangeHoratioToTariq() {
22
+    }
23
+
24
+    @Test
25
+    public void testFindHoratio() {
26
+    }
27
+
28
+    @Test
29
+    public void testFindHamlet() {
30
+    }
31
+}