Code coverage report for code/models/graph-primitive.coffee

Statements: 100% (11 / 11)      Branches: 100% (2 / 2)      Functions: 100% (4 / 4)      Lines: 100% (8 / 8)      Ignored: none     

All files » code/models/ » graph-primitive.coffee
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