use of de.lmu.ifi.dbs.elki.data.synthetic.bymodel.GeneratorStatic in project elki by elki-project.
the class GeneratorXMLDatabaseConnection method processElementStatic.
/**
* Process a 'static' cluster Element in the XML stream.
*
* @param gen Generator
* @param cur Current document nod
*/
private void processElementStatic(GeneratorMain gen, Node cur) {
String name = ((Element) cur).getAttribute(ATTR_NAME);
if (name == null) {
throw new AbortException("No cluster name given in specification file.");
}
ArrayList<double[]> points = new ArrayList<>();
// TODO: check for unknown attributes.
XMLNodeIterator iter = new XMLNodeIterator(cur.getFirstChild());
while (iter.hasNext()) {
Node child = iter.next();
if (TAG_POINT.equals(child.getNodeName())) {
processElementPoint(points, child);
} else if (child.getNodeType() == Node.ELEMENT_NODE) {
LOG.warning("Unknown element in XML specification file: " + child.getNodeName());
}
}
// *** add new cluster object
GeneratorStatic cluster = new GeneratorStatic(name, points);
gen.addCluster(cluster);
if (LOG.isVerbose()) {
LOG.verbose("Loaded cluster " + cluster.name + " from specification.");
}
}
Aggregations