VariablesIdGenerator.js 752 B

12345678910111213141516171819202122232425262728293031
  1. "use strict";
  2. /**
  3. * Class generates unused ids
  4. * @class VariablesIdGenerator
  5. * @namespace mungedb-aggregate.pipeline.expressions
  6. * @module mungedb-aggregate
  7. * @constructor
  8. **/
  9. var VariablesIdGenerator = module.exports = function VariablesIdGenerator(){
  10. this._nextId = 0;
  11. }, klass = VariablesIdGenerator, base = Object, proto = klass.prototype = Object.create(base.prototype, {constructor:{value:klass}});
  12. /**
  13. * Gets the next unused id
  14. * @method generateId
  15. * @return {Number} The unused id
  16. **/
  17. proto.generateId = function generateId() {
  18. return this._nextId++;
  19. };
  20. /**
  21. * Gets the number of used ids
  22. * @method getIdCount
  23. * @return {Number} The number of used ids
  24. **/
  25. proto.getIdCount = function getIdCount() {
  26. return this._nextId;
  27. };