Package elki.datasource.bundle
Class MultipleObjectsBundle
- java.lang.Object
-
- elki.datasource.bundle.MultipleObjectsBundle
-
- All Implemented Interfaces:
ObjectBundle
public class MultipleObjectsBundle extends java.lang.Object implements ObjectBundle
This class represents a set of "packaged" objects, which is a transfer container for objects, e.g., from parsers to a database. It contains the object with multiple representations outside of any index structure.- Since:
- 0.4.0
- Author:
- Erich Schubert
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<java.util.List<?>>columnsStoring the real contents.private ArrayDBIDsidsDBIDs for these objects, but may be null.private static LoggingLOGClass logger.private BundleMetametaStoring the meta data.
-
Constructor Summary
Constructors Constructor Description MultipleObjectsBundle()Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description MultipleObjectsBundleappendColumn(SimpleTypeInformation<?> type, java.util.List<?> data)Helper to add a single column to the bundle.voidappendSimple(java.lang.Object... data)Append a new record to the data set.booleanassignDBID(int onum, DBIDVar var)Assign the object DBID to a variableBundleStreamSourceasStream()Process this bundle as stream.java.lang.Objectdata(int onum, int rnum)Access a particular object and representation.intdataLength()Get the number of objects contained.static MultipleObjectsBundlefromStream(BundleStreamSource source)Convert an object stream to a bundlejava.util.List<?>getColumn(int i)Get the raw objects columns.ArrayDBIDsgetDBIDs()Get the DBIDs, may benull.java.lang.Object[]getRow(int row)Get an object row.static <V> MultipleObjectsBundlemakeSimple(SimpleTypeInformation<? super V> type, java.util.List<? extends V> data)Helper to add a single column to the bundle.static <V1,V2>
MultipleObjectsBundlemakeSimple(SimpleTypeInformation<? super V1> type1, java.util.List<? extends V1> data1, SimpleTypeInformation<? super V2> type2, java.util.List<? extends V2> data2)Helper to add a single column to the bundle.static <V1,V2,V3>
MultipleObjectsBundlemakeSimple(SimpleTypeInformation<? super V1> type1, java.util.List<? extends V1> data1, SimpleTypeInformation<? super V2> type2, java.util.List<? extends V2> data2, SimpleTypeInformation<? super V3> type3, java.util.List<? extends V3> data3)Helper to add a single column to the bundle.BundleMetameta()Access the meta data.SimpleTypeInformation<?>meta(int i)Access the meta data.intmetaLength()Get the metadata length.voidsetDBIDs(ArrayDBIDs ids)Set the DBID range for this bundle.
-
-
-
Field Detail
-
LOG
private static final Logging LOG
Class logger.
-
meta
private BundleMeta meta
Storing the meta data.
-
columns
private java.util.List<java.util.List<?>> columns
Storing the real contents.
-
ids
private ArrayDBIDs ids
DBIDs for these objects, but may be null.
-
-
Method Detail
-
meta
public BundleMeta meta()
Description copied from interface:ObjectBundleAccess the meta data.- Specified by:
metain interfaceObjectBundle- Returns:
- metadata
-
meta
public SimpleTypeInformation<?> meta(int i)
Description copied from interface:ObjectBundleAccess the meta data.- Specified by:
metain interfaceObjectBundle- Parameters:
i- component- Returns:
- metadata of component i
-
metaLength
public int metaLength()
Description copied from interface:ObjectBundleGet the metadata length.- Specified by:
metaLengthin interfaceObjectBundle- Returns:
- length of metadata
-
data
public java.lang.Object data(int onum, int rnum)Description copied from interface:ObjectBundleAccess a particular object and representation.- Specified by:
datain interfaceObjectBundle- Parameters:
onum- Object numberrnum- Representation number- Returns:
- Contained data
-
assignDBID
public boolean assignDBID(int onum, DBIDVar var)Description copied from interface:ObjectBundleAssign the object DBID to a variable- Specified by:
assignDBIDin interfaceObjectBundle- Parameters:
onum- Object numbervar- Variable- Returns:
falseif there was no predefined DBID.
-
dataLength
public int dataLength()
Description copied from interface:ObjectBundleGet the number of objects contained.- Specified by:
dataLengthin interfaceObjectBundle- Returns:
- Number of objects
-
appendSimple
public void appendSimple(java.lang.Object... data)
Append a new record to the data set. Pay attention to having the right number of values!- Parameters:
data- Data to append
-
appendColumn
public MultipleObjectsBundle appendColumn(SimpleTypeInformation<?> type, java.util.List<?> data)
Helper to add a single column to the bundle.- Parameters:
type- Type informationdata- Data to add- Returns:
- This object, for chaining.
-
setDBIDs
public void setDBIDs(ArrayDBIDs ids)
Set the DBID range for this bundle.- Parameters:
ids- DBIDs
-
getDBIDs
public ArrayDBIDs getDBIDs()
Get the DBIDs, may benull.- Returns:
- DBIDs
-
getColumn
public java.util.List<?> getColumn(int i)
Get the raw objects columns. Use with caution!- Parameters:
i- column number- Returns:
- the ith column
-
makeSimple
public static <V> MultipleObjectsBundle makeSimple(SimpleTypeInformation<? super V> type, java.util.List<? extends V> data)
Helper to add a single column to the bundle.- Type Parameters:
V- Object type- Parameters:
type- Type informationdata- Data to add
-
makeSimple
public static <V1,V2> MultipleObjectsBundle makeSimple(SimpleTypeInformation<? super V1> type1, java.util.List<? extends V1> data1, SimpleTypeInformation<? super V2> type2, java.util.List<? extends V2> data2)
Helper to add a single column to the bundle.- Type Parameters:
V1- First Object typeV2- Second Object type- Parameters:
type1- Type informationdata1- Data column to addtype2- Second Type informationdata2- Second data column to add
-
makeSimple
public static <V1,V2,V3> MultipleObjectsBundle makeSimple(SimpleTypeInformation<? super V1> type1, java.util.List<? extends V1> data1, SimpleTypeInformation<? super V2> type2, java.util.List<? extends V2> data2, SimpleTypeInformation<? super V3> type3, java.util.List<? extends V3> data3)
Helper to add a single column to the bundle.- Type Parameters:
V1- First Object typeV2- Second Object typeV3- Third Object type- Parameters:
type1- First type informationdata1- First data column to addtype2- Second type informationdata2- Second data column to addtype3- Third type informationdata3- Third data column to add
-
asStream
public BundleStreamSource asStream()
Process this bundle as stream.- Returns:
- Stream
-
fromStream
public static MultipleObjectsBundle fromStream(BundleStreamSource source)
Convert an object stream to a bundle- Parameters:
source- Object stream- Returns:
- Static bundle
-
getRow
public java.lang.Object[] getRow(int row)
Get an object row.- Parameters:
row- Row number- Returns:
- Array of values
-
-