/**
   * Private helper method for performing fast intersection.
   *
   * @param <E>
   * @param sortedData
   * @param sortedQueries
   * @param result
   */
  private static <E extends Comparable<E>> void fastIntersect(
      List<E> sortedData, List<E> sortedQueries, SortedSet<E> result) {

    int medianQueryIndex = sortedQueries.size() / 2;
    E medianQuery = sortedQueries.get(medianQueryIndex);

    int index = Collections.binarySearch(sortedData, medianQuery);

    if (index >= 0) {
      result.add(medianQuery);
    } else {
      index = (-1 * index) + 1;
    }

    if (index - 1 >= 0 && medianQueryIndex - 1 >= 0) {
      fastIntersect(
          sortedData.subList(0, index), sortedQueries.subList(0, medianQueryIndex), result);
    }

    if (index + 1 < sortedData.size() && medianQueryIndex + 1 < sortedQueries.size()) {
      fastIntersect(
          sortedData.subList(index + 1, sortedData.size()),
          sortedQueries.subList(medianQueryIndex + 1, sortedQueries.size()),
          result);
    }
  }
Beispiel #2
0
 /** @tests java.util.TreeSet#add(java.lang.Object) */
 public void test_addLjava_lang_Object() {
   // Test for method boolean java.util.TreeSet.add(java.lang.Object)
   ts.add(new Integer(-8));
   assertTrue("Failed to add Object", ts.contains(new Integer(-8)));
   ts.add(objArray[0]);
   assertTrue("Added existing element", ts.size() == objArray.length + 1);
 }
Beispiel #3
0
  /**
   * Takes a potentially non-sequential alignment and guesses a sequential version of it. Residues
   * from each structure are sorted sequentially and then compared directly.
   *
   * <p>The results of this method are consistent with what one might expect from an identity
   * function, and are therefore useful with {@link #getSymmetryOrder(Map, Map identity, int,
   * float)}.
   *
   * <ul>
   *   <li>Perfect self-alignments will have the same pre-image and image, so will map X->X
   *   <li>Gaps and alignment errors will cause errors in the resulting map, but only locally.
   *       Errors do not propagate through the whole alignment.
   * </ul>
   *
   * <h4>Example:</h4>
   *
   * A non sequential alignment, represented schematically as
   *
   * <pre>
   * 12456789
   * 78912345</pre>
   *
   * would result in a map
   *
   * <pre>
   * 12456789
   * 12345789</pre>
   *
   * @param alignment The non-sequential input alignment
   * @param inverseAlignment If false, map from structure1 to structure2. If true, generate the
   *     inverse of that map.
   * @return A mapping from sequential residues of one protein to those of the other
   * @throws IllegalArgumentException if the input alignment is not one-to-one.
   */
  public static Map<Integer, Integer> guessSequentialAlignment(
      Map<Integer, Integer> alignment, boolean inverseAlignment) {
    Map<Integer, Integer> identity = new HashMap<Integer, Integer>();

    SortedSet<Integer> aligned1 = new TreeSet<Integer>();
    SortedSet<Integer> aligned2 = new TreeSet<Integer>();

    for (Entry<Integer, Integer> pair : alignment.entrySet()) {
      aligned1.add(pair.getKey());
      if (!aligned2.add(pair.getValue()))
        throw new IllegalArgumentException(
            "Alignment is not one-to-one for residue "
                + pair.getValue()
                + " of the second structure.");
    }

    Iterator<Integer> it1 = aligned1.iterator();
    Iterator<Integer> it2 = aligned2.iterator();
    while (it1.hasNext()) {
      if (inverseAlignment) { // 2->1
        identity.put(it2.next(), it1.next());
      } else { // 1->2
        identity.put(it1.next(), it2.next());
      }
    }
    return identity;
  }
