}
public boolean parseArguments(String[] args)
throws FileNotFoundException, IOException
{
CommandLineParser parser = new CommandLineParser();
// input
parser.addStringArrayCommand("i", true);
// initial discretization
parser.addIntCommand("ninitcluster", false);
parser.addStringCommand("initcenters", false);
parser.addStringCommand("metric", false, "euclidean", new String[]
{
"euclidean", "minrmsd"
});
// parameters
parser.addIntCommand("nsplit", true);
parser.addCommand("tau", true);
parser.addIntArgument("tau", true); // tau
parser.addIntArgument("tau", true); // average window
parser.addIntCommand("nhidden", true);
parser.addDoubleCommand("requestederror", false);
parser.addIntCommand("maxrefinementsteps", false);
// output
parser.addStringCommand("o", true);
if (!parser.parse(args))
{
return false;
}
String[] ifiles = parser.getStringArray("i");
inputFiles = new ArrayList();
for (int i = 0; i < ifiles.length; i++)
{
inputFiles.add(ifiles[i]);
}
System.out.println("reading input data ... ");
IDataSequenceLoader loader = dataNew.multiSequenceLoader(inputFiles);
data = loader.loadAll();
System.out.println(" done. size: " + data.getSequence(0).size() + " x " + data.getSequence(0).dimension());
// data assignment metric
String metricstring = parser.getString("metric");
if (metricstring.equalsIgnoreCase("euclidean"))
{
metric = new EuclideanDistance();
}
if (metricstring.equalsIgnoreCase("minrmsd"))
{
metric = new MinimalRMSDistance3D(data.getSequence(0).dimension() / 3);
}
// initial discretization
if (parser.hasCommand("ninitcluster"))
{
ninitclusters = parser.getInt("ninitcluster");
}
else
{
String initcenterfile = parser.getString("initcenters");
initcenters = dataNew.reader(initcenterfile).load();
}
// parameters
nsplit = parser.getInt("nsplit");
tau = parser.getInt("tau", 0);
timeshift = parser.getInt("tau", 1);
nhidden = parser.getInt("nhidden");
requestedError = parser.getDouble("requestederror");
maxrefinementsteps = parser.getInt("maxrefinementsteps");
outdir = parser.getString("o");
System.out.println("read all input, continuing");
return true;
}