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<?>>
columns
Storing the real contents.private ArrayDBIDs
ids
DBIDs for these objects, but may be null.private static Logging
LOG
Class logger.private BundleMeta
meta
Storing 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 MultipleObjectsBundle
appendColumn(SimpleTypeInformation<?> type, java.util.List<?> data)
Helper to add a single column to the bundle.void
appendSimple(java.lang.Object... data)
Append a new record to the data set.boolean
assignDBID(int onum, DBIDVar var)
Assign the object DBID to a variableBundleStreamSource
asStream()
Process this bundle as stream.java.lang.Object
data(int onum, int rnum)
Access a particular object and representation.int
dataLength()
Get the number of objects contained.static MultipleObjectsBundle
fromStream(BundleStreamSource source)
Convert an object stream to a bundlejava.util.List<?>
getColumn(int i)
Get the raw objects columns.ArrayDBIDs
getDBIDs()
Get the DBIDs, may benull
.java.lang.Object[]
getRow(int row)
Get an object row.static <V> MultipleObjectsBundle
makeSimple(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.BundleMeta
meta()
Access the meta data.SimpleTypeInformation<?>
meta(int i)
Access the meta data.int
metaLength()
Get the metadata length.void
setDBIDs(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:ObjectBundle
Access the meta data.- Specified by:
meta
in interfaceObjectBundle
- Returns:
- metadata
-
meta
public SimpleTypeInformation<?> meta(int i)
Description copied from interface:ObjectBundle
Access the meta data.- Specified by:
meta
in interfaceObjectBundle
- Parameters:
i
- component- Returns:
- metadata of component i
-
metaLength
public int metaLength()
Description copied from interface:ObjectBundle
Get the metadata length.- Specified by:
metaLength
in interfaceObjectBundle
- Returns:
- length of metadata
-
data
public java.lang.Object data(int onum, int rnum)
Description copied from interface:ObjectBundle
Access a particular object and representation.- Specified by:
data
in interfaceObjectBundle
- Parameters:
onum
- Object numberrnum
- Representation number- Returns:
- Contained data
-
assignDBID
public boolean assignDBID(int onum, DBIDVar var)
Description copied from interface:ObjectBundle
Assign the object DBID to a variable- Specified by:
assignDBID
in interfaceObjectBundle
- Parameters:
onum
- Object numbervar
- Variable- Returns:
false
if there was no predefined DBID.
-
dataLength
public int dataLength()
Description copied from interface:ObjectBundle
Get the number of objects contained.- Specified by:
dataLength
in 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
-
-