UNPKG

layout-base

Version:

Basic layout model and some utilities for Cytoscape.js layout extensions

31 lines (24 loc) 672 B
var UniqueIDGeneretor = require('./UniqueIDGeneretor'); function HashMap() { this.map = {}; this.keys = []; } HashMap.prototype.put = function (key, value) { var theId = UniqueIDGeneretor.createID(key); if (!this.contains(theId)) { this.map[theId] = value; this.keys.push(key); } }; HashMap.prototype.contains = function (key) { var theId = UniqueIDGeneretor.createID(key); return this.map[key] != null; }; HashMap.prototype.get = function (key) { var theId = UniqueIDGeneretor.createID(key); return this.map[theId]; }; HashMap.prototype.keySet = function () { return this.keys; }; module.exports = HashMap;