Beispiel #4
0
 public static File[] getDirectoryListing(File dir) {
   SortedSet<File> dirSet = new TreeSet<File>();
   SortedSet<File> fileSet = new TreeSet<File>();
   File[] files = dir.listFiles();
   for (int i = 0; i < files.length; i++) {
     if (files[i].isDirectory()) dirSet.add(files[i]);
     else fileSet.add(files[i]);
   }
   List<File> fileList = new LinkedList<File>();
   fileList.addAll(dirSet);
   fileList.addAll(fileSet);
   return fileList.toArray(new File[] {});
 }
Beispiel #5
0
  public static void main(String[] args) {
    System.setProperty("fr.umlv.jbucks.factory", BuckFactoryImpl.class.getName());

    BuckFactory factory = BuckFactory.getFactory();
    Book book = factory.createBook("test");
    System.out.println(book.getName());

    book.setUserData("hello-UID", "12345");
    System.out.println("hello-UID " + book.getUserDataValue("hello-UID"));

    EventManager manager = factory.getEventManager();

    manager.addListener(
        Book.class,
        "accounts",
        PropertyEvent.TYPE_PROPERTY_ADDED | PropertyEvent.TYPE_PROPERTY_REMOVED,
        new PropertyListener() {
          public void propertyChanged(PropertyEvent event) {
            System.out.println(event);
          }
        });

    Account account = factory.createAccount(book, "remi");
    factory.createAccount(book, "gilles");

    List list = book.getAccounts();

    System.out.println(list);

    SortedSet transactions = account.getTransactions();

    manager.addListener(
        Account.class,
        "transactions",
        PropertyEvent.TYPE_PROPERTY_ADDED | PropertyEvent.TYPE_PROPERTY_REMOVED,
        new PropertyListener() {
          public void propertyChanged(PropertyEvent event) {
            System.out.println("transaction " + event);
          }
        });

    Transaction transaction =
        factory.createTransaction(new Date().getTime(), Collections.EMPTY_LIST);
    transactions.add(transaction);

    SortedSet tailSet = transactions.tailSet(transaction);

    System.out.println(tailSet);

    tailSet.add(factory.createTransaction(transaction.getDate() + 1, Collections.EMPTY_LIST));
  }
Beispiel #6
0
  /**
   * Converts the form field values in the <tt>ffValuesIter</tt> into a caps string.
   *
   * @param ffValuesIter the {@link Iterator} containing the form field values.
   * @param capsBldr a <tt>StringBuilder</tt> to which the caps string representing the form field
   *     values is to be appended
   */
  private static void formFieldValuesToCaps(Iterator<String> ffValuesIter, StringBuilder capsBldr) {
    SortedSet<String> fvs = new TreeSet<String>();

    while (ffValuesIter.hasNext()) fvs.add(ffValuesIter.next());

    for (String fv : fvs) capsBldr.append(fv).append('<');
  }
  /** Set the contents of the field selector list. */
  private void setupFieldSelector() {
    fieldListModel.clear();
    SortedSet<String> contents = new TreeSet<String>();
    for (String s : metaData) {
      if (s.startsWith(Globals.SELECTOR_META_PREFIX)) {
        contents.add(s.substring(Globals.SELECTOR_META_PREFIX.length()));
      }
    }
    if (contents.size() == 0) {
      // if nothing was added, put the default fields (as described in the help)
      fieldListModel.addElement("author");
      fieldListModel.addElement("journal");
      fieldListModel.addElement("keywords");
      fieldListModel.addElement("publisher");
    } else {
      for (String s : contents) {
        fieldListModel.addElement(s);
      }
    }

    if (currentField == null) {
      // if dialog is created for the whole database,
      // select the first field to avoid confusions in GUI usage
      fieldList.setSelectedIndex(0);
    } else {
      // a specific field has been chosen at the constructur
      // select this field
      int i = fieldListModel.indexOf(currentField);
      if (i != -1) {
        // field has been found in list, select it
        fieldList.setSelectedIndex(i);
      }
    }
  }
