public
Description: Prototype of the Swarm Distributed Programming Language
Homepage: http://blog.locut.us/category/projects/swarm/
Clone URL: git://github.com/sanity/swarm-proto.git
swarm-proto / src / dpl / ObjectRef.scala
100644 24 lines (20 sloc) 0.396 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package dpl
import scala.collection.mutable.HashSet
 
case class ObjectRef(location : Node, ref : Int) {
  ObjectRef.refs += this
  private var usageCount = 0
  def resetUsageCount = {
    usageCount = 0
  }
  def incrUsageCount = {
    usageCount += 1
  }
}
 
object ObjectRef {
  var refs = new HashSet[ObjectRef]
  
  def resetAll = {
    for (r <- refs) {
      r.resetUsageCount
    }
  }
  
}