Search in sources :

Example 1 with RandomFactory

use of de.lmu.ifi.dbs.elki.utilities.random.RandomFactory in project elki by elki-project.

the class GeneratorXMLDatabaseConnection method processElementDataset.

/**
 * Process a 'dataset' Element in the XML stream.
 *
 * @param gen Generator
 * @param cur Current document nod
 */
private void processElementDataset(GeneratorMain gen, Node cur) {
    // *** get parameters
    String seedstr = ((Element) cur).getAttribute(ATTR_SEED);
    if (clusterRandom != RandomFactory.DEFAULT && seedstr != null && seedstr.length() > 0) {
        clusterRandom = new RandomFactory((long) (ParseUtil.parseIntBase10(seedstr) * sizescale));
    }
    String testmod = ((Element) cur).getAttribute(ATTR_TEST);
    if (testmod != null && testmod.length() > 0) {
        testAgainstModel = Boolean.valueOf(ParseUtil.parseIntBase10(testmod) != 0);
    }
    // TODO: check for unknown attributes.
    XMLNodeIterator iter = new XMLNodeIterator(cur.getFirstChild());
    while (iter.hasNext()) {
        Node child = iter.next();
        if (TAG_CLUSTER.equals(child.getNodeName())) {
            processElementCluster(gen, child);
        } else if (TAG_STATIC.equals(child.getNodeName())) {
            processElementStatic(gen, child);
        } else if (child.getNodeType() == Node.ELEMENT_NODE) {
            LOG.warning("Unknown element in XML specification file: " + child.getNodeName());
        }
    }
}
Also used : Element(org.w3c.dom.Element) Node(org.w3c.dom.Node) RandomFactory(de.lmu.ifi.dbs.elki.utilities.random.RandomFactory) XMLNodeIterator(de.lmu.ifi.dbs.elki.utilities.xml.XMLNodeIterator)

Aggregations

RandomFactory (de.lmu.ifi.dbs.elki.utilities.random.RandomFactory)1 XMLNodeIterator (de.lmu.ifi.dbs.elki.utilities.xml.XMLNodeIterator)1 Element (org.w3c.dom.Element)1 Node (org.w3c.dom.Node)1