Search in sources :

Example 11 with XMLNodeIterator

use of de.lmu.ifi.dbs.elki.utilities.xml.XMLNodeIterator in project elki by elki-project.

the class GeneratorXMLDatabaseConnection method processElementPoint.

/**
 * Parse a 'point' element (point vector for a static cluster)
 *
 * @param points current list of points (to append to)
 * @param cur Current document nod
 */
private void processElementPoint(List<double[]> points, Node cur) {
    double[] point = null;
    String vstr = ((Element) cur).getAttribute(ATTR_VECTOR);
    if (vstr != null && vstr.length() > 0) {
        point = parseVector(vstr);
    }
    if (point == null) {
        throw new AbortException("No translation vector given.");
    }
    // *** add new point
    points.add(point);
    // TODO: check for unknown attributes.
    XMLNodeIterator iter = new XMLNodeIterator(cur.getFirstChild());
    while (iter.hasNext()) {
        Node child = iter.next();
        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) AbortException(de.lmu.ifi.dbs.elki.utilities.exceptions.AbortException) XMLNodeIterator(de.lmu.ifi.dbs.elki.utilities.xml.XMLNodeIterator)

Aggregations

XMLNodeIterator (de.lmu.ifi.dbs.elki.utilities.xml.XMLNodeIterator)11 Element (org.w3c.dom.Element)11 Node (org.w3c.dom.Node)11 AbortException (de.lmu.ifi.dbs.elki.utilities.exceptions.AbortException)6 Random (java.util.Random)5 Distribution (de.lmu.ifi.dbs.elki.math.statistics.distribution.Distribution)4 GammaDistribution (de.lmu.ifi.dbs.elki.math.statistics.distribution.GammaDistribution)4 HaltonUniformDistribution (de.lmu.ifi.dbs.elki.math.statistics.distribution.HaltonUniformDistribution)4 NormalDistribution (de.lmu.ifi.dbs.elki.math.statistics.distribution.NormalDistribution)4 UniformDistribution (de.lmu.ifi.dbs.elki.math.statistics.distribution.UniformDistribution)4 GeneratorSingleCluster (de.lmu.ifi.dbs.elki.data.synthetic.bymodel.GeneratorSingleCluster)1 GeneratorStatic (de.lmu.ifi.dbs.elki.data.synthetic.bymodel.GeneratorStatic)1 RandomFactory (de.lmu.ifi.dbs.elki.utilities.random.RandomFactory)1 ArrayList (java.util.ArrayList)1