Subversion Repositories eFlore/Applications.cel

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2390 jpm 1
<?php
2
/**
3
 *	@package JAMA
4
 *
5
 *	Error handling
6
 *	@author Michael Bommarito
7
 *	@version 01292005
8
 */
9
 
10
//Language constant
11
define('JAMALANG', 'EN');
12
 
13
 
14
//All errors may be defined by the following format:
15
//define('ExceptionName', N);
16
//$error['lang'][ExceptionName] = 'Error message';
17
$error = array();
18
 
19
/*
20
I've used Babelfish and a little poor knowledge of Romance/Germanic languages for the translations here.
21
Feel free to correct anything that looks amiss to you.
22
*/
23
 
24
define('PolymorphicArgumentException', -1);
25
$error['EN'][PolymorphicArgumentException] = "Invalid argument pattern for polymorphic function.";
26
$error['FR'][PolymorphicArgumentException] = "Modèle inadmissible d'argument pour la fonction polymorphe.".
27
$error['DE'][PolymorphicArgumentException] = "Unzulässiges Argumentmuster für polymorphe Funktion.";
28
 
29
define('ArgumentTypeException', -2);
30
$error['EN'][ArgumentTypeException] = "Invalid argument type.";
31
$error['FR'][ArgumentTypeException] = "Type inadmissible d'argument.";
32
$error['DE'][ArgumentTypeException] = "Unzulässige Argumentart.";
33
 
34
define('ArgumentBoundsException', -3);
35
$error['EN'][ArgumentBoundsException] = "Invalid argument range.";
36
$error['FR'][ArgumentBoundsException] = "Gamme inadmissible d'argument.";
37
$error['DE'][ArgumentBoundsException] = "Unzulässige Argumentstrecke.";
38
 
39
define('MatrixDimensionException', -4);
40
$error['EN'][MatrixDimensionException] = "Matrix dimensions are not equal.";
41
$error['FR'][MatrixDimensionException] = "Les dimensions de Matrix ne sont pas égales.";
42
$error['DE'][MatrixDimensionException] = "Matrixmaße sind nicht gleich.";
43
 
44
define('PrecisionLossException', -5);
45
$error['EN'][PrecisionLossException] = "Significant precision loss detected.";
46
$error['FR'][PrecisionLossException] = "Perte significative de précision détectée.";
47
$error['DE'][PrecisionLossException] = "Bedeutender Präzision Verlust ermittelte.";
48
 
49
define('MatrixSPDException', -6);
50
$error['EN'][MatrixSPDException] = "Can only perform operation on symmetric positive definite matrix.";
51
$error['FR'][MatrixSPDException] = "Perte significative de précision détectée.";
52
$error['DE'][MatrixSPDException] = "Bedeutender Präzision Verlust ermittelte.";
53
 
54
define('MatrixSingularException', -7);
55
$error['EN'][MatrixSingularException] = "Can only perform operation on singular matrix.";
56
 
57
define('MatrixRankException', -8);
58
$error['EN'][MatrixRankException] = "Can only perform operation on full-rank matrix.";
59
 
60
define('ArrayLengthException', -9);
61
$error['EN'][ArrayLengthException] = "Array length must be a multiple of m.";
62
 
63
define('RowLengthException', -10);
64
$error['EN'][RowLengthException] = "All rows must have the same length.";
65
 
66
/**
67
 *	Custom error handler
68
 *	@param int $num Error number
69
 */
70
function JAMAError($errorNumber = null) {
71
	global $error;
72
 
73
	if (isset($errorNumber)) {
74
		if (isset($error[JAMALANG][$errorNumber])) {
75
			return $error[JAMALANG][$errorNumber];
76
		} else {
77
			return $error['EN'][$errorNumber];
78
		}
79
	} else {
80
		return ("Invalid argument to JAMAError()");
81
	}
82
}