Class Recordset

    • Constructor Summary

      Constructors 
      Constructor Description
      Recordset()
      Creates a new uninitialized recordset.
      Recordset​(String[] _keys)
      Creates a new empty Recordset with given columns.
      Recordset​(List<String> _keys)
      Creates a new empty Recordset with given columns.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(CompositeObject object)
      Transforms the argument to a Record and add it into the recordset.
      void add​(List<?> row)
      Adds a copy of a record as last row.
      void add​(Record record)
      Adds a copy of a record as last row.
      void addAll​(Recordset recordset)
      Adds records from another Recordset to this Recordset.
      void addAll​(List<?> newRecords)
      Adds records to this Recordset.
      void addColumn​(String columnName, List<?> values)
      Appends a column into the recordset.
      void clear()
      Removes all Records from this Recordset.
      Recordset clone()
      Clones this recordset.
      int columnCount()
      Returns the number of columns.
      Recordset deepClone()
      Creates a deep clone.
      void elementChangedAt​(int rowIndex, int columnIndex)
      Informs the listeners that an element was replaced or has changed.
      Record getAt​(int row)
      Returns a specified (copy of a) record contained in this recordset.
      List<Object> getColumn​(String columnName)
      Returns a column.
      int getColumnIndex​(String columnName)
      Gets the index of the column with the given column name.
      Object getField​(int row, int column)
      Returns a specified field value of this recordset.
      Object getField​(int row, String column)
      Returns a specified field value of this recordset.
      List<String> getKeys()
      Returns a List with the keys of the column-names.
      List<Record> getRecords()
      Returns a List with the Records in this Recordset.
      int indexOf​(List<?> record)
      Returns the first index of a Record in this Recordset.
      int indexOf​(Record record)
      Returns the first index of a Record in this Recordset.
      void insertAllAt​(int index, List<?> newRecords)
      Inserts records into this Recordset.
      void insertAllAt​(int index, Recordset recordset)
      Adds records from another Recordset to this Recordset.
      void insertAt​(int index, CompositeObject record)
      Inserts a new record at a given index.
      void insertAt​(int index, List<?> record)
      Inserts a copy of the argument list as a new row at the given index in this recordset.
      void insertAt​(int index, Record record)
      Inserts a record at a given index.
      void insertColumn​(int index, String columnName, List<?> values)
      Inserts a column into the recordset.
      int lastIndexOf​(List<?> record)
      Returns the last index of a Record in this Recordset.
      int lastIndexOf​(Record record)
      Returns the last index of a Record in this Recordset.
      void putField​(int row, String column, Object newValue)
      Set a specified field value in this recordset.
      void remove​(List<Object> record)
      Removes a Record, given as a List of values, from this Recordset.
      void remove​(Record record)
      Removes a Record from this Recordset.
      void removeAt​(int index)
      Removes a Record from this Recordset.
      int size()
      Returns the number of Records in this Recordset.
      void sort​(String colName)
      Sorts the recordset by a column in ascending order.
      void sortDesc​(String colName)
      Sorts the recordset by a column in descending order.
      List<Record> toList()
      Converts this Recordset into a List of Records
      List<List<Object>> toMatrix()
      Converts this Recordset into a List of List
      Tree toTree​(String keyField, String parentKeyField)
      Creates a new tree from data of this recordset.
      Tree toTree​(String keyField, String parentKeyField, String valueField)
      Creates a new tree from data of this recordset.
      Tree toTree​(String keyField, String parentKeyField, String valueField, String infoField)
      Creates a new tree from data of this recordset.
      Tree toTreeConstInfo​(String keyField, String parentKeyField, String valueField, String info)
      Creates a new tree from data of this recordset.
    • Constructor Detail

      • Recordset

        public Recordset()
        Creates a new uninitialized recordset.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • Recordset

        public Recordset​(String[] _keys)
        Creates a new empty Recordset with given columns.
        Parameters:
        _keys - The column-names for the Recordset.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • Recordset

        public Recordset​(List<String> _keys)
        Creates a new empty Recordset with given columns.
        Parameters:
        _keys - The column-names for the Recordset.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
    • Method Detail

      • getAt

        public Record getAt​(int row)
        Returns a specified (copy of a) record contained in this recordset.
        Parameters:
        row - The index of the required record.
        Returns:
        A copy of the record with the specified index.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • getField

        public Object getField​(int row,
                               String column)
                        throws IllegalArgumentException,
                               IndexOutOfBoundsException
        Returns a specified field value of this recordset.
        Parameters:
        row - The row number of the required field.
        column - The column name of the required field.
        Returns:
        the value of the field at the specified row index and column name.
        Throws:
        IllegalArgumentException - If column name does not exist
        IndexOutOfBoundsException - If column or row does not exist
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • getColumnIndex

        public int getColumnIndex​(String columnName)
        Gets the index of the column with the given column name.
        Parameters:
        columnName - a name of a column
        Returns:
        the index of the column with the given name
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • getField

        public Object getField​(int row,
                               int column)
                        throws IndexOutOfBoundsException
        Returns a specified field value of this recordset.
        Parameters:
        row - The row number of the required field.
        column - The column index of the required field.
        Returns:
        the value of the field at the specified indices.
        Throws:
        IndexOutOfBoundsException - If column or row does not exist
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • putField

        public void putField​(int row,
                             String column,
                             Object newValue)
                      throws IllegalArgumentException
        Set a specified field value in this recordset.
        Parameters:
        row - The row number of the required field.
        column - The column name of the required field.
        newValue - The new value for the specified field.
        Throws:
        IllegalArgumentException
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • size

        public int size()
        Returns the number of Records in this Recordset.
        Returns:
        The number of Records in this Recordset.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • columnCount

        public int columnCount()
        Returns the number of columns.
        Returns:
        the number of columns.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • add

        public void add​(Record record)
        Adds a copy of a record as last row. If the receiver recordset is not initialized, new columns are created correponding to the fields in the argument. Otherwise, the new row has only fields for colums that already exist.
        Parameters:
        record - The new record.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • add

        public void add​(List<?> row)
        Adds a copy of a record as last row. If the receiver recordset is not initialized, nothing is inserted. Otherwise, the new row has only fields for colums that already exist.
        Parameters:
        row - The new row.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • add

        public void add​(CompositeObject object)
        Transforms the argument to a Record and add it into the recordset. If the receiver recordset is not initialized, new columns are created correponding to the fields in the argument. Otherwise, the new row has only fields for colums that already exist.
        Parameters:
        object - An ivy object considered as new record.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • insertAt

        public void insertAt​(int index,
                             Record record)
        Inserts a record at a given index. If this receiver recordset is initialized, the new row has only fields for colums that already exist. If this recordset is not initialized, new columns are created correponding to the fields in the argument record. If the given index is < 0, the record is inserted at 0. If the given row is greater than the number of rows, the record is appended at the end.
        Parameters:
        index - The index where to insert the new record.
        record - The Record to insert.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • insertAt

        public void insertAt​(int index,
                             List<?> record)
        Inserts a copy of the argument list as a new row at the given index in this recordset. If this recordset is not initialized, nothing is inserted. If the given index is < 0, the record is inserted at 0. If the given row is greater than the number of rows, the record is appended at the end.
        Parameters:
        index - The index where to insert the new record.
        record - The Record to insert.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • insertAt

        public void insertAt​(int index,
                             CompositeObject record)
        Inserts a new record at a given index. The field values of the new record are extracted from the argument object. If the given row is < 0, the record in inserted at 0. If the given row is greater than the number of rows, the record is appended. If the receiver recordset is initialized, the new row has only fields for colums that already exist. If the receiver recordset is not initialized, new columns are created correponding to the fields in the argument IvyObject.
        Parameters:
        index - The index where to insert the new record.
        record - The Record to insert.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • addAll

        public void addAll​(List<?> newRecords)
        Adds records to this Recordset.
        Parameters:
        newRecords - A list of records; this List may contain Records or Lists.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • addAll

        public void addAll​(Recordset recordset)
        Adds records from another Recordset to this Recordset.
        Parameters:
        recordset - A recordset whose records are appended to this recorset;
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • insertAllAt

        public void insertAllAt​(int index,
                                List<?> newRecords)
        Inserts records into this Recordset.
        Parameters:
        index - Where to insert the Records.
        newRecords - A list of records; this List may contain Records or Lists.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • insertAllAt

        public void insertAllAt​(int index,
                                Recordset recordset)
        Adds records from another Recordset to this Recordset.
        Parameters:
        index - Where to insert the Records.
        recordset - A recordset whose records are inserted to this recorset;
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • toList

        public List<Record> toList()
        Converts this Recordset into a List of Records
        Returns:
        A list of records.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • toMatrix

        public List<List<Object>> toMatrix()
        Converts this Recordset into a List of List
        Returns:
        A List of Lists with cell data.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • getKeys

        public List<String> getKeys()
        Returns a List with the keys of the column-names.
        Returns:
        A List with the keys of the column-names.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • getRecords

        public List<Record> getRecords()
        Returns a List with the Records in this Recordset.
        Returns:
        A List with the Records in this Recordset.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • getColumn

        public List<Object> getColumn​(String columnName)
        Returns a column.
        Parameters:
        columnName - The name of a column.
        Returns:
        The column given by its name or null.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • addColumn

        public void addColumn​(String columnName,
                              List<?> values)
        Appends a column into the recordset.
        Parameters:
        columnName - The name of the new column.
        values - A List with the values of the new columns.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • insertColumn

        public void insertColumn​(int index,
                                 String columnName,
                                 List<?> values)
        Inserts a column into the recordset.
        Parameters:
        index - The index where to insert the column.
        columnName - The name of the new column.
        values - A List with the values of the new columns.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • indexOf

        public int indexOf​(Record record)
        Returns the first index of a Record in this Recordset.
        Parameters:
        record - A Record.
        Returns:
        The first index of the Record in this Recordset; -1, if the Record in the argument is not contained in this Recordset.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • indexOf

        public int indexOf​(List<?> record)
        Returns the first index of a Record in this Recordset.
        Parameters:
        record - A Record, given as List of values.
        Returns:
        The first index of the Record in this Recordset; -1, if the Record in the argument is not contained in this Recordset.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • lastIndexOf

        public int lastIndexOf​(Record record)
        Returns the last index of a Record in this Recordset.
        Parameters:
        record - A Record.
        Returns:
        The last index of the Record in this Recordset; -1, if the Record in the argument is not contained in this Recordset.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • lastIndexOf

        public int lastIndexOf​(List<?> record)
        Returns the last index of a Record in this Recordset.
        Parameters:
        record - A Record, given as List of values.
        Returns:
        The last index of the Record in this Recordset; -1, if the Record in the argument is not contained in this Recordset.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • remove

        public void remove​(Record record)
        Removes a Record from this Recordset.
        Parameters:
        record - The record to remove.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • remove

        public void remove​(List<Object> record)
        Removes a Record, given as a List of values, from this Recordset.
        Parameters:
        record - The record to remove.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • removeAt

        public void removeAt​(int index)
        Removes a Record from this Recordset.
        Parameters:
        index - The index of the record to remove.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • clear

        public void clear()
        Removes all Records from this Recordset.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • sort

        public void sort​(String colName)
        Sorts the recordset by a column in ascending order.
        Parameters:
        colName - The column the Recordser is ordered by.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • sortDesc

        public void sortDesc​(String colName)
        Sorts the recordset by a column in descending order.
        Parameters:
        colName - The column the Recordser is ordered by.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • toTree

        public Tree toTree​(String keyField,
                           String parentKeyField)
        Creates a new tree from data of this recordset. This recordset must contain a hierarchy that is specified by the keyField and parentKeyField. There must be at least one record whichs parentKeyField is null. The values of the tree nodes are the records.
        Parameters:
        keyField - the key field
        parentKeyField - the parent key field
        Returns:
        A tree constructed from this recordset.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • toTree

        public Tree toTree​(String keyField,
                           String parentKeyField,
                           String valueField)
        Creates a new tree from data of this recordset. This recordset must contain a hierarchy that is specified by the keyField and parentKeyField. There must be at least one record whichs parentKeyField is null. The values of the tree nodes is the value of the valueField of a record.
        Parameters:
        keyField - the key field
        parentKeyField - the parent key field
        valueField - the field that contains the value of a tree node
        Returns:
        A tree constructed from this recordset.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • toTree

        public Tree toTree​(String keyField,
                           String parentKeyField,
                           String valueField,
                           String infoField)
        Creates a new tree from data of this recordset. This recordset must contain a hierarchy that is specified by the keyField and parentKeyField. There must be at least one record whichs parentKeyField is null. The values of the tree nodes is the value of the valueField of a record. If the valueField is null the values of the tree nodes are the records.
        Parameters:
        keyField - the key field
        parentKeyField - the parent key field
        valueField - the field that contains the value of a tree node. Maybe null.
        infoField - the field that contains the info. Maybe null. Either _info or infoField or both must be null.
        Returns:
        A tree constructed from this recordset.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • toTreeConstInfo

        public Tree toTreeConstInfo​(String keyField,
                                    String parentKeyField,
                                    String valueField,
                                    String info)
        Creates a new tree from data of this recordset. This recordset must contain a hierarchy that is specified by the keyField and parentKeyField. There must be at least one record whichs parentKeyField is null. The values of the tree nodes is the value of the valueField of a record.
        Parameters:
        keyField - the key field
        parentKeyField - the parent key field
        valueField - the field that contains the value of a tree node
        info - the info.
        Returns:
        A tree constructed from data of this recordset.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • elementChangedAt

        public void elementChangedAt​(int rowIndex,
                                     int columnIndex)
        Informs the listeners that an element was replaced or has changed.
        Parameters:
        rowIndex -
        columnIndex -
        API:
        This public API is available in IvyScript and Java. It has the visibility EXPERT.