Class 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 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.
    • Constructor Detail

      • MultipleObjectsBundle

        public MultipleObjectsBundle()
        Constructor.
    • Method Detail

      • metaLength

        public int metaLength()
        Description copied from interface: ObjectBundle
        Get the metadata length.
        Specified by:
        metaLength in interface ObjectBundle
        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 interface ObjectBundle
        Parameters:
        onum - Object number
        rnum - 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 interface ObjectBundle
        Parameters:
        onum - Object number
        var - 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 interface ObjectBundle
        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 information
        data - 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 be null.
        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 information
        data - 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 type
        V2 - Second Object type
        Parameters:
        type1 - Type information
        data1 - Data column to add
        type2 - Second Type information
        data2 - 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 type
        V2 - Second Object type
        V3 - Third Object type
        Parameters:
        type1 - First type information
        data1 - First data column to add
        type2 - Second type information
        data2 - Second data column to add
        type3 - Third type information
        data3 - Third data column to add
      • asStream

        public BundleStreamSource asStream()
        Process this bundle as stream.
        Returns:
        Stream
      • getRow

        public java.lang.Object[] getRow​(int row)
        Get an object row.
        Parameters:
        row - Row number
        Returns:
        Array of values