use of de.lmu.ifi.dbs.elki.datasource.bundle.BundleMeta in project elki by elki-project.
the class AbstractStreamConversionFilter method nextEvent.
@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;
}
use of de.lmu.ifi.dbs.elki.datasource.bundle.BundleMeta in project elki by elki-project.
the class ClassLabelFromPatternFilter method getMeta.
@Override
public BundleMeta getMeta() {
if (meta == null) {
// Rebuild metadata.
BundleMeta origmeta = source.getMeta();
meta = new BundleMeta(origmeta.size() + 1);
meta.add(TypeUtil.SIMPLE_CLASSLABEL);
labelcols.clear();
for (int i = 0; i < origmeta.size(); i++) {
final SimpleTypeInformation<?> orig = origmeta.get(i);
if (TypeUtil.GUESSED_LABEL.isAssignableFromType(orig)) {
labelcols.add(i);
}
meta.add(orig);
}
}
return meta;
}
use of de.lmu.ifi.dbs.elki.datasource.bundle.BundleMeta in project elki by elki-project.
the class NumberVectorLabelParser method buildMeta.
/**
* Update the meta element.
*/
protected void buildMeta() {
if (haslabels) {
meta = new BundleMeta(2);
meta.add(getTypeInformation(mindim, maxdim));
meta.add(TypeUtil.LABELLIST);
} else {
meta = new BundleMeta(1);
meta.add(getTypeInformation(mindim, maxdim));
}
}
use of de.lmu.ifi.dbs.elki.datasource.bundle.BundleMeta in project elki by elki-project.
the class SimplePolygonParser method buildMeta.
/**
* Update the meta element.
*/
protected void buildMeta() {
if (haslabels) {
meta = new BundleMeta(3);
meta.add(TypeUtil.POLYGON_TYPE);
meta.add(TypeUtil.EXTERNALID);
meta.add(TypeUtil.LABELLIST);
} else {
meta = new BundleMeta(2);
meta.add(TypeUtil.POLYGON_TYPE);
meta.add(TypeUtil.EXTERNALID);
}
}
use of de.lmu.ifi.dbs.elki.datasource.bundle.BundleMeta in project elki by elki-project.
the class VectorDimensionalityFilter method updateMeta.
/**
* Update metadata.
*/
private void updateMeta() {
meta = new BundleMeta();
BundleMeta origmeta = source.getMeta();
for (int i = 0; i < origmeta.size(); i++) {
SimpleTypeInformation<?> type = origmeta.get(i);
if (column < 0) {
// Test whether this type matches
if (TypeUtil.NUMBER_VECTOR_VARIABLE_LENGTH.isAssignableFromType(type)) {
if (type instanceof VectorFieldTypeInformation) {
@SuppressWarnings("unchecked") final VectorFieldTypeInformation<V> castType = (VectorFieldTypeInformation<V>) type;
if (dim != -1 && castType.mindim() > dim) {
throw new AbortException("Would filter all vectors: minimum dimensionality " + castType.mindim() + " > desired dimensionality " + dim);
}
if (dim != -1 && castType.maxdim() < dim) {
throw new AbortException("Would filter all vectors: maximum dimensionality " + castType.maxdim() + " < desired dimensionality " + dim);
}
if (dim == -1) {
dim = castType.mindim();
}
if (castType.mindim() == castType.maxdim()) {
meta.add(castType);
column = i;
continue;
}
}
@SuppressWarnings("unchecked") final VectorTypeInformation<V> castType = (VectorTypeInformation<V>) type;
if (dim != -1) {
meta.add(new VectorFieldTypeInformation<>(FilterUtil.guessFactory(castType), dim, dim, castType.getSerializer()));
} else {
LOG.warning("No dimensionality yet for column " + i);
meta.add(castType);
}
column = i;
continue;
}
}
meta.add(type);
}
}
Aggregations