var VnObject = require ('./object'); /** * Readable data model. */ var Klass = new Class (); module.exports = Klass; var Status = { CLEAN : 1 ,LOADING : 2 ,READY : 3 ,ERROR : 4 }; var SortWay = { ASC : 1 ,DESC : 2 }; Klass.extend ({ Status: Status ,SortWay: SortWay }); Klass.implement ({ Extends: VnObject ,Properties: { /** * The number of rows in the model. */ numRows: { type: Number }, /** * The current status of the model. */ status: { type: Number }, /** * Checks if the model data is ready. */ ready: { type: Boolean } } /** * Checks if the column exists. * * @param {integer} column The column index * @return {Boolean} %true if column exists, %false otherwise */ ,checkColExists: function () {} /** * Checks if the row exists. * * @param {integer} rowIndex The row index * @return {Boolean} %true if row exists, %false otherwise */ ,checkRowExists: function () {} /** * Get the index of the column from its name. * * @param {string} columnName The column name * @return {number} The column index or -1 if column not exists */ ,getColumnIndex: function () {} /** * Gets a value from the model. * * @param {number} rowIndex The row index * @param {String} columnName The column name * @return {*} The value, or %undefined */ ,get: function () {} /** * Gets a value using the column index. * * @param {number} rowIndex The row index * @param {number} column The column index * @return {*} The value */ ,getByIndex: function () {} /** * Gets a row as an object using the column index. * * @param {number} rowIndex The row index * @return {Object} The row as an object */ ,getObject: function () {} /** * Orders the model by the specified column name. * * @param {Number} column The column name * @param {SortWay} way The sort way */ ,sortByName: function () {} /** * Orders the model by the specified column. * * @param {Number} column The column index * @param {SortWay} way The sort way */ ,sort: function () {} /** * Searchs a value on the model and returns the row index of the first * ocurrence. * If an index have been built on that column, it will be used, for more * information see the indexColumn() method. * * @param {String} column The column name * @param {Object} value The value to search * @return {Number} The column index */ ,search: function () {} /** * Searchs a value on the model and returns the row index of the first * ocurrence. * * @param {Number} col The column index * @param {Object} value The value to search * @return {Number} The column index */ ,searchByIndex: function () {} /** * Builds an internal hash index for the specified column, this speeds * significantly searches on that column, specially when model has a lot of * rows. * * FIXME: Not fully implemented. * * @param {String} column The column name */ ,indexColumn: function () {} });