Package de.lmu.ifi.dbs.elki.datasource.bundle

Examples of de.lmu.ifi.dbs.elki.datasource.bundle.BundleStreamSource


   *
   * @param bundle the objects to process
   * @return processed objects
   */
  protected MultipleObjectsBundle invokeFilters(MultipleObjectsBundle bundle) {
    BundleStreamSource prevs = null;
    MultipleObjectsBundle prevb = bundle;
    if(filters != null) {
      for(ObjectFilter filter : filters) {
        if(filter instanceof StreamFilter) {
          StreamFilter sfilter = (StreamFilter) filter;
View Full Code Here


   *
   * @param bundle the objects to process
   * @return processed objects
   */
  protected BundleStreamSource invokeFilters(BundleStreamSource bundle) {
    BundleStreamSource prevs = bundle;
    MultipleObjectsBundle prevb = null;
    if(filters != null) {
      for(ObjectFilter filter : filters) {
        if(filter instanceof StreamFilter) {
          StreamFilter sfilter = (StreamFilter) filter;
View Full Code Here

      String filestr = file.getPath();
      try {
        InputStream inputStream = new FileInputStream(file);
        inputStream = FileUtil.tryGzipInput(inputStream);

        final BundleStreamSource source;
        if(parser instanceof StreamingParser) {
          final StreamingParser streamParser = (StreamingParser) parser;
          streamParser.initStream(inputStream);
          source = streamParser;
        }
        else {
          MultipleObjectsBundle parsingResult = parser.parse(inputStream);
          // normalize objects and transform labels
          source = new StreamFromBundle(parsingResult);
        }
        BundleMeta meta = null; // NullPointerException on invalid streams
        loop: for(Event e = source.nextEvent();; e = source.nextEvent()) {
          switch(e){
          case END_OF_STREAM:
            break loop;
          case META_CHANGED:
            meta = source.getMeta();
            for(int i = 0; i < meta.size(); i++) {
              if(i + 1 >= objects.metaLength()) {
                objects.appendColumn(meta.get(i), new ArrayList<Object>());
              }
              else {
                // Ensure compatibility:
                if(!objects.meta(i + 1).isAssignableFromType(meta.get(i))) {
                  throw new AbortException("Incompatible files loaded. Cannot concatenate with unaligned columns, please preprocess manually.");
                }
              }
            }
            break;
          case NEXT_OBJECT:
            Object[] o = new Object[objects.metaLength()];
            o[0] = filestr;
            for(int i = 0; i < meta.size(); i++) {
              o[i + 1] = source.data(i);
            }
            objects.appendSimple(o);
          }
        }
      }
View Full Code Here

TOP

Related Classes of de.lmu.ifi.dbs.elki.datasource.bundle.BundleStreamSource

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.