|
@@ -1,31 +1,32 @@
|
|
|
package com.pact;
|
|
|
|
|
|
import java.io.*;
|
|
|
-import java.util.HashSet;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
|
|
|
public class Main {
|
|
|
|
|
|
- public HashSet<Node> process(String in)
|
|
|
+ public List<Node> process(String in)
|
|
|
throws IOException, BracketException {
|
|
|
BufferedReader inB = new BufferedReader(new FileReader(in));
|
|
|
String line;
|
|
|
- HashSet<Node> templates = null;
|
|
|
+ List<Node> templates = null;
|
|
|
|
|
|
// Read in trees one at a time
|
|
|
while((line = inB.readLine()) != null){
|
|
|
if(templates == null) {
|
|
|
// Load first line into template
|
|
|
- templates = new HashSet<>();
|
|
|
+ templates = new ArrayList<>();
|
|
|
templates.add(new Node(null, line));
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
- HashSet<Node> allCombined = new HashSet<>();
|
|
|
+ List<Node> allCombined = new ArrayList<>();
|
|
|
|
|
|
Node input = new Node(null, line);
|
|
|
for (Node template : templates) {
|
|
|
// Get all the ways we can combine input with template
|
|
|
- HashSet<Node> combined = Node.reducedCombine(template, input);
|
|
|
+ List<Node> combined = Node.reducedCombine(template, input);
|
|
|
System.out.println("com: " + combined);
|
|
|
allCombined.addAll(combined);
|
|
|
}
|
|
@@ -38,7 +39,7 @@ public class Main {
|
|
|
public static void main(String[] args) {
|
|
|
Main main = new Main();
|
|
|
String inputFilename = "input.txt";
|
|
|
- HashSet<Node> result;
|
|
|
+ List<Node> result;
|
|
|
try {
|
|
|
result = main.process(inputFilename);
|
|
|
System.out.println("----------------------------------------");
|