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

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


        }
        return Event.END_OF_STREAM;
      case META_CHANGED:
        // Search for the first label column
        if(lblcol < 0) {
          BundleMeta meta = source.getMeta();
          for(int i = 0; i < meta.size(); i++) {
            if(TypeUtil.GUESSED_LABEL.isAssignableFromType(meta.get(i))) {
              lblcol = i;
              break;
            }
          }
        }
View Full Code Here


  @Override
  public Event nextEvent() {
    Event ev = source.nextEvent();
    if(ev == Event.META_CHANGED) {
      if(meta == null) {
        meta = new BundleMeta();
      }
      BundleMeta origmeta = source.getMeta();
      for(int i = meta.size(); i < origmeta.size(); i++) {
        if(column < 0) {
          @SuppressWarnings("unchecked")
          SimpleTypeInformation<Object> type = (SimpleTypeInformation<Object>) origmeta.get(i);
          // Test whether this type matches
          if(getInputTypeRestriction().isAssignableFromType(type)) {
            @SuppressWarnings("unchecked")
            final SimpleTypeInformation<I> castType = (SimpleTypeInformation<I>) type;
            meta.add(convertedType(castType));
            column = i;
            continue;
          }
        }
        meta.add(origmeta.get(i));
      }
    }
    return ev;
  }
View Full Code Here

  @Override
  public Event nextEvent() {
    Event ev = source.nextEvent();
    if(ev == Event.META_CHANGED) {
      if(meta == null) {
        meta = new BundleMeta();
        meta.add(TypeUtil.DBID);
      }
      BundleMeta origmeta = source.getMeta();
      // Note -1 for the injected DBID column
      for(int i = meta.size() - 1; i < origmeta.size(); i++) {
        meta.add(origmeta.get(i));
      }
    }
    return ev;
  }
View Full Code Here

        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

  /**
   * Update the meta element.
   */
  protected void buildMeta() {
    meta = new BundleMeta(2);
    meta.add(getTypeInformation(dimensionality));
    meta.add(TypeUtil.LABELLIST);
  }
View Full Code Here

TOP

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

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.