Permalink
Browse files

added some abstract classes

  • Loading branch information...
1 parent d03a357 commit 01d374c85a365ce3b25537cfa002f5c4fa5ac685 @fibo committed Mar 22, 2013
View
19 index.js
@@ -1,14 +1,16 @@
//-----------------------------------------------------------------------------
-exports.Collection = require('./lib/Collection.js');
-exports.Element = require('./lib/Element.js');
-exports.Field = require('./lib/Field.js');
-exports.Group = require('./lib/Group.js');
-exports.Ring = require('./lib/Ring.js');
-exports.RingElement = require('./lib/RingElement.js');
-exports.Vector = require('./lib/Vector.js');
-exports.VectorSpace = require('./lib/VectorSpace.js');
+exports.Collection = require('./lib/Collection.js');
+exports.Element = require('./lib/Element.js');
+exports.Field = require('./lib/Field.js');
+exports.Group = require('./lib/Group.js');
+exports.GeneralLinearGroup = require('./lib/GeneralLinearGroup.js');
+exports.Matrix = require('./lib/Matrix.js');
+exports.Ring = require('./lib/Ring.js');
+exports.RingElement = require('./lib/RingElement.js');
+exports.Vector = require('./lib/Vector.js');
+exports.VectorSpace = require('./lib/VectorSpace.js');
//-----------------------------------------------------------------------------
@@ -17,6 +19,7 @@ var Real = {};
Real.Element = require('./lib/Real/Element.js');
Real.Field = require('./lib/Real/Field.js');
Real.GeneralLinearGroup = require('./lib/Real/GeneralLinearGroup.js');
+Real.Matrix = require('./lib/Real/Matrix.js');
Real.SquareMatrix = require('./lib/Real/SquareMatrix.js');
Real.Vector = require('./lib/Real/Vector.js');
Real.VectorSpace = require('./lib/Real/VectorSpace.js');
View
18 lib/GeneralLinearGroup.js
@@ -0,0 +1,18 @@
+
+var util = require('util');
+
+//TODO var Group = require('../Group.js');
+// TODO inoltre dovrei fare che group ha composition e non solo addition
+// sarebbe pure carino l alias "o" per la composizione
+
+function GeneralLinearGroup() {
+ var self = this;
+
+//-----------------------------------------------------------------------------
+
+};
+
+//-----------------------------------------------------------------------------
+
+module.exports = GeneralLinearGroup;
+
View
3 lib/Group.js
@@ -3,9 +3,6 @@ var abstractMethod = require('./util/abstractMethod.js');
function Group(arg) {
var self = this;
-
-//-----------------------------------------------------------------------------
-
};
//-----------------------------------------------------------------------------
View
14 lib/Matrix.js
@@ -0,0 +1,14 @@
+
+var util = require('util');
+
+function Matrix() {
+ var self = this;
+
+//-----------------------------------------------------------------------------
+
+};
+
+//-----------------------------------------------------------------------------
+
+module.exports = Matrix;
+
View
7 lib/Real/Field.js
@@ -8,6 +8,13 @@ var coerce = require('../util/coerce.js');
function RealField() {
var self = this;
+
+//-----------------------------------------------------------------------------
+
+ Field.call(self, arguments);
+
+//-----------------------------------------------------------------------------
+
};
util.inherits(RealField, Field);
View
17 lib/Real/GeneralLinearGroup.js
@@ -1,11 +1,13 @@
var util = require('util');
-var algorithm = require('../util/algorithm.js');
-var coerce = require('../util/coerce.js');
+var GeneralLinearGroup = require('../GeneralLinearGroup.js');
var RealField = require('./Field.js');
var RealSquareMatrix = require('./SquareMatrix.js');
+var algorithm = require('../util/algorithm.js');
+var coerce = require('../util/coerce.js');
+
var determinant = algorithm.determinant;
var R = new RealField();
@@ -15,6 +17,10 @@ function RealGeneralLinearGroup(order) {
//-----------------------------------------------------------------------------
+ GeneralLinearGroup.call(self, arguments);
+
+//-----------------------------------------------------------------------------
+
var _order = order;
function getOrder() { return _order; }
@@ -88,8 +94,11 @@ function RealGeneralLinearGroup(order) {
};
-// TODO util.inherits(RealGeneralLinearGroup, GeneralLinearGroup);
-// e a sua volta util.inherits(GeneralLinearGroup, Group);
+//-----------------------------------------------------------------------------
+
+util.inherits(RealGeneralLinearGroup, GeneralLinearGroup);
+
+//-----------------------------------------------------------------------------
module.exports = RealGeneralLinearGroup;
View
24 lib/Real/Matrix.js
@@ -0,0 +1,24 @@
+
+var util = require('util');
+
+var Matrix = require('../Matrix.js');
+
+function RealMatrix() {
+ var self = this;
+
+//-----------------------------------------------------------------------------
+
+ Matrix.call(self, arguments);
+
+//-----------------------------------------------------------------------------
+
+};
+
+//-----------------------------------------------------------------------------
+
+util.inherits(RealMatrix, Matrix);
+
+//-----------------------------------------------------------------------------
+
+module.exports = Matrix;
+
View
16 lib/Real/SquareMatrix.js
@@ -1,7 +1,11 @@
+var util = require('util');
+
+var RealElement = require('./Element.js');
+var RealMatrix = require('./Matrix.js');
+
var algorithm = require('../util/algorithm.js');
var coerce = require('../util/coerce.js');
-var RealElement = require('./Element.js');
var determinant = algorithm.determinant;
var getAdjointElements = algorithm.getAdjointElements;
@@ -13,6 +17,10 @@ function RealSquareMatrix(arg) {
//-----------------------------------------------------------------------------
+ RealMatrix.call(self, arguments);
+
+//-----------------------------------------------------------------------------
+
var _order = arg.order;
function getOrder() { return _order; };
@@ -169,5 +177,11 @@ function RealSquareMatrix(arg) {
};
+//-----------------------------------------------------------------------------
+
+util.inherits(RealSquareMatrix, RealMatrix);
+
+//-----------------------------------------------------------------------------
+
module.exports = RealSquareMatrix;
View
4 lib/Real/Vector.js
@@ -47,7 +47,11 @@ function RealVector(arg) {
};
+//-----------------------------------------------------------------------------
+
util.inherits(RealVector, Vector);
+//-----------------------------------------------------------------------------
+
module.exports = RealVector;
View
29 test/GeneralLinearGroup.js
@@ -0,0 +1,29 @@
+
+var assert = require('assert');
+var algebra = require('../index.js');
+
+var GeneralLinearGroup = algebra.GeneralLinearGroup;
+
+var gln = new GeneralLinearGroup();
+
+describe('GeneralLinearGroup', function () {
+ describe('constructor:', function () {
+ it('works', function () {
+ });
+ });
+
+ describe('inheritance:', function () {
+ it('from Foo', function () {
+ //assert.ok(foobar instanceof Foo);
+ });
+ });
+
+ describe('methods:', function () {
+ describe('method1()', function () {
+ it('does something', function () {
+
+ });
+ });
+ });
+});
+
View
36 test/Matrix.js
@@ -0,0 +1,36 @@
+
+var assert = require('assert');
+var algebra = require('../index.js');
+
+var Matrix = algebra.Matrix;
+
+var abstractMethod = algebra.util.abstractMethod;
+
+var matrix = new Matrix();
+
+describe('FooBar', function () {
+ describe('constructor:', function () {
+ it('works', function () {
+ });
+ });
+
+ describe('inheritance:', function () {
+ it('', function () {
+ });
+ });
+
+ describe('methods:', function () {
+ describe('someAbstractMethod()', function () {
+ it('is abstract', function () {
+ //assert.ok(foo.someAbstractMethod === abstractMethod);
+ });
+ });
+
+ describe('method1()', function () {
+ it('does something', function () {
+
+ });
+ });
+ });
+});
+
View
30 test/Real/Matrix.js
@@ -0,0 +1,30 @@
+
+var assert = require('assert');
+var algebra = require('../../index.js');
+
+var Matrix = algebra.Matrix;
+var RealMatrix = algebra.Real.Matrix;
+
+var matrix = new RealMatrix();
+
+describe('RealMatrix', function () {
+ describe('constructor:', function () {
+ it('works', function () {
+ });
+ });
+
+ describe('inheritance:', function () {
+ it('from Matrix', function () {
+ assert.ok(matrix instanceof Matrix);
+ });
+ });
+
+ describe('methods:', function () {
+ describe('method1()', function () {
+ it('does something', function () {
+
+ });
+ });
+ });
+});
+

0 comments on commit 01d374c

Please sign in to comment.