ich habe verschiedene void Methoden definiert und möchte sie aufrufen.
Wie geht das....
ich erhalte mit dem Code unten ..
[/code]
The method processRecords(String) in the type MyStructured is not applicable for the arguments ()
The method writeNewLine(String) in the type MyStructured is not applicable for the arguments ()
[/code]
mein Code
Wie geht das....
ich erhalte mit dem Code unten ..
[/code]
The method processRecords(String) in the type MyStructured is not applicable for the arguments ()
The method writeNewLine(String) in the type MyStructured is not applicable for the arguments ()
[/code]
mein Code
Code:
import java.io.*
public class MyStructured {
StringBuffer result = new StringBuffer();
String l = "\n";
String b = "(Bipolar)";
String c = new String("cluster_0 ");
String d = new String("cluster_1");
String x = "Before";
String y = "After";
// MyStructured m = new MyStructured ();
private void readRecords() {
// TODO Auto-generated method stub
System.out.println(">>> read records ...");
String filename = "digraph1";
try {
FileInputStream fstream = new FileInputStream(filename);
DataInputStream in = new DataInputStream(fstream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String strLine;
while ((strLine = br.readLine()) != null) {
processRecords(strLine);
// System.out.println(strLine);
}
in.close();
// }
} catch (Exception e) {
System.err.println("Error: " + e.getMessage());
}
}
void processRecords(String myLine) {
System.out.println(">>> process records ..." + myLine);
Vector vRecords = new Vector();
while (myLine != null) {
try {
if (myLine.contains("=\"0\"")) {
myLine = myLine.replace(">", " ");
} else if (myLine.startsWith("A")) {
System.out.println(c + " {");
System.out.println(myLine);
System.out.println("\t\t}");
} else {
System.out.println(myLine);
}
} catch (Exception e) {
System.err.println("Error: " + e.getMessage());
writeNewLine(myLine);
writeNewLine(result.toString());
}
}
}
public void writeNewLine(String writeLine) {
System.out.println(">>> write records ...");
FileOutputStream fout;
try {
fout = new FileOutputStream(
"C:\\Dokumente und Einstellungen\\bruno\\Eigene Dateien\\MyOutPut\\MyStructured.txt");
new PrintStream(fout).println(writeLine);// war line
fout.close();
} catch (IOException e) {
System.err.println("Unable to write to file");
System.exit(-1);
}
while (writeLine != null) {
try {
if (writeLine.contains("=\"0\"")) {
writeLine = writeLine.replace(">", " ");
} else if (writeLine
.startsWith("And")) {
result.append(b);
result.append(c);
result.append("{");
result.append(b);
result.append("\t\t" + writeLine);
result.append(b);
result.append("\t" + "}");
result.append(b);
} else if (writeLine
.startsWith("With")) {
result.append(b);
result.append(d);
result.append("{");
result.append(b);
result.append("\t\t" + writeLine);
result.append(b);
result.append("\t" + "}");
result.append(b);
} else {
result.append(writeLine);
result.append(b);
}
} catch (Exception e) {
System.err.println("can't write: " + e.getMessage());
}
}
}
public static void main(String[] args) {
System.out.println("start program ...");
MyStructured x = new MyStructured();
x.readRecords();
x.processRecords();
x.writeNewLine();
System.out.println("program finished ...");
}
}