# HG changeset patch # User Joshua Garnett # Date 1376017616 14400 # Node ID 5cf8de487ed6a038807cf0a1787e62d97889c140 # Parent cdfc5e2de4353f295cb776f3cd4243d32a08edf8 Adding sizes analysis diff -r cdfc5e2de435 -r 5cf8de487ed6 tools/parse.scala --- a/tools/parse.scala Thu Aug 08 21:08:01 2013 -0400 +++ b/tools/parse.scala Thu Aug 08 23:06:56 2013 -0400 @@ -11,11 +11,19 @@ var totalProblems = json.size var totalSize = 0 val operatorHash = HashMap[String, Int]() +val allSizes = HashMap[Int, Int]() for(p <- json) { val problem = p.asInstanceOf[JSONObject] - totalSize += problem.get("size").asInstanceOf[java.lang.Integer] + val size = problem.get("size").asInstanceOf[java.lang.Integer] + totalSize += size val operators = problem.get("operators").asInstanceOf[JSONArray] + + allSizes(size) = allSizes.get(size) match { + case Some(count) => count + 1 + case None => 1 + } + for(o <- operators) { val operator = o.asInstanceOf[String] operatorHash(operator) = operatorHash.get(operator) match { @@ -33,3 +41,8 @@ for((key, value) <- operatorHash) { println(" " + key + ":" + value) } + +println("Size Count: ") +for(key <- allSizes.keys.toList.sorted) { + println(" " + key + ":" + allSizes(key)) +} \ No newline at end of file