Debian Codegraph @

rhino/testsrc/doctests/Matrix.doctest

raw
1 // This Source Code Form is subject to the terms of the Mozilla Public
2 // License, v. 2.0. If a copy of the MPL was not distributed with this
3 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
4
5 Test of Matrix example.
6 js> defineClass("Matrix")
7 js> var m = new Matrix(2); // A constructor call, see "Matrix(int dimension)"
8 js> m // Object.toString will call "Matrix.getClassName()"
9 [object Matrix]
10 js> m[0][0] = 3;
11 3
12 js> uneval(m[0]); // an array was created automatically!
13 [3]
14 js> uneval(m[1]); // array is created even if we don't set a value
15 []
16 js> m.dim; // we can access the "dim" property
17 2
18 js> m.dim = 3;
19 3
20 js> m.dim; // but not modify the "dim" property
21 2
22