Skip to content
Browse files

added Collection

  • Loading branch information...
1 parent 494eb66 commit 790784cff5921d9d1dc29ee61431e21b4099f956 @fibo committed Mar 10, 2013
Showing with 25 additions and 6 deletions.
  1. +2 −0 index.js
  2. +8 −1 lib/Collection.js
  3. +10 −4 lib/Element.js
  4. +5 −1 test/RingElement.js
View
2 index.js
@@ -1,6 +1,8 @@
//-----------------------------------------------------------------------------
+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');
View
9 lib/Collection.js
@@ -4,7 +4,14 @@ var Element = require('./Element.js');
function Collection() {
var self = this;
- var _elements;
+ // TODO provvisorio, dovrei implementare un check per ogni elemento aggiunto
+ // dovrei controllare che sia istanceof l' elemento massimale
+ // ad esempio se ho tutti reali e aggiungo un complesso, diventa una collection di numeri complessi
+ // ... vabbè, per ora è solo un' idea, cmq si può implementare.
+ var _elements = arguments[0];
+
function getElements() { return _elements; };
};
+module.exports = Collection;
+
View
14 lib/Element.js
@@ -2,13 +2,19 @@
function Element() {
var self = this;
- var data;
+//-----------------------------------------------------------------------------
- function getData() {
- return data;
- };
+ var _data;
+
+ function getData() { return _data; };
+
+//-----------------------------------------------------------------------------
function setData() {};
+
+//-----------------------------------------------------------------------------
+
};
+module.exports = Element;
View
6 test/RingElement.js
@@ -2,16 +2,20 @@
var assert = require('assert');
var algebra = require('../index.js');
+var Element = algebra.Element;
var RingElement = algebra.RingElement;
+var element = new RingElement();
+
describe('RingElement', function () {
describe('constructor:', function () {
it('', function () {
});
});
describe('inheritance:', function () {
- it('is a FieldElement', function () {
+ it('is an Element', function () {
+ assert.ok(element instanceof Element);
});
});

0 comments on commit 790784c

Please sign in to comment.
Something went wrong with that request. Please try again.