2013-07-07 11:02:00 -07:00
|
|
|
require('classtool');
|
|
|
|
|
|
|
|
function ClassSpec(b) {
|
2013-07-10 10:03:05 -07:00
|
|
|
var superclass = b.superclass || require('./util/VersionedData').class();
|
2013-07-07 11:02:00 -07:00
|
|
|
|
2013-07-10 10:03:05 -07:00
|
|
|
function Address() {
|
|
|
|
Address.super(this, arguments);
|
2013-07-07 11:07:41 -07:00
|
|
|
};
|
2013-07-07 11:02:00 -07:00
|
|
|
|
2013-07-10 10:03:05 -07:00
|
|
|
Address.superclass = superclass;
|
|
|
|
superclass.applyEncodingsTo(Address);
|
2013-07-07 11:02:00 -07:00
|
|
|
|
2013-07-09 11:45:52 -07:00
|
|
|
Address.prototype.validate = function() {
|
2013-07-10 10:03:05 -07:00
|
|
|
this.doAsBinary(function() {
|
|
|
|
Address.super(this, 'validate', arguments);
|
|
|
|
if(this.data.length != 21) throw new Error('invalid data length');
|
|
|
|
});
|
2013-07-07 11:02:00 -07:00
|
|
|
};
|
|
|
|
|
2013-07-09 11:45:52 -07:00
|
|
|
return Address;
|
2013-07-07 11:02:00 -07:00
|
|
|
};
|
|
|
|
module.defineClass(ClassSpec);
|