Loading example.txt 0 → 100644 +1 −0 Original line number Diff line number Diff line Hello World! No newline at end of file src/edu/bu/ec504/project/Main.java 0 → 100644 +10 −0 Original line number Diff line number Diff line package edu.bu.ec504.project; public class Main { public static void main(String[] args) { final String filename="example.txt"; Molecule tester = new Molecule(filename); } } src/edu/bu/ec504/project/Molecule.java 0 → 100644 +40 −0 Original line number Diff line number Diff line package edu.bu.ec504.project; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.util.HashMap; public class Molecule { // TODO:save the molecule information // TODO:read the text file (adjacency list), line by line //Current implementation is in the constructor public Molecule(String MoleculeFile){ // Read and process input try (BufferedReader reader = new BufferedReader(new FileReader(MoleculeFile))) { String line; while ((line = reader.readLine()) != null) { System.out.println(line); // TODO: we can change this to parse the file rather than print it } } catch (IOException e) { System.err.println("Error reading the file: " + e.getMessage()); } } // TODO: add molecule to the database //FIELDS /** * saves element as the key and the quantity as the value */ HashMap <Character ,Integer>map = new HashMap<>(); } Loading
example.txt 0 → 100644 +1 −0 Original line number Diff line number Diff line Hello World! No newline at end of file
src/edu/bu/ec504/project/Main.java 0 → 100644 +10 −0 Original line number Diff line number Diff line package edu.bu.ec504.project; public class Main { public static void main(String[] args) { final String filename="example.txt"; Molecule tester = new Molecule(filename); } }
src/edu/bu/ec504/project/Molecule.java 0 → 100644 +40 −0 Original line number Diff line number Diff line package edu.bu.ec504.project; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.util.HashMap; public class Molecule { // TODO:save the molecule information // TODO:read the text file (adjacency list), line by line //Current implementation is in the constructor public Molecule(String MoleculeFile){ // Read and process input try (BufferedReader reader = new BufferedReader(new FileReader(MoleculeFile))) { String line; while ((line = reader.readLine()) != null) { System.out.println(line); // TODO: we can change this to parse the file rather than print it } } catch (IOException e) { System.err.println("Error reading the file: " + e.getMessage()); } } // TODO: add molecule to the database //FIELDS /** * saves element as the key and the quantity as the value */ HashMap <Character ,Integer>map = new HashMap<>(); }