Beispiel #8
0
  public static void RetrieveTrainMatrix() {
    try {
      BufferedReader flrdr =
          new BufferedReader(
              new FileReader("D:\\IR\\Assignment7\\Pytest\\part2\\output\\train_matrix.txt"));
      String line = "";
      int doc_count = 0;

      while ((line = flrdr.readLine()) != null) {
        SortedSet<Integer> word_ids = new TreeSet<Integer>();
        int val_count = 0;

        String[] key_value = line.split(" :: ");
        key_value[1] = key_value[1].substring(1, key_value[1].length() - 2);
        String[] values = key_value[1].split(",");

        FeatureNode[] node = new FeatureNode[values.length];

        for (String val : values) word_ids.add(Integer.parseInt(val.trim()));

        for (int val : word_ids) node[val_count++] = new FeatureNode(val, 1);

        if (spam_docs.contains(key_value[0].trim())) ylable[doc_count] = 1;
        else ylable[doc_count] = 0;

        train_matrix[doc_count++] = node;
      }
      flrdr.close();
    } catch (Exception e) {
      e.printStackTrace();
      System.exit(0);
    }
  }
Beispiel #9
0
 private void addRestriction(String name) {
   this.rowCount++;
   this.slackCount++;
   String slackName = "SLC" + slackCount;
   columns.add(slackName);
   writeToFile(name, slackName, Fraction.ONE);
 }
 @SuppressWarnings("EmptyCatchBlock")
 static void ensureNotDirectlyModifiable(SortedSet<Integer> unmod) {
   try {
     unmod.add(4);
     fail("UnsupportedOperationException expected");
   } catch (UnsupportedOperationException expected) {
   }
   try {
     unmod.remove(4);
     fail("UnsupportedOperationException expected");
   } catch (UnsupportedOperationException expected) {
   }
   try {
     unmod.addAll(Collections.singleton(4));
     fail("UnsupportedOperationException expected");
   } catch (UnsupportedOperationException expected) {
   }
   try {
     Iterator<Integer> iterator = unmod.iterator();
     iterator.next();
     iterator.remove();
     fail("UnsupportedOperationException expected");
   } catch (UnsupportedOperationException expected) {
   }
 }
Beispiel #11
0
  public List<Locale> getAvailableLanguages() {
    Locale[] locales = Locale.getAvailableLocales();
    Map<String, Locale> localeMap = new HashMap<String, Locale>();

    // remove all variants
    for (Locale locale : locales) {
      if (isTranslationsOnly()
          && !ArrayUtils.contains(config.getAvailableTranslations(), locale.getLanguage())) {
        continue;
      }

      if (localeMap.containsKey(locale.getLanguage())
          && locale.getDisplayName().indexOf('(') != -1) {
        continue;
      }

      localeMap.put(locale.getLanguage(), locale);
    }

    SortedSet<Locale> localeSet =
        new TreeSet<Locale>(new LocaleComparator(LocaleComparator.CompareType.LANGUAGE));

    for (Locale locale : localeMap.values()) {
      localeSet.add(locale);
    }

    return new ArrayList<Locale>(localeSet);
  }
Beispiel #12
0
  private void calculateArrowsForward(Node x, Node y, Graph graph) {
    clearArrow(x, y);

    if (!knowledgeEmpty()) {
      if (getKnowledge().isForbidden(x.getName(), y.getName())) {
        return;
      }
    }

    List<Node> naYX = getNaYX(x, y, graph);
    List<Node> t = getTNeighbors(x, y, graph);

    DepthChoiceGenerator gen = new DepthChoiceGenerator(t.size(), t.size());
    int[] choice;

    while ((choice = gen.next()) != null) {
      List<Node> s = GraphUtils.asList(choice, t);

      if (!knowledgeEmpty()) {
        if (!validSetByKnowledge(y, s)) {
          continue;
        }
      }

      double bump = insertEval(x, y, s, naYX, graph);

      if (bump > 0.0) {
        Arrow arrow = new Arrow(bump, x, y, s, naYX);
        sortedArrows.add(arrow);
        addLookupArrow(x, y, arrow);
      }
    }
  }
