1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | 1 3 264 6 264 264 264 264 | # GraphPrimitive is the basis for the Node and Link classes. # They share a common ID generation mechanism mostly. module.exports = class GraphPrimitive @counters: {} @reset_counters: -> GraphPrimitive.counters = {} @nextID: (type) -> if not GraphPrimitive.counters[type] GraphPrimitive.counters[type] = 0 GraphPrimitive.counters[type]++ "#{type}-#{GraphPrimitive.counters[type]}" type: 'GraphPrimitive' constructor: -> @id = GraphPrimitive.nextID @type @key= @id |