コード例 #1
0
  public String toString() {
    StringBuilder buffer = new StringBuilder();

    buffer.append("Hosts:     ").append(this.getHosts().size()).append("\n");
    buffer.append("Sites:     ").append(this.sites.size()).append("\n");
    buffer.append("Fragments: ").append(this.fragments.size()).append("\n");

    SortedSet<String> hosts = new TreeSet<String>();
    hosts.addAll(this.getHosts());

    for (String host_key : hosts) {
      buffer.append("\nHost ").append(CatalogKey.getNameFromKey(host_key)).append("\n");
      for (SiteEntry site : this.host_site_xref.get(host_key)) {
        buffer.append(SPACER).append("Site ").append(site.getId()).append("\n");
        for (FragmentEntry fragment : site.getFragments()) {
          buffer
              .append(SPACER)
              .append(SPACER)
              .append("Fragment ")
              .append(fragment)
              .append(" Size=")
              .append(fragment.getEstimatedSize())
              .append(" Heat=")
              .append(fragment.getEstimatedHeat())
              .append("\n");
        } // FOR
      } // FOR
      buffer.append("--------------------");
    } // FOR
    return (buffer.toString());
  }
コード例 #2
0
  /**
   * Merge the source SiteEntry into the target SiteEntry
   *
   * @param source
   * @param target
   */
  public void merge(SiteEntry source, SiteEntry target) {
    // Copy over all the fragments
    for (FragmentEntry fragment : source.getFragments()) {
      this.assign(target, fragment);
    } // FOR

    // Remove all references to the source SiteEntry
    this.site_id_xref.remove(source.getId());
    this.host_site_xref.get(source.getHostKey()).remove(source);
  }
コード例 #3
0
 /**
  * Assign the SiteEntry to a particular Host
  *
  * @param catalog_host
  * @param site
  */
 public void assign(Host catalog_host, SiteEntry site) {
   assert (catalog_host != null);
   assert (site != null);
   if (site.getHostKey() != null) {
     this.host_site_xref.get(site.getHostKey()).remove(site);
   }
   String host_key = CatalogKey.createKey(catalog_host);
   site.setHostKey(host_key);
   if (!this.host_site_xref.containsKey(host_key)) {
     this.host_site_xref.put(host_key, new TreeSet<SiteEntry>());
   }
   this.host_site_xref.get(host_key).add(site);
   this.site_id_xref.put(site.getId(), site);
   this.sites.add(site);
 }