Beispiel #13
0
  public static void main(String[] args) throws Exception {
    // TODO Auto-generated method stub
    Date startTime = new Date();
    String fname = "p079_keylog.txt";
    FileReader fr = new FileReader(fname);
    BufferedReader br = new BufferedReader(fr);
    SortedSet<String> slines = new TreeSet<String>();
    String line = "";

    while ((line = br.readLine()) != null) {
      slines.add(line);
    }

    String start = slines.first().split("")[0];

    String ans = "";

    for (String l : slines) {
      // System.out.println(l);
      for (String l2 : slines) {
        if (l2.contains(start) && l2.indexOf(start) > 0) start = l2.split("")[0];
      }
    }
    ans += start;
    // System.out.println(ans);
    for (int i = 0; i < 10; i++) {
      start = (getNext(slines, start));
      if (start == null) break;
      ans += start;
      // System.out.println(ans);
    }
    Date endTime = new Date();
    System.out.println(ans + " in " + (endTime.getTime() - startTime.getTime()) + " ms.");
  }
 /**
  * Gets the unique read groups in the table
  *
  * @param report the GATKReport containing the table with RecalUtils.READGROUP_REPORT_TABLE_TITLE
  * @return the unique read groups
  */
 private static SortedSet<String> getReadGroups(final GATKReport report) {
   final GATKReportTable reportTable = report.getTable(RecalUtils.READGROUP_REPORT_TABLE_TITLE);
   final SortedSet<String> readGroups = new TreeSet<String>();
   for (int i = 0; i < reportTable.getNumRows(); i++)
     readGroups.add(reportTable.get(i, RecalUtils.READGROUP_COLUMN_NAME).toString());
   return readGroups;
 }
  @SuppressWarnings("unchecked")
  public List<ChoiceListValue> getChoiceListValues(
      ExtendedPropertyDefinition epd,
      String param,
      List<ChoiceListValue> values,
      Locale locale,
      Map<String, Object> context) {
    final SortedSet<ChoiceListValue> listValues = new TreeSet<ChoiceListValue>();
    if (StringUtils.isEmpty(param)) {
      param = "jmix:editorialContent";
    }
    try {
      String includedTypes = StringUtils.substringBefore(param, ";");

      Set<String> excludedTypes = new HashSet<String>();
      String exclusion = StringUtils.substringAfter(param, ";");
      if (StringUtils.isNotBlank(exclusion)) {
        excludedTypes.addAll(
            CollectionUtils.collect(
                Arrays.asList(StringUtils.substringAfter(param, ";").split(",")),
                new Transformer() {
                  public Object transform(Object input) {
                    return ((String) input).trim();
                  }
                }));
      }

      for (String nodeTypeName : includedTypes.split(",")) {
        nodeTypeName = nodeTypeName.trim();
        ExtendedNodeType nodeType = NodeTypeRegistry.getInstance().getNodeType(nodeTypeName);
        if (!isExcludedType(nodeType, excludedTypes)) {
          listValues.add(new ChoiceListValue(nodeType.getLabel(locale), nodeType.getName()));
        }
        NodeTypeIterator nti = nodeType.getSubtypes();
        while (nti.hasNext()) {
          ExtendedNodeType type = (ExtendedNodeType) nti.next();
          if (!isExcludedType(type, excludedTypes)) {
            listValues.add(new ChoiceListValue(type.getLabel(locale), type.getName()));
          }
        }
      }
    } catch (NoSuchNodeTypeException e) {
      logger.error("Cannot get type", e);
    }

    return new LinkedList<ChoiceListValue>(listValues);
  }
Beispiel #16
0
 public void registerValue(String column, String row, double value) {
   Fraction fraction = toFraction(value);
   if (toReverse.contains(row)) {
     fraction = fraction.negate();
   }
   columns.add(column);
   writeToFile(row, column, fraction);
 }
