-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSymbol2F.java
More file actions
35 lines (30 loc) · 1.42 KB
/
Symbol2F.java
File metadata and controls
35 lines (30 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
public class Symbol2F {
public static void writeSymbolToFile(String url, ArrayList<Symbol> symbolList) {
// TODO Auto-generated method stub
try {
FileWriter fw = new FileWriter(url);
BufferedWriter bw = new BufferedWriter(fw);
for ( Symbol s: symbolList ){
if ( s.letter.equals("\n") ) {
bw.write( "lineWrapper" + " " + s.probability + " " + s.low + " " + s.high );
}
else if ( s.letter.equals(" ") ){
bw.write( "space" + " " + s.probability + " " + s.low + " " + s.high );
} else {
bw.write( s.letter + " " + s.probability + " " + s.low + " " + s.high );
}
bw.newLine();
}
bw.close();
fw.close();
System.out.println("Writing file completed!");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}