Package de.lmu.ifi.dbs.elki.utilities.exceptions

Examples of de.lmu.ifi.dbs.elki.utilities.exceptions.AbortException


  }

  public ClusterOrderResult<D> run(Database database, Relation<NV> relation) {
    Collection<DeLiCluTreeIndex<NV>> indexes = ResultUtil.filterResults(database, DeLiCluTreeIndex.class);
    if(indexes.size() != 1) {
      throw new AbortException("DeLiClu found " + indexes.size() + " DeLiCluTree indexes, expected exactly one.");
    }
    DeLiCluTreeIndex<NV> index = indexes.iterator().next();
    // FIXME: check that the index matches the relation!

    if(!(getDistanceFunction() instanceof SpatialPrimitiveDistanceFunction<?, ?>)) {
      throw new IllegalArgumentException("Distance Function must be an instance of " + SpatialPrimitiveDistanceFunction.class.getName());
    }
    @SuppressWarnings("unchecked")
    SpatialPrimitiveDistanceFunction<NV, D> distFunction = (SpatialPrimitiveDistanceFunction<NV, D>) getDistanceFunction();

    // first do the knn-Join
    if(logger.isVerbose()) {
      logger.verbose("knnJoin...");
    }
    DataStore<KNNList<D>> knns = knnJoin.run(database, relation);

    FiniteProgress progress = logger.isVerbose() ? new FiniteProgress("DeLiClu", relation.size(), logger) : null;
    final int size = relation.size();

    ClusterOrderResult<D> clusterOrder = new ClusterOrderResult<D>("DeLiClu Clustering", "deliclu-clustering");
    heap = new UpdatableHeap<SpatialObjectPair>();

    // add start object to cluster order and (root, root) to priority queue
    DBID startID = getStartObject(relation);
    clusterOrder.add(startID, null, distFunction.getDistanceFactory().infiniteDistance());
    int numHandled = 1;
    index.setHandled(startID, relation.get(startID));
    SpatialDirectoryEntry rootEntry = (SpatialDirectoryEntry) index.getRootEntry();
    SpatialObjectPair spatialObjectPair = new SpatialObjectPair(distFunction.getDistanceFactory().nullDistance(), rootEntry, rootEntry, true);
    heap.add(spatialObjectPair);

    while(numHandled < size) {
      if(heap.isEmpty()) {
        throw new AbortException("DeLiClu heap was empty when it shouldn't have been.");
      }
      SpatialObjectPair dataPair = heap.poll();

      // pair of nodes
      if(dataPair.isExpandable) {
View Full Code Here


   * @param dbids - DBIDs of the objects to move
   * @param movingVector - Vector for moving object
   */
  // TODO: move to DatabaseUtil?
  private void updateDB(DBIDs dbids, Vector movingVector) {
    throw new AbortException("FIXME: INCOMPLETE TRANSITION");
    /*
     * database.accumulateDataStoreEvents();
     * Representation<DatabaseObjectMetadata> mrep =
     * database.getMetadataQuery(); for(DBID dbid : dbids) { NV obj =
     * database.get(dbid); // Copy metadata to keep DatabaseObjectMetadata meta
View Full Code Here

  @Override
  public void processNewResult(HierarchicalResult baseResult, Result newResult) {
    ArrayList<OutlierResult> ors = ResultUtil.filterResults(newResult, OutlierResult.class);
    if(ors.size() > 1) {
      throw new AbortException("More than one outlier result found. The KML writer only supports a single outlier result!");
    }
    if(ors.size() == 1) {
      Database database = ResultUtil.findDatabase(baseResult);
      try {
        XMLOutputFactory factory = XMLOutputFactory.newInstance();
        ZipOutputStream out = new ZipOutputStream(new FileOutputStream(filename));
        out.putNextEntry(new ZipEntry("doc.kml"));
        writeKMLData(factory.createXMLStreamWriter(out), ors.get(0), database);
        out.closeEntry();
        out.flush();
        out.close();
        if(autoopen) {
          Desktop.getDesktop().open(filename);
        }
      }
      catch(XMLStreamException e) {
        logger.exception(e);
        throw new AbortException("XML error in KML output.", e);
      }
      catch(IOException e) {
        logger.exception(e);
        throw new AbortException("IO error in KML output.", e);
      }
    }
  }
View Full Code Here

      server.start();

      logger.verbose("Webserver started on port " + port + ".");
    }
    catch(IOException e) {
      throw new AbortException("Could not start mini web server.", e);
    }
  }
View Full Code Here

    if(path.startsWith(PATH_JSON)) {
      path = path.substring(PATH_JSON.length());
    }
    else {
      logger.warning("Unexpected path in request handler: " + path);
      throw new AbortException("Unexpected path: " + path);
    }

    // Get JSON-with-padding callback name.
    String callback = null;
    {
View Full Code Here

   *
   * @return input step
   */
  public InputStep getInputStep() {
    if (input == null) {
      throw new AbortException("Data input not configured.");
    }
    return input;
  }
View Full Code Here

    }
    if(algs.canRun() && !algs.isComplete()) {
      algs.execute();
    }
    if(!input.isComplete() || !algs.isComplete()) {
      throw new AbortException("Input data not available.");
    }
    // Get the database and run the algorithms
    Database database = input.getInputStep().getDatabase();
    HierarchicalResult result = algs.getAlgorithmStep().getResult();
    evals.runEvaluators(result, database);
View Full Code Here

   *
   * @return Evaluation step
   */
  public EvaluationStep getEvaluationStep() {
    if(evals == null) {
      throw new AbortException("Evaluators not configured.");
    }
    return evals;
  }
View Full Code Here

    }
    if (evals.canRun() && !evals.isComplete()) {
      evals.execute();
    }
    if (!input.isComplete()) {
      throw new AbortException("Input data not available.");
    }
    if (!evals.isComplete()) {
      throw new AbortException("Evaluation failed.");
    }
    // Get the database and run the algorithms
    HierarchicalResult result = evals.getEvaluationStep().getResult();
    outs.runResultHandlers(result);
    basedOnResult = new WeakReference<Object>(result);
View Full Code Here

              break;
            }
          }
          if(!found) {
            if(i >= odims.length) {
              throw new AbortException("Dimensionalities not proper!");
            }
            odims[i] = d;
            i++;
          }
        }
View Full Code Here

TOP

Related Classes of de.lmu.ifi.dbs.elki.utilities.exceptions.AbortException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.