Changeset 1198


Ignore:
Timestamp:
Jul 10, 2011, 9:23:36 PM (6 years ago)
Author:
stefan
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/src/jlatexeditor/tools/PackageUsageCounter.scala

    r1197 r1198  
    1717 */
    1818object  PackageUsageCounter {
     19  val FILE_NAME = "packageUsageCounts.properties"
    1920  val CODE_SEARCH_FEEDS_URL = "https://www.google.com/codesearch/feeds/search?"
    2021  val codeSearchService = new CodeSearchService("gdata-sample-codesearch")
     22
     23  lazy val packages2usageCount = {
     24    val properties = new Properties()
     25    properties.load(new FileInputStream(FILE_NAME))
     26    val lastValue = new HashMap[String, String]()
     27    for (entry <- properties.entrySet()) {
     28      lastValue += entry.getKey.toString -> entry.getValue.toString
     29    }
     30    lastValue
     31  }
    2132
    2233  def main(args: Array[String]) {
    2334    val packages = (XML.loadFile("packages.xml") \ "package").map(node => (node \ "@name").text).sortBy(x => x).distinct
    2435
    25     val properties = new Properties()
    26     properties.load(new FileInputStream("packageUsageCounts.properties"))
    27     val lastValue = new HashMap[String, String]()
    28     for (entry <- properties.entrySet()) {
    29       lastValue += entry.getKey.toString -> entry.getValue.toString
    30     }
     36    val lastValue = packages2usageCount
    3137
    32     val out = new PrintStream("packageUsageCounts.properties");
     38    val out = new PrintStream(FILE_NAME);
    3339
    3440    try {
Note: See TracChangeset for help on using the changeset viewer.