[Jspro-cvs] jsPro array.js,1.27,1.28
Brought to you by:
wigleys
|
From: <gat...@us...> - 2003-09-22 06:02:44
|
Update of /cvsroot/jspro/jsPro
In directory sc8-pr-cvs1:/tmp/cvs-serv4323
Modified Files:
array.js
Log Message:
updated certain TypeMismatchExceptions to test for and display the correct datatype ('integer' instead of 'number') and updated methods with new error IllegalValueException
Index: array.js
===================================================================
RCS file: /cvsroot/jspro/jsPro/array.js,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** array.js 20 Sep 2003 19:55:44 -0000 1.27
--- array.js 22 Sep 2003 06:02:21 -0000 1.28
***************
*** 75,84 ****
}
! if ((typeof iStart != 'number') || (parseInt(iStart.toString()) != iStart)) {
! throw vError = new TypeMismatchException('Array.averageDev', 'number', typeof iStart);
}
! if ((typeof iLength != 'number') || (parseInt(iLength.toString()) != iLength)) {
! throw vError = new TypeMismatchException('Array.averageDev', 'number', typeof iLength);
}
--- 75,84 ----
}
! if ((typeof iStart != 'number') || (iStart.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Array.averageDev', 'integer', typeof iStart);
}
! if ((typeof iLength != 'number') || (iLength.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Array.averageDev', 'integer', typeof iLength);
}
***************
*** 145,148 ****
--- 145,149 ----
* @return <code>null</code> if an exception is encountered
* @throws IllegalArgumentException
+ * @throws IllegalValueException
* @throws TypeMismatchException
*/
***************
*** 158,163 ****
}
! if ((typeof iCase != 'number') || (parseInt(iCase.toString()) != iCase)) {
! throw vError = new TypeMismatchException('Array.changeKeyCase', 'number', typeof iCase);
}
--- 159,168 ----
}
! if ((typeof iCase != 'number') || (iCase.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Array.changeKeyCase', 'integer', typeof iCase);
! }
!
! if ((iCase != 0) && (iCase != 1)) {
! throw vError = new IllegalValueException('Array.changeKeyCase', 'iCase', '0 or 1', iCase);
}
***************
*** 213,218 ****
}
! if ((typeof iChunkSize != 'number') || (parseInt(iChunkSize.toString()) != iChunkSize)) {
! throw vError = new TypeMismatchException('Array.chunk', 'number', typeof iChunkSize);
}
--- 218,223 ----
}
! if ((typeof iChunkSize != 'number') || (iChunkSize.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Array.chunk', 'integer', typeof iChunkSize);
}
***************
*** 347,356 ****
}
! if ((typeof iStart != 'number') || (parseInt(iStart.toString()) != iStart)) {
! throw vError = new TypeMismatchException('Array.covar', 'number', typeof iStart);
}
! if ((typeof iLength != 'number') || (parseInt(iLength.toString()) != iLength)) {
! throw vError = new TypeMismatchException('Array.covar', 'number', typeof iLength);
}
--- 352,361 ----
}
! if ((typeof iStart != 'number') || (iStart.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Array.covar', 'integer', typeof iStart);
}
! if ((typeof iLength != 'number') || (iLength.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Array.covar', 'integer', typeof iLength);
}
***************
*** 433,442 ****
}
! if ((typeof iStart != 'number') || (parseInt(iStart.toString()) != iStart)) {
! throw vError = new TypeMismatchException('Array.fill', 'number', typeof iStart);
}
! if ((typeof iLength != 'number') || (parseInt(iLength.toString()) != iLength)) {
! throw vError = new TypeMismatchException('Array.fill', 'number', typeof iLength);
}
--- 438,447 ----
}
! if ((typeof iStart != 'number') || (iStart.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Array.fill', 'integer', typeof iStart);
}
! if ((typeof iLength != 'number') || (iLength.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Array.fill', 'integer', typeof iLength);
}
***************
*** 514,523 ****
}
! if ((typeof iStart != 'number') || (parseInt(iStart.toString()) != iStart)) {
! throw vError = new TypeMismatchException('Array.max', 'number', typeof iStart);
}
! if ((typeof iLength != 'number') || (parseInt(iLength.toString()) != iLength)) {
! throw vError = new TypeMismatchException('Array.max', 'number', typeof iLength);
}
--- 519,528 ----
}
! if ((typeof iStart != 'number') || (iStart.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Array.max', 'integer', typeof iStart);
}
! if ((typeof iLength != 'number') || (iLength.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Array.max', 'integer', typeof iLength);
}
***************
*** 599,608 ****
}
! if ((typeof iStart != 'number') || (parseInt(iStart.toString()) != iStart)) {
! throw vError = new TypeMismatchException('Array.mean', 'number', typeof iStart);
}
! if ((typeof iLength != 'number') || (parseInt(iLength.toString()) != iLength)) {
! throw vError = new TypeMismatchException('Array.mean', 'number', typeof iLength);
}
--- 604,613 ----
}
! if ((typeof iStart != 'number') || (iStart.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Array.mean', 'integer', typeof iStart);
}
! if ((typeof iLength != 'number') || (iLength.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Array.mean', 'integer', typeof iLength);
}
***************
*** 688,697 ****
}
! if ((typeof iStart != 'number') || (parseInt(iStart.toString()) != iStart)) {
! throw vError = new TypeMismatchException('Array.median', 'number', typeof iStart);
}
! if ((typeof iLength != 'number') || (parseInt(iLength.toString()) != iLength)) {
! throw vError = new TypeMismatchException('Array.median', 'number', typeof iLength);
}
--- 693,702 ----
}
! if ((typeof iStart != 'number') || (iStart.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Array.median', 'integer', typeof iStart);
}
! if ((typeof iLength != 'number') || (iLength.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Array.median', 'integer', typeof iLength);
}
***************
*** 789,798 ****
}
! if ((typeof iStart != 'number') || (parseInt(iStart.toString()) != iStart)) {
! throw vError = new TypeMismatchException('Array.min', 'number', typeof iStart);
}
! if ((typeof iLength != 'number') || (parseInt(iLength.toString()) != iLength)) {
! throw vError = new TypeMismatchException('Array.min', 'number', typeof iLength);
}
--- 794,803 ----
}
! if ((typeof iStart != 'number') || (iStart.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Array.min', 'integer', typeof iStart);
}
! if ((typeof iLength != 'number') || (iLength.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Array.min', 'integer', typeof iLength);
}
***************
*** 874,883 ****
}
! if ((typeof iStart != 'number') || (parseInt(iStart.toString()) != iStart)) {
! throw vError = new TypeMismatchException('Array.product', 'number', typeof iStart);
}
! if ((typeof iLength != 'number') || (parseInt(iLength.toString()) != iLength)) {
! throw vError = new TypeMismatchException('Array.product', 'number', typeof iLength);
}
--- 879,888 ----
}
! if ((typeof iStart != 'number') || (iStart.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Array.product', 'integer', typeof iStart);
}
! if ((typeof iLength != 'number') || (iLength.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Array.product', 'integer', typeof iLength);
}
***************
*** 976,985 ****
}
! if ((typeof iStart != 'number') || (parseInt(iStart.toString()) != iStart)) {
! throw vError = new TypeMismatchException('Array.range', 'number', typeof iStart);
}
! if ((typeof iLength != 'number') || (parseInt(iLength.toString()) != iLength)) {
! throw vError = new TypeMismatchException('Array.range', 'number', typeof iLength);
}
--- 981,990 ----
}
! if ((typeof iStart != 'number') || (iStart.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Array.range', 'integer', typeof iStart);
}
! if ((typeof iLength != 'number') || (iLength.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Array.range', 'integer', typeof iLength);
}
***************
*** 1070,1079 ****
}
! if ((typeof iStart != 'number') || (parseInt(iStart.toString()) != iStart)) {
! throw vError = new TypeMismatchException('Array.standardDev', 'number', typeof iStart);
}
! if ((typeof iLength != 'number') || (parseInt(iLength.toString()) != iLength)) {
! throw vError = new TypeMismatchException('Array.standardDev', 'number', typeof iLength);
}
--- 1075,1084 ----
}
! if ((typeof iStart != 'number') || (iStart.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Array.standardDev', 'integer', typeof iStart);
}
! if ((typeof iLength != 'number') || (iLength.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Array.standardDev', 'integer', typeof iLength);
}
***************
*** 1155,1164 ****
}
! if ((typeof iStart != 'number') || (parseInt(iStart.toString()) != iStart)) {
! throw vError = new TypeMismatchException('Array.sum', 'number', typeof iStart);
}
! if ((typeof iLength != 'number') || (parseInt(iLength.toString()) != iLength)) {
! throw vError = new TypeMismatchException('Array.sum', 'number', typeof iLength);
}
--- 1160,1169 ----
}
! if ((typeof iStart != 'number') || (iStart.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Array.sum', 'integer', typeof iStart);
}
! if ((typeof iLength != 'number') || (iLength.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Array.sum', 'integer', typeof iLength);
}
***************
*** 1230,1239 ****
}
! if ((typeof iIndex1 != 'number') || (parseInt(iIndex1.toString()) != iIndex1)) {
! throw vError = new TypeMismatchException('Array.swap', 'number', typeof iIndex1);
}
! if ((typeof iIndex2 != 'number') || (parseInt(iIndex2.toString()) != iIndex2)) {
! throw vError = new TypeMismatchException('Array.swap', 'number', typeof iIndex2);
}
--- 1235,1244 ----
}
! if ((typeof iIndex1 != 'number') || (iIndex1.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Array.swap', 'integer', typeof iIndex1);
}
! if ((typeof iIndex2 != 'number') || (iIndex2.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Array.swap', 'integer', typeof iIndex2);
}
***************
*** 1314,1323 ****
}
! if ((typeof iStart != 'number') || (parseInt(iStart.toString()) != iStart)) {
! throw vError = new TypeMismatchException('Array.variance', 'number', typeof iStart);
}
! if ((typeof iLength != 'number') || (parseInt(iLength.toString()) != iLength)) {
! throw vError = new TypeMismatchException('Array.variance', 'number', typeof iLength);
}
--- 1319,1328 ----
}
! if ((typeof iStart != 'number') || (iStart.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Array.variance', 'integer', typeof iStart);
}
! if ((typeof iLength != 'number') || (iLength.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Array.variance', 'integer', typeof iLength);
}
|