Beispiel #17
0
 static SortedSet<TypeColorEntry> fromPainter(myjava.gui.syntax.Painter painter) {
   Token.Type[] types = Token.Type.values();
   SortedSet<TypeColorEntry> entries = new TreeSet<>();
   for (Token.Type type : types) {
     entries.add(new TypeColorEntry(type, painter.fromType(type)));
   }
   return entries;
 }
 private Set<Sector> getNeighbors(Sector[] sectors) {
   SortedSet<Sector> neighbors = new TreeSet<Sector>(ELEMENT_ORDER);
   for (Sector s : sectors) {
     if (s != null) {
       neighbors.add(s);
     }
   }
   return neighbors;
 }
 /** @return the repeatable scripts that failed during the last database update */
 protected SortedSet<ExecutedScript> getRepeatableScriptsThatFailedDuringLastUpdate() {
   SortedSet<ExecutedScript> failedExecutedScripts = new TreeSet<ExecutedScript>();
   for (ExecutedScript script : executedScriptInfoSource.getExecutedScripts()) {
     if (!script.isSuccessful() && script.getScript().isRepeatable()) {
       failedExecutedScripts.add(script);
     }
   }
   return failedExecutedScripts;
 }
Beispiel #20
0
 /**
  * Sets up the fixture, for example, open a network connection. This method is called before a
  * test is executed.
  */
 public void setUp() throws Exception {
   super.setUp();
   db = newBaseRecordManager();
   ts = db.createTreeSet("testBTreeSet");
   for (int i = 0; i < objArray.length; i++) {
     Object x = objArray[i] = new Integer(i);
     ts.add(x);
   }
 }
  @Test
  public void simpleQueryWithRangeTombstoneTest() throws Exception {
    Table table = Table.open(KSNAME);
    ColumnFamilyStore cfs = table.getColumnFamilyStore(CFNAME);

    // Inserting data
    String key = "k1";
    RowMutation rm;
    ColumnFamily cf;

    rm = new RowMutation(KSNAME, ByteBufferUtil.bytes(key));
    for (int i = 0; i < 40; i += 2) add(rm, i, 0);
    rm.apply();
    cfs.forceBlockingFlush();

    rm = new RowMutation(KSNAME, ByteBufferUtil.bytes(key));
    cf = rm.addOrGet(CFNAME);
    delete(cf, 10, 22, 1);
    rm.apply();
    cfs.forceBlockingFlush();

    rm = new RowMutation(KSNAME, ByteBufferUtil.bytes(key));
    for (int i = 1; i < 40; i += 2) add(rm, i, 2);
    rm.apply();
    cfs.forceBlockingFlush();

    rm = new RowMutation(KSNAME, ByteBufferUtil.bytes(key));
    cf = rm.addOrGet(CFNAME);
    delete(cf, 19, 27, 3);
    rm.apply();
    // We don't flush to test with both a range tomsbtone in memtable and in sstable

    QueryPath path = new QueryPath(CFNAME);

    // Queries by name
    int[] live = new int[] {4, 9, 11, 17, 28};
    int[] dead = new int[] {12, 19, 21, 24, 27};
    SortedSet<ByteBuffer> columns = new TreeSet<ByteBuffer>(cfs.getComparator());
    for (int i : live) columns.add(b(i));
    for (int i : dead) columns.add(b(i));
    cf = cfs.getColumnFamily(QueryFilter.getNamesFilter(dk(key), path, columns));

    for (int i : live) assert isLive(cf, cf.getColumn(b(i))) : "Column " + i + " should be live";
    for (int i : dead)
      assert !isLive(cf, cf.getColumn(b(i))) : "Column " + i + " shouldn't be live";

    // Queries by slices
    cf =
        cfs.getColumnFamily(
            QueryFilter.getSliceFilter(dk(key), path, b(7), b(30), false, Integer.MAX_VALUE));

    for (int i : new int[] {7, 8, 9, 11, 13, 15, 17, 28, 29, 30})
      assert isLive(cf, cf.getColumn(b(i))) : "Column " + i + " should be live";
    for (int i : new int[] {10, 12, 14, 16, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27})
      assert !isLive(cf, cf.getColumn(b(i))) : "Column " + i + " shouldn't be live";
  }
