lunlumo #9280(2009/07/03 14:37 GMT) [ Scala ] Rating0/0=0.00
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
import scala.collection.jcl.Conversions import java.io.File import java.util.Collections import java.util.jar.{JarEntry,JarFile} object MethodCount { def getClassInformations(l:List[String]):List[Pair[String,Int]] = { def getInfo(n:String):Pair[String,Int] = try { (n, Class.forName(n).getDeclaredMethods.size) } catch { case _ => (n, -1) } def isClass(n:String):Boolean = n.endsWith(".class") && !n.matches("\\$\\$anonfun\\$") def getClassName(n:String):String = n.substring(0, n.length - 6).replace('/', '.') def getJarEntries(f:File):List[JarEntry] = Conversions.convertList(Collections.list((new JarFile(f)).entries)).toList def getFiles(l:List[String]):List[File] = l.map(new File(System.getProperty("scala.home"), _)).filter(_.exists) getFiles(l).map(getJarEntries).flatten(identity(_)).map(_.getName).filter(isClass).map(getClassName).map(getInfo) } def main(args:Array[String]):Unit = { val l:List[Pair[String,Int]] = getClassInformations(List("lib/scala-library.jar", "lib/scala-swing.jar")) Console.printf("total:\t%d\n", l.size) l.sort(_._2 > _._2).take(10).foreach((i) => Console.printf("%s:\t%d\n", i._1, i._2)) } }
Rating0/0=0.00-0+
[ reply ]
lunlumo #9280() [ Scala ] Rating0/0=0.00
total: 3173
scala.swing.Key: 206
scala.collection.jcl.Buffer$Projection: 166
scala.collection.jcl.ArrayList: 158
scala.collection.jcl.LinkedList: 158
scala.collection.jcl.Buffer$$anon$2: 155
scala.collection.jcl.SortedMap$$anon$1: 153
scala.collection.jcl.TreeMap: 153
scala.collection.jcl.SortedMap$$anon$2: 151
scala.collection.jcl.Buffer$Range: 150
scala.collection.jcl.TreeSet: 146
import scala.collection.jcl.Conversions import java.io.File import java.util.Collections import java.util.jar.{JarEntry,JarFile} object MethodCount { def getClassInformations(l:List[String]):List[Pair[String,Int]] = { def getInfo(n:String):Pair[String,Int] = try { (n, Class.forName(n).getDeclaredMethods.size) } catch { case _ => (n, -1) } def isClass(n:String):Boolean = n.endsWith(".class") && !n.matches("\\$\\$anonfun\\$") def getClassName(n:String):String = n.substring(0, n.length - 6).replace('/', '.') def getJarEntries(f:File):List[JarEntry] = Conversions.convertList(Collections.list((new JarFile(f)).entries)).toList def getFiles(l:List[String]):List[File] = l.map(new File(System.getProperty("scala.home"), _)).filter(_.exists) getFiles(l).map(getJarEntries).flatten(identity(_)).map(_.getName).filter(isClass).map(getClassName).map(getInfo) } def main(args:Array[String]):Unit = { val l:List[Pair[String,Int]] = getClassInformations(List("lib/scala-library.jar", "lib/scala-swing.jar")) Console.printf("total:\t%d\n", l.size) l.sort(_._2 > _._2).take(10).foreach((i) => Console.printf("%s:\t%d\n", i._1, i._2)) } }Rating0/0=0.00-0+
[ reply ]