package de.lmu.ifi.dbs.elki.data.type; /* This file is part of ELKI: Environment for Developing KDD-Applications Supported by Index-Structures Copyright (C) 2013 Ludwig-Maximilians-Universität München Lehr- und Forschungseinheit für Datenbanksysteme ELKI Development Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ import de.lmu.ifi.dbs.elki.data.BitVector; import de.lmu.ifi.dbs.elki.data.ClassLabel; import de.lmu.ifi.dbs.elki.data.DoubleVector; import de.lmu.ifi.dbs.elki.data.ExternalID; import de.lmu.ifi.dbs.elki.data.FloatVector; import de.lmu.ifi.dbs.elki.data.LabelList; import de.lmu.ifi.dbs.elki.data.NumberVector; import de.lmu.ifi.dbs.elki.data.SimpleClassLabel; import de.lmu.ifi.dbs.elki.data.SparseDoubleVector; import de.lmu.ifi.dbs.elki.data.SparseFloatVector; import de.lmu.ifi.dbs.elki.data.SparseNumberVector; import de.lmu.ifi.dbs.elki.data.model.Model; import de.lmu.ifi.dbs.elki.data.spatial.PolygonsObject; import de.lmu.ifi.dbs.elki.database.ids.DBID; import de.lmu.ifi.dbs.elki.database.ids.DBIDFactory; import de.lmu.ifi.dbs.elki.database.ids.DBIDs; import de.lmu.ifi.dbs.elki.database.ids.distance.DistanceDBIDList; import de.lmu.ifi.dbs.elki.math.linearalgebra.Matrix; import de.lmu.ifi.dbs.elki.math.linearalgebra.Vector; import de.lmu.ifi.dbs.elki.persistent.ByteArrayUtil; /** * Utility package containing various common types. * * @author Erich Schubert * * @apiviz.has TypeInformation oneway - - * @apiviz.landmark */ public final class TypeUtil { /** * Fake Constructor. */ private TypeUtil() { // Do not instantiate. } /** * Input type for algorithms that accept anything. */ public static final SimpleTypeInformation ANY = new SimpleTypeInformation<>(Object.class); /** * Database IDs. */ public static final SimpleTypeInformation DBID = new SimpleTypeInformation<>(DBID.class, DBIDFactory.FACTORY.getDBIDSerializer()); /** * Database ID lists. */ public static final SimpleTypeInformation DBIDS = new SimpleTypeInformation<>(DBIDs.class); /** * A string. */ public static final SimpleTypeInformation STRING = new SimpleTypeInformation<>(String.class, ByteArrayUtil.STRING_SERIALIZER); /** * A class label. */ public static final SimpleTypeInformation CLASSLABEL = new SimpleTypeInformation<>(ClassLabel.class); /** * Simple class labels. */ public static final SimpleTypeInformation SIMPLE_CLASSLABEL = new SimpleTypeInformation<>(SimpleClassLabel.class, SimpleClassLabel.SERIALIZER); /** * A list of labels. */ public static final SimpleTypeInformation LABELLIST = new SimpleTypeInformation<>(LabelList.class, LabelList.SERIALIZER); /** * A list of neighbors. */ public static final SimpleTypeInformation> NEIGHBORLIST = new SimpleTypeInformation<>(DistanceDBIDList.class); /** * Either class label, object labels or a string - anything that will be * accepted by * {@link de.lmu.ifi.dbs.elki.utilities.DatabaseUtil#guessObjectLabelRepresentation}. */ public static final TypeInformation GUESSED_LABEL = new AlternativeTypeInformation(LABELLIST, CLASSLABEL, STRING); /** * Number vectors of variable length. */ public static final SimpleTypeInformation> NUMBER_VECTOR_VARIABLE_LENGTH = new SimpleTypeInformation<>(NumberVector.class); /** * Input type for algorithms that require number vector fields. */ public static final VectorFieldTypeInformation> NUMBER_VECTOR_FIELD = new VectorFieldTypeInformation<>(NumberVector.class); /** * Input type for algorithms that require number vector fields. * * If possible, please use {@link #NUMBER_VECTOR_FIELD}! */ public static final VectorFieldTypeInformation DOUBLE_VECTOR_FIELD = new VectorFieldTypeInformation<>(DoubleVector.class); /** * Input type for algorithms that require number vector fields. * * If possible, please use {@link #NUMBER_VECTOR_FIELD}! */ public static final VectorFieldTypeInformation FLOAT_VECTOR_FIELD = new VectorFieldTypeInformation<>(FloatVector.class); /** * Input type for algorithms that require number vector fields. */ public static final VectorFieldTypeInformation BIT_VECTOR_FIELD = new VectorFieldTypeInformation<>(BitVector.class); /** * Sparse float vector field. */ public static final SimpleTypeInformation> SPARSE_VECTOR_VARIABLE_LENGTH = new SimpleTypeInformation<>(SparseNumberVector.class); /** * Sparse vector field. */ public static final VectorFieldTypeInformation> SPARSE_VECTOR_FIELD = new VectorFieldTypeInformation<>(SparseNumberVector.class); /** * Sparse float vector field. * * If possible, please use {@link #SPARSE_VECTOR_FIELD} instead! */ public static final VectorFieldTypeInformation SPARSE_FLOAT_FIELD = new VectorFieldTypeInformation<>(SparseFloatVector.class); /** * Sparse double vector field. * * If possible, please use {@link #SPARSE_VECTOR_FIELD} instead! */ public static final VectorFieldTypeInformation SPARSE_DOUBLE_FIELD = new VectorFieldTypeInformation<>(SparseDoubleVector.class); /** * External ID type. */ public static final SimpleTypeInformation EXTERNALID = new SimpleTypeInformation<>(ExternalID.class); /** * Type for polygons. */ public static final SimpleTypeInformation POLYGON_TYPE = new SimpleTypeInformation<>(PolygonsObject.class); /** * Double type, outlier scores etc. */ public static final SimpleTypeInformation DOUBLE = new SimpleTypeInformation<>(Double.class, ByteArrayUtil.DOUBLE_SERIALIZER); /** * Integer type. */ public static final SimpleTypeInformation INTEGER = new SimpleTypeInformation<>(Integer.class, ByteArrayUtil.INT_SERIALIZER); /** * Vector type. */ public static final SimpleTypeInformation VECTOR = new SimpleTypeInformation<>(Vector.class); /** * Matrix type. */ public static final SimpleTypeInformation MATRIX = new SimpleTypeInformation<>(Matrix.class); /** * Cluster model type. */ public static final SimpleTypeInformation MODEL = new SimpleTypeInformation<>(Model.class); /** * Make a type array easily. * * @param ts Types * @return array */ public static TypeInformation[] array(TypeInformation... ts) { return ts; } }