Beispiel #22
0
 /**
  * The earliest start date of this research staff.
  *
  * @return the active date
  */
 @Transient
 public Date getActiveDate() {
   SortedSet<Date> dates = new TreeSet<Date>();
   for (SiteResearchStaff srs : this.getSiteResearchStaffs()) {
     Date activeDate = srs.getActiveDate();
     if (activeDate != null) dates.add(activeDate);
   }
   if (dates.size() > 0) return dates.first();
   else return null;
 }
    @Override
    protected SortedSet<Long> compute() {
      SortedSet<Long> index = new TreeSet<>();
      try {
        if (length < threshold) {
          BufferedAccessFile raf = null;
          try {
            raf = new BufferedAccessFile(file, "r");
            raf.seek(start);

            // Add the position for 1st line
            if (raf.getFilePointer() == 0L) {
              index.add(raf.getFilePointer());
            }
            while (raf.getFilePointer() < end) {
              raf.getNextLine();
              index.add(raf.getFilePointer());
            }
          } finally {
            if (raf != null) {
              raf.close();
            }
          }
        } else {
          long start1 = start;
          long end1 = start + (length / 2);

          long end2 = end;

          IndexingTask task1 = new IndexingTask(file, start1, end1, threshold);
          task1.fork();
          IndexingTask task2 = new IndexingTask(file, end1, end2, threshold);

          index.addAll(task2.compute());
          index.addAll(task1.join());
        }
      } catch (IOException ex) {
        throw new FileReaderException("Error while index file:" + ex.getMessage(), ex);
      }

      return index;
    }
Beispiel #24
0
  // assumes o is in satisfiers \ exceptions
  private int getIndexInPOPApp(ObjectSet satisfiers, Set exceptions, Object o) {
    SortedSet exceptionIndices = new TreeSet();
    for (Iterator iter = exceptions.iterator(); iter.hasNext(); ) {
      Object exception = iter.next();
      exceptionIndices.add(new Integer(satisfiers.indexOf(exception)));
    }

    int origIndex = satisfiers.indexOf(o);
    int numExceptionsBefore = exceptionIndices.headSet(new Integer(origIndex)).size();
    return (origIndex - numExceptionsBefore);
  }
  /** Scratch method for Lane to work on Fast Intersection */
  public static void fastIntersection() {

    SortedSet<Integer> setA = new TreeSet<Integer>();
    SortedSet<Integer> setB = new TreeSet<Integer>();

    Random rand = new Random();

    for (int i = 0; i < 100000; i++) {
      setA.add(rand.nextInt());
    }

    List<Integer> dataSet = new ArrayList<Integer>(setA);

    for (int i = 0; i < 50; i++) {
      setB.add(rand.nextInt());
      setB.add(dataSet.get(rand.nextInt(setA.size())));
    }

    List<Integer> querySet = new ArrayList<Integer>(setB);

    // for (int i=0, n=dataSet.size(); i < n; i++, n++) dataSet.get(i);

    // Calculate intersection

    // List<Integer> intersection = new ArrayList<Integer>();
    /*
    for (int query : querySet) {
    	//System.out.println("Querying for " + query);
    	if (Collections.binarySearch(dataSet, query) >= 0) {
    		intersection.add(query);
    	}
    }
    */

    SortedSet<Integer> intersection = new TreeSet<Integer>();

    fastIntersect(dataSet, querySet, intersection);

    System.out.println(intersection.size());
    // int medianQuery = querySet.get(querySet.size()/2);
  }
  @Test
  public void initConstructor() {
    WatchListItem watchListItem1 = new WatchListItem("AAPL");
    WatchListItem watchListItem2 = new WatchListItem("ORCL");

    SortedSet<WatchListItem> techList = new TreeSet<WatchListItem>();
    techList.add(watchListItem1);
    techList.add(watchListItem2);
    WatchList watchList = new WatchList("technology", techList);
    watchList.getItems().add(watchListItem1);
    watchList.getItems().add(watchListItem2);
  }
Beispiel #27
0
  /**
   * Returns all supported sample rates.
   *
   * @return an array of sample rates, in Hertz, never <code>null</code>.
   */
  public Integer[] getSampleRates() {
    final String rawValue = this.properties.get(DEVICE_SAMPLERATES);
    final String[] values = rawValue.split(",\\s*");
    final SortedSet<Integer> result =
        new TreeSet<Integer>(
            NumberUtils.<Integer>createNumberComparator(false /* aSortAscending */));
    for (String value : values) {
      result.add(Integer.valueOf(value.trim()));
    }

    return result.toArray(new Integer[result.size()]);
  }
Beispiel #28
0
 /** @tests java.util.TreeSet#TreeSet(java.util.Comparator) */
 public void test_ConstructorLjava_util_Comparator() {
   // Test for method java.util.TreeSet(java.util.Comparator)
   SortedSet myTreeSet = db.createTreeSet("test", new ReversedIntegerComparator(), null);
   assertTrue("Did not construct correct TreeSet", myTreeSet.isEmpty());
   myTreeSet.add(new Integer(1));
   myTreeSet.add(new Integer(2));
   assertTrue(
       "Answered incorrect first element--did not use custom comparator ",
       myTreeSet.first().equals(new Integer(2)));
   assertTrue(
       "Answered incorrect last element--did not use custom comparator ",
       myTreeSet.last().equals(new Integer(1)));
 }
Beispiel #29
0
  private void storeGraph(Graph graph) {
    if (numPatternsToStore < 1) return;

    if (topGraphs.isEmpty() || score > topGraphs.first().getScore()) {
      Graph graphCopy = new EdgeListGraphSingleConnections(graph);

      topGraphs.add(new ScoredGraph(graphCopy, score));

      if (topGraphs.size() > getNumPatternsToStore()) {
        topGraphs.remove(topGraphs.first());
      }
    }
  }
  private void configChanged(String activeConfig) {
    DefaultComboBoxModel model = new DefaultComboBoxModel();
    model.addElement("");
    SortedSet<String> alphaConfigs =
        new TreeSet<String>(
            new Comparator<String>() {
              Collator coll = Collator.getInstance();

              public int compare(String s1, String s2) {
                return coll.compare(label(s1), label(s2));
              }

              private String label(String c) {
                Map<String, String> m = configs.get(c);
                String label = m.get("$label"); // NOI18N
                return label != null ? label : c;
              }
            });
    for (Map.Entry<String, Map<String, String>> entry : configs.entrySet()) {
      String config = entry.getKey();
      if (config != null && entry.getValue() != null) {
        alphaConfigs.add(config);
      }
    }
    for (String c : alphaConfigs) {
      model.addElement(c);
    }
    configCombo.setModel(model);
    configCombo.setSelectedItem(activeConfig != null ? activeConfig : "");
    Map<String, String> m = configs.get(activeConfig);
    Map<String, String> def = configs.get(null);
    if (m != null) {
      // BEGIN Deprecated
      if (compProviderDeprecated != null) {
        compProviderDeprecated.configUpdated(m);
      }
      // END Deprecated
      for (J2SECategoryExtensionProvider compProvider : compProviders) {
        compProvider.configUpdated(m);
      }
      for (int i = 0; i < data.length; i++) {
        String v = m.get(keys[i]);
        if (v == null) {
          // display default value
          v = def.get(keys[i]);
        }
        data[i].setText(v);
      }
    } // else ??
    configDel.setEnabled(activeConfig != null);
  }