package de.fu.alp5.foreign.distributed;
import java.io.IOException;
import java.rmi.AlreadyBoundException;
import java.rmi.NotBoundException;
import java.util.ArrayList;
import java.util.List;
public class MainAnalyzer {
public static void main(String[] args) throws IOException,
InterruptedException, AlreadyBoundException, NotBoundException {
if (args.length < 3) {
System.out
.println("Usage: -jar Foreign.jar <text file> <number of Threads> <host1> <host2> ...");
}
int numberOfThreads = Integer.parseInt(args[1]);
if (numberOfThreads != args.length - 2) {
System.err
.println("There are more or less hosts then Threads to be spawned. Usage: number of hosts = number of threads");
}
TextAnalyzerImpl textAnalyzer = new TextAnalyzerImpl(args[0],
"woerter.txt", "words.txt");
List<String> hostList = new ArrayList<String>();
for (int i = 0; i < args.length-2; ++i) {
hostList.add(args[i+2]);
}
textAnalyzer.analyze(numberOfThreads, hostList);
System.out.println(textAnalyzer);
}
}