ftp.nice.ch/pub/next/science/mathematics/workbench/ImprovConnector.s.tar.gz#/ImprovConnector/ImprovConnector.rtf

This is ImprovConnector.rtf in view mode; [Download] [Up]

Copyright 1993 by Allegheny College.




ImprovConnector


	        << Preliminary >>




Inherits From:	Object

Declared In:	ToolAndInspectorProtocols.h

Written By:	Judy D. Halchin





Class Description

An ImprovConnector object is made available to tools loaded into the Workbench application so that they may store and retrieve data in an Improv spreadsheet.  




Instance Variables

id *sheet;
id *model;
int emptyCellHandling;
int textCellHandling;



sheet 	The name of the current worksheet in Improv.

model 	Name of the current model in Improv.

emptyCellHandling 	How to handle empty cells when numeric data is requested.

textCellHandling 	How to handle text cells when numeric data is requested.





Method Types

Initializing an ImprovConnector	- init

Setting retrieval behavior	- setCellHandlingForEmpty:text:

Retrieving spreadsheet information - getSelectedColumnNames:count:

Modifying spreadsheets	- addColumns:count:afterColumn:
-makeNewWorksheet:numRows:numCols:rowNames:colNames:

Retrieving spreadsheet data	- doubleData:fromColumn:dataCount:
- floatData:fromColumn:dataCount:
- intData:fromColumn:dataCount:
- stringData:fromColumn:dataCount:
- dataType:double:float:int:char:fromColumn:dataCount:
- doubleData:fromSelectedColumnsCount:byRows:dataCount:
- floatData:fromSelectedColumnsCount:byRows:dataCount:
- intData:fromSelectedColumnsCount:byRows:dataCount:
- stringData:fromSelectedColumnsCount:byRows:dataCount:
- dataType:double:float:int:string:fromSelectedColumnsCount:
€€€€€€€€€€byRows:dataCount:

Modifying spreadsheet data	- fillColumnsCount:startingAt:withDoubleData:byRows:dataCount:
- fillColumnsCount:startingAt:withFloatData:byRows:dataCount:
- fillColumnsCount:startingAt:withIntData:byRows:dataCount:
- fillColumnsCount:startingAt:withStringData:byRows:dataCount:
- fillColumnsCount:startingAt:withDataType:double:float:int:
€€€€€€€€€€string:byRows:dataCount:

Freeing data	- freeData:count:
- freeStringData:counts::






Instance Methods

addColumns:count:afterColumn:
- (int)addColumns:(char **)newColumns   count:(int)numColumns afterColumn:(char€*)existingColumn 

Inserts numColumns new columns into the spreadsheet immediately after the column whose name is given in existingColumn.  The new columns will be given the names in the list newColumns, or, if newColumns is NULL, Improv will be allowed to choose names for the new columns.  <<In this version, no more than ten columns should be added in one message to the ImprovConnector.>>  The value returned will be zero if the method is successful.  See the list of return codes for other possible values.




dataType:double:float:int:string:fromColumn:dataCount:
- (int)dataType:(int)dataType double:(double **)doubleData float:(float **)floatData int:(int€**)intData string:(char ***)stringData fromColumn:(char *)columnName dataCount:(int *)numRows

This is the method underlying doubleData:fromColumn:dataCount: and its three variants.  dataType is a constant indicating which type of data should be returned.  Only one of the four arrays doubleData, floatData, intData, and stringData will be allocated and returned.  See the description of doubleData:fromColumn:dataCount: for details. 

See also:  -doubleData:fromColumn:dataCount:




dataType:double:float:int:string:fromSelectedColumnsCount:byRows:dataCount:
- (int)dataType:(int)dataType double:(double ***)doubleData float:(float ***)floatData int:(int€***)intData string:(char ****)stringData fromSelectedColumnsCount:(int€*)numColumns byRows:(BOOL)byRows
datacount:(int *)numRows 

This is the method underlying doubleData:fromSelectedColumns:byRows:dataCount: and its three variants.  dataType is a constant indicating which type of data should be returned.  Only one of the four arrays doubleData, floatData, intData, and stringData will be allocated and returned.  See the description of doubleData:fromSelectedColumns:byRows:dataCount: for details. 

See also:  -doubleData:fromSelectedColumns:byRows:dataCount:




doubleData:fromColumn:dataCount:
- (int)doubleData:(double **)data fromColumn:(char *)columnName dataCount:(int *)numRows

Returns, by reference, the data from the cells in the named column in the active spreadsheet in Improv, along with the number of pieces of data being returned.  If cells that are empty or contain text are encountered, the behavior is determined by the values of emtpyCellHanding and textCellHandling.  

The array of values that is returned should be freed by the object that invokes this method.  The value returned will be zero if the method is successful.  See the list of return codes for other possible values.  

See also:  - setCellHandlingForEmpty:text:




doubleData:fromSelectedColumnsCount:byRows:dataCount:
- (int)doubleData:(double ***)data fromSelectedColumnsCount:(int *)numColumns byRows:(BOOL)byRows dataCount:(int *)numRows 

Returns, by reference, the data from the cells in the currently selected columns in the active spreadsheet in Improv, along with the number of rows of data being returned.  If byRows is YES, the data will be returned row by row; otherwise, it will be given column by column.  If cells that are empty or contain text are encountered, the behavior is determined by the values of emtpyCellHanding and textCellHandling.  If one of these values is WB_SKIP and causes a cell to be skipped, the entire row (if byRows is YES) or column (if byRows is NO) will be omitted.  

The array of values that is returned should be freed by the object that invokes this method (see freeData:count:).  The value returned will be zero if the method is successful.  See the list of return codes for other possible values.  

See also:  - freeData:count:, - setCellHandlingForEmpty:text:




fillColumnsCount:startingAt:withDataType:double:float:int:string:byRows:dataCount:
- (int)fillColumnsCount:(int)numColumns startingAt:(char *)columnName withDataType:(int)dataType double:(double **)doubleData float:(float **)floatData int:(int€**)intData string:(char ***)stringData byRows:(BOOL)byRows dataCount:(int)dataCount

This is the method underlying fillColumnsCount:startingAt:withDoubleData:byRows:dataCount: and its three variants.  dataType is a constant indicating which type of data is provided.  Only one of the four arrays doubleData, floatData, intData, and stringData is used.  See the description of  fillColumnsCount:startingAt:withDoubleData:byRows:dataCount: for details. 

See also:  - fillColumnsCount:startingAt:withDoubleData:byRows:dataCount:




fillColumnsCount:startingAt:withDoubleData:byRows:dataCount:
- (int)fillColumnsCount:(int)numColumns startingAt:(char *)columnName withDoubleData:(double **)data byRows:(BOOL)byRows dataCount:(int)dataCount

Inserts the data given in the array data into Improv, beginning with the column whose name is given in columnName.  The values currently in those columns will be overwritten.  dataCount should be the number of values in data.  If the current spreadsheet doesn't have a column of the given name, one will not be created (see addColumns:count:afterColumn:), nor will additional columns be created if there are not enough for the data.  However, if there are not enough rows in the spreadsheet for the given data, additional rows will be added.  If byRows is YES, the data will be returned row by row; otherwise, it will be given column by column.  << byRows equal to NO is not yet implemented.  >>

The value returned will be zero if the method is successful.  See the list of return codes for other possible values.

See also:  - fillColumnsCount:startingAt:withDoubleData:byRows:dataCount:





fillColumnsCount:startingAt:withFloatData:byRows:dataCount:
- (int)fillColumnsCount:(int)numColumns startingAt:(char *)columnName withFloatData:(float€**)data byRows:(BOOL)byRows dataCount:(int)dataCount

This method is identical to fillColumnsCount:startingAt:withDoubleData:byRows:dataCount: except that the data is supplied as an array of float to this method.

See also:  - fillColumnsCount:startingAt:withDoubleData:byRows:dataCount:





fillColumnsCount:startingAt:withIntData:byRows:dataCount:
- (int)fillColumnsCount:(int)numColumns startingAt:(char *)columnName withIntData:(int€**)data byRows:(BOOL)byRows dataCount:(int)dataCount

This method is identical to fillColumnsCount:startingAt:withDoubleData:byRows:dataCount: except that the data is supplied as an array of int to this method.

See also:  - fillColumnsCount:startingAt:withDoubleData:byRows:dataCount:





fillColumnsCount:startingAt:withStringData:byRows:dataCount:
- (int)fillColumnsCount:(int)numColumns startingAt:(char *)columnName withStringData:(char€***)data byRows:(BOOL)byRows dataCount:(int)dataCount

This method is identical to fillColumnsCount:startingAt:withDoubleData:byRows:dataCount: except that the data is supplied as an array of char * to this method.

See also:  - fillColumnsCount:startingAt:withDoubleData:byRows:dataCount:





floatData:fromColumn:dataCount:
- (int)floatData:(float **)data fromColumn:(char *)columnName dataCount:(int *)numRows

This method is identical to doubleData:fromColumn:dataCount: except that this method returns the data as an array of float.

See also:  -doubleData:fromColumn:dataCount:




floatData:fromSelectedColumnsCount:byRows:dataCount:
- (int)floatData:(float ***)data fromSelectedColumnsCount:(int *)numColumns byRows:(BOOL)byRows dataCount:(int *)numRows 

This method is identical to doubleData:fromSelectedColumns:byRows:dataCount: except that this method returns the data as an array of float.

See also:  - doubleData:fromSelectedColumns:byRows:dataCount:




freeData:count:
-freeData:(void *)data count:(int)count

Frees the list of data given by data.  data must be a list of pointers; for example, int **, double **, or char€**.  count must give the number of pointers in the list.  First, the data pointed to by each pointer in the list will be freed, then the list of pointers itself will be freed.  This method is suitable for freeing the data returned by doubleData:fromSelectedColumnsCount:byRows:dataCount:, floatData:fromSelectedColumnsCount:byRows:dataCount:, intData:fromSelectedColumnsCount:byRows:dataCount:, and stringData:fromColumn:dataCount:.  Returns self.




freeStringData:counts::
-freeStringData:(void *)data counts:(int)count1 :(int)count2

Frees the array of data given by data.  data must be an array of pointers; normally, char ***, a list of pointers to strings.  count1 must give the number of pointers in the list and count2 the number of strings pointed to by each pointer in the list.  First, each of the count2 strings pointed to by each of the count1 pointers will be freed, then each of the count1 pointers will be freed, and, finally, the list of pointers itself will be freed.  This method is suitable for freeing the data returned by stringData:fromSelectedColumnsCount:byRows:dataCount:.  Returns self.




getSelectedColumnNames:count:
- (int)getSelectedColumnNames:(char ***)columnNames count:(int *)numColumns 

Gets the names of the columns currently selected in Improv, and returns them in columnNames.  The number of names being returned will be returned in numColumns.  The value returned will be zero if the method is successful.  See the list of return codes for other possible values.




intData:fromColumn:dataCount:
- (int)intData:(int **)data fromColumn:(char *)columnName dataCount:(int *)numRows

This method is identical to doubleData:fromColumn:dataCount: except that this method returns the data as an array of int.

See also:  -doubleData:fromColumn:dataCount:




intData:fromSelectedColumnsCount:byRows:dataCount:
- (int)intData:(int ***)data fromSelectedColumnsCount:(int *)numColumns byRows:(BOOL)byRows dataCount:(int *)numRows 

This method is identical to doubleData:fromSelectedColumns:byRows:dataCount: except that this method returns the data as an array of int.

See also:  - doubleData:fromSelectedColumns:byRows:dataCount:




makeNewWorksheet:numRows:numCols:rowNames:colNames:
- (int)makeNewWorksheet:(char *)worksheetName numRows:(int)numRows numCols:(int)numColumns rowNames:(char **)rowNames colNames:(char **)columnNames

Creates a new Improv worksheet in the current Improv model.  The new worksheet will be named worksheetName and will have numRows rows and numCols columns with the names given in the lists rowNames and columnNames.  Any of  worksheetName, rowNames, and columnNames may be NULL, allowing Improv to choose the names.  The value returned will be zero if the method is successful.  See the list of return codes for other possible values.




setCellHandlingForEmpty:text:
- setCellHandlingForEmpty:(int)handlingForEmpty text:(int)handlingForText 

Tells the ImprovConnector how it should handle text and empty cells that may be encountered during subsequent calls requesting numeric data from Improv.  If handlingForEmpty is WB_ZERO, a zero will be returned whenever an empty cell is encountered.  If handlingForEmpty is WB_SKIP, no value will be returned, just as though that cell did not exist.  If handlingForEmpty is WB_ERROR, no data will be returned and a non-zero error code will be returned by the function.  The same values for handlingForText determine the same behaviors when cells containing text are encountered.  Neither parameter has any effect when string data is requested.  Returns self.



stringData:fromColumn:dataCount:
- (int)stringData:(char ***)data fromColumn:(char *)columnName dataCount:(int *)numRows

This method is identical to doubleData:fromColumn:dataCount: except that this method returns the data as an array of char * and that the values of emptyCellHandling and textCellHandling have no effect. 

See also:  -doubleData:fromColumn:dataCount:




stringData:fromSelectedColumnsCount:byRows:dataCount:
- (int)stringData:(char ****)data fromSelectedColumnsCount:(int *)numColumns byRows:(BOOL)byRows dataCount:(int *)numRows 

This method is identical to doubleData:fromSelectedColumns:byRows:dataCount: except that this method returns the data as an array of char * and that the values of emptyCellHandling and textCellHandling have no effect.

See also:  - doubleData:fromSelectedColumns:byRows:dataCount:






Constants 


/* Return Codes */
#define WB_OK	0
#define WB_NOTHINGSELECTED	1
#define WB_NOSUCHCOLUMN				2
#define WB_WRONGTYPEOFSELECTION	3
#define WB_TOOMANYCATEGORIES	4
#define WB_WRONGCELLTYPE	5
#define WB_UNKNOWNERROR	99

/* Data Types */
#define WB_DOUBLEDATA	0
#define WB_FLOATDATA	1
#define WB_INTDATA	2
#define WB_STRINGDATA	3

/* Handling of Empty and Non-numeric Cells */
#define WB_ZERO	0
#define WB_SKIP	1
#define WB_ERROR	2







These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.