File: Matrix.doctest

package info (click to toggle)
htmlunit-core-js 2.8-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, stretch, wheezy
  • size: 5,804 kB
  • ctags: 10,088
  • sloc: java: 75,059; xml: 889; sh: 14; makefile: 11
file content (18 lines) | stat: -rw-r--r-- 562 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Test of Matrix example.
js> defineClass("Matrix")
js> var m = new Matrix(2); // A constructor call, see "Matrix(int dimension)"
js> m                      // Object.toString will call "Matrix.getClassName()"
[object Matrix]                     
js> m[0][0] = 3;
3
js> uneval(m[0]);          // an array was created automatically!
[3]
js> uneval(m[1]);          // array is created even if we don't set a value
[]
js> m.dim;                 // we can access the "dim" property
2
js> m.dim = 3;
3
js> m.dim;                 // but not modify the "dim" property
2