// Path: src/main/java/nate/util/SortableObject.java
// public class SortableObject<E> implements Comparable<SortableObject<E>> {
//   double score = 0.0f;
//   E key;
// 
//   public SortableObject(double s, E k) {
//     score = s;
//     key = k;
//   }
//   public SortableObject() { }
// 
//   public int compareTo(SortableObject<E> b) {
//     if( b == null ) return -1;
//     if( score < b.score() ) return 1;
//     else if( b.score() < score ) return -1;
//     else return 0;
//   }
// 
//   public void setScore(double s) { score = s; }
//   public void setKey(E k) { key = k; }
// 
//   public double score() { return score; }
//   public E key() { return key; }
//   public String toString() {
//     return key + " " + score;
//   }
// }
// 
// Path: src/main/java/nate/util/SortableScore.java
// public class SortableScore implements Comparable<SortableScore> {
//   double score = 0.0f;
//   String key;
// 
//   public SortableScore(double s, String k) {
//     score = s;
//     key = k;
//   }
//   public SortableScore() { }
// 
//   public int compareTo(SortableScore b) {
//     if( b == null ) return -1;
//     if( score < ((SortableScore)b).score() ) return 1;
//     else if( ((SortableScore)b).score() > score ) return -1;
//     else return 0;
//   }
// 
//   public void setScore(double s) { score = s; }
//   public void setKey(String k) { key = k; }
// 
//   public double score() { return score; }
//   public String key() { return key; }
//   public String toString() {
//     return key + " " + score;
//   }
// }


import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import nate.util.SortableObject;
import nate.util.SortableScore;
  public void setTokenScores(Map<String,Double> scores) {
    if( _tokenScores == null ) _tokenScores = new HashMap<String, Double>();
    clear();
    for( Map.Entry<String, Double> entry : scores.entrySet() ) {
      String token = (String)entry.getKey();
      double score = entry.getValue();
      _tokenScores.put(token, score);
    }
    setTheTokenOrder();
  }
  
  public void setTokens(Collection<String> strs) {
    if( _tokenScores == null ) _tokenScores = new HashMap<String,Double>();
    clear();
    
    for( String str : strs )
      _tokenScores.put(str, 0.0);
    setTheTokenOrder();
  }
  
  /**
   * Uses the global token scores and sorts the key by their scores. Saves
   * the order in the token list _orderedByScore.
   */
  private void setTheTokenOrder() {
    if( _orderedByScore == null )
      _orderedByScore = new ArrayList<String>();
    else
      _orderedByScore.clear();

// Path: src/main/java/nate/util/SortableObject.java
// public class SortableObject<E> implements Comparable<SortableObject<E>> {
//   double score = 0.0f;
//   E key;
// 
//   public SortableObject(double s, E k) {
//     score = s;
//     key = k;
//   }
//   public SortableObject() { }
// 
//   public int compareTo(SortableObject<E> b) {
//     if( b == null ) return -1;
//     if( score < b.score() ) return 1;
//     else if( b.score() < score ) return -1;
//     else return 0;
//   }
// 
//   public void setScore(double s) { score = s; }
//   public void setKey(E k) { key = k; }
// 
//   public double score() { return score; }
//   public E key() { return key; }
//   public String toString() {
//     return key + " " + score;
//   }
// }
// 
// Path: src/main/java/nate/util/SortableScore.java
// public class SortableScore implements Comparable<SortableScore> {
//   double score = 0.0f;
//   String key;
// 
//   public SortableScore(double s, String k) {
//     score = s;
//     key = k;
//   }
//   public SortableScore() { }
// 
//   public int compareTo(SortableScore b) {
//     if( b == null ) return -1;
//     if( score < ((SortableScore)b).score() ) return 1;
//     else if( ((SortableScore)b).score() > score ) return -1;
//     else return 0;
//   }
// 
//   public void setScore(double s) { score = s; }
//   public void setKey(String k) { key = k; }
// 
//   public double score() { return score; }
//   public String key() { return key; }
//   public String toString() {
//     return key + " " + score;
//   }
// }


// Path: src/main/java/nate/probschemas/Frame.java
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import nate.util.SortableObject;
import nate.util.SortableScore;

  public void setTokenScores(Map<String,Double> scores) {
    if( _tokenScores == null ) _tokenScores = new HashMap<String, Double>();
    clear();
    for( Map.Entry<String, Double> entry : scores.entrySet() ) {
      String token = (String)entry.getKey();
      double score = entry.getValue();
      _tokenScores.put(token, score);
    }
    setTheTokenOrder();
  }
  
  public void setTokens(Collection<String> strs) {
    if( _tokenScores == null ) _tokenScores = new HashMap<String,Double>();
    clear();
    
    for( String str : strs )
      _tokenScores.put(str, 0.0);
    setTheTokenOrder();
  }
  
  /**
   * Uses the global token scores and sorts the key by their scores. Saves
   * the order in the token list _orderedByScore.
   */
  private void setTheTokenOrder() {
    if( _orderedByScore == null )
      _orderedByScore = new ArrayList<String>();
    else
      _orderedByScore.clear();

    SortableScore[] sorted = new SortableScore[_tokenScores.size()];