//# 1 errors, 653 messages
//#
/*
    //#tagindex.java:1:1: class: net.sourceforge.pebble.index.TagIndex
 * Copyright (c) 2003-2006, Simon Brown
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 *   - Redistributions of source code must retain the above copyright
 *     notice, this list of conditions and the following disclaimer.
 *
 *   - Redistributions in binary form must reproduce the above copyright
 *     notice, this list of conditions and the following disclaimer in
 *     the documentation and/or other materials provided with the
 *     distribution.
 *
 *   - Neither the name of Pebble nor the names of its contributors may
 *     be used to endorse or promote products derived from this software
 *     without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */
package net.sourceforge.pebble.index;

import net.sourceforge.pebble.domain.Blog;
import net.sourceforge.pebble.domain.BlogEntry;
import net.sourceforge.pebble.domain.Tag;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import java.io.*;
import java.util.*;

/**
 * Represents the tag index for a blog.
 *
 * @author    Simon Brown
 */
public class TagIndex {

  private static final Log log = LogFactory.getLog(TagIndex.class);
    //#tagindex.java:50: method: net.sourceforge.pebble.index.TagIndex.net.sourceforge.pebble.index.TagIndex__static_init
    //#tagindex.java:50: Warning: method not available
    //#    -- call on Log org.apache.commons.logging.LogFactory:getLog(Class)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.index.TagIndex
    //#    method: net.sourceforge.pebble.index.TagIndex__static_init
    //#    unanalyzed callee: Log org.apache.commons.logging.LogFactory:getLog(Class)
    //#output(net.sourceforge.pebble.index.TagIndex__static_init): __Descendant_Table[net/sourceforge/pebble/index/TagIndex]
    //#output(net.sourceforge.pebble.index.TagIndex__static_init): __Dispatch_Table.clear()V
    //#output(net.sourceforge.pebble.index.TagIndex__static_init): __Dispatch_Table.getRecentBlogEntries(Lnet/sourceforge/pebble/domain/Tag;)Ljava/util/List;
    //#output(net.sourceforge.pebble.index.TagIndex__static_init): __Dispatch_Table.getTag(Ljava/lang/String;)Lnet/sourceforge/pebble/index/IndexedTag;
    //#output(net.sourceforge.pebble.index.TagIndex__static_init): __Dispatch_Table.getTags()Ljava/util/List;
    //#output(net.sourceforge.pebble.index.TagIndex__static_init): __Dispatch_Table.index(Ljava/util/Collection;)V
    //#output(net.sourceforge.pebble.index.TagIndex__static_init): __Dispatch_Table.index(Lnet/sourceforge/pebble/domain/BlogEntry;)V
    //#output(net.sourceforge.pebble.index.TagIndex__static_init): __Dispatch_Table.readIndex()V
    //#output(net.sourceforge.pebble.index.TagIndex__static_init): __Dispatch_Table.recalculateTagRankings()V
    //#output(net.sourceforge.pebble.index.TagIndex__static_init): __Dispatch_Table.unindex(Lnet/sourceforge/pebble/domain/BlogEntry;)V
    //#output(net.sourceforge.pebble.index.TagIndex__static_init): __Dispatch_Table.writeIndex()V
    //#output(net.sourceforge.pebble.index.TagIndex__static_init): log
    //#post(net.sourceforge.pebble.index.TagIndex__static_init): __Descendant_Table[net/sourceforge/pebble/index/TagIndex] == &__Dispatch_Table
    //#post(net.sourceforge.pebble.index.TagIndex__static_init): __Dispatch_Table.clear()V == &clear
    //#post(net.sourceforge.pebble.index.TagIndex__static_init): __Dispatch_Table.getRecentBlogEntries(Lnet/sourceforge/pebble/domain/Tag;)Ljava/util/List; == &getRecentBlogEntries
    //#post(net.sourceforge.pebble.index.TagIndex__static_init): __Dispatch_Table.getTag(Ljava/lang/String;)Lnet/sourceforge/pebble/index/IndexedTag; == &getTag
    //#post(net.sourceforge.pebble.index.TagIndex__static_init): __Dispatch_Table.getTags()Ljava/util/List; == &getTags
    //#post(net.sourceforge.pebble.index.TagIndex__static_init): __Dispatch_Table.index(Ljava/util/Collection;)V == &index
    //#post(net.sourceforge.pebble.index.TagIndex__static_init): __Dispatch_Table.index(Lnet/sourceforge/pebble/domain/BlogEntry;)V == &index
    //#post(net.sourceforge.pebble.index.TagIndex__static_init): __Dispatch_Table.readIndex()V == &readIndex
    //#post(net.sourceforge.pebble.index.TagIndex__static_init): __Dispatch_Table.recalculateTagRankings()V == &recalculateTagRankings
    //#post(net.sourceforge.pebble.index.TagIndex__static_init): __Dispatch_Table.unindex(Lnet/sourceforge/pebble/domain/BlogEntry;)V == &unindex
    //#post(net.sourceforge.pebble.index.TagIndex__static_init): __Dispatch_Table.writeIndex()V == &writeIndex
    //#post(net.sourceforge.pebble.index.TagIndex__static_init): init'ed(log)
    //#tagindex.java:50: end of method: net.sourceforge.pebble.index.TagIndex.net.sourceforge.pebble.index.TagIndex__static_init

  private Blog blog;

  /** the map containing the tags */
  private Map<String,IndexedTag> tags = new HashMap<String,IndexedTag>();

  /** a view onto the map, ordered by tag name */
  private List<Tag> orderedTags = new ArrayList<Tag>();

  public TagIndex(Blog blog) {
    //#tagindex.java:60: method: void net.sourceforge.pebble.index.TagIndex.net.sourceforge.pebble.index.TagIndex(Blog)
    //#input(void net.sourceforge.pebble.index.TagIndex(Blog)): __Descendant_Table[net/sourceforge/pebble/index/TagIndex]
    //#input(void net.sourceforge.pebble.index.TagIndex(Blog)): __Descendant_Table[others]
    //#input(void net.sourceforge.pebble.index.TagIndex(Blog)): __Dispatch_Table.getTag(Ljava/lang/String;)Lnet/sourceforge/pebble/index/IndexedTag;
    //#input(void net.sourceforge.pebble.index.TagIndex(Blog)): blog
    //#input(void net.sourceforge.pebble.index.TagIndex(Blog)): log
    //#input(void net.sourceforge.pebble.index.TagIndex(Blog)): net/sourceforge/pebble/domain/Tag.__Descendant_Table[net/sourceforge/pebble/domain/Tag]
    //#input(void net.sourceforge.pebble.index.TagIndex(Blog)): net/sourceforge/pebble/domain/Tag.__Descendant_Table[net/sourceforge/pebble/index/IndexedTag]
    //#input(void net.sourceforge.pebble.index.TagIndex(Blog)): net/sourceforge/pebble/domain/Tag.__Descendant_Table[others]
    //#input(void net.sourceforge.pebble.index.TagIndex(Blog)): net/sourceforge/pebble/domain/Tag.__Dispatch_Table.setName(Ljava/lang/String;)V
    //#input(void net.sourceforge.pebble.index.TagIndex(Blog)): net/sourceforge/pebble/index/IndexedTag.__Descendant_Table[net/sourceforge/pebble/index/IndexedTag]
    //#input(void net.sourceforge.pebble.index.TagIndex(Blog)): net/sourceforge/pebble/index/IndexedTag.__Descendant_Table[others]
    //#input(void net.sourceforge.pebble.index.TagIndex(Blog)): net/sourceforge/pebble/index/IndexedTag.__Dispatch_Table.addBlogEntry(Ljava/lang/String;)V
    //#input(void net.sourceforge.pebble.index.TagIndex(Blog)): net/sourceforge/pebble/index/IndexedTag.__Dispatch_Table.calculateRank([I)V
    //#input(void net.sourceforge.pebble.index.TagIndex(Blog)): net/sourceforge/pebble/index/IndexedTag.__Dispatch_Table.getNumberOfBlogEntries()I
    //#input(void net.sourceforge.pebble.index.TagIndex(Blog)): net/sourceforge/pebble/index/IndexedTag.__Dispatch_Table.setName(Ljava/lang/String;)V
    //#input(void net.sourceforge.pebble.index.TagIndex(Blog)): this
    //#input(void net.sourceforge.pebble.index.TagIndex(Blog)): this.__Tag
    //#output(void net.sourceforge.pebble.index.TagIndex(Blog)): new ArrayList(TagIndex#2) num objects
    //#output(void net.sourceforge.pebble.index.TagIndex(Blog)): new ArrayList(recalculateTagRankings#2) num objects
    //#output(void net.sourceforge.pebble.index.TagIndex(Blog)): new HashMap(TagIndex#1) num objects
    //#output(void net.sourceforge.pebble.index.TagIndex(Blog)): this.__Tag
    //#output(void net.sourceforge.pebble.index.TagIndex(Blog)): this.blog
    //#output(void net.sourceforge.pebble.index.TagIndex(Blog)): this.orderedTags
    //#output(void net.sourceforge.pebble.index.TagIndex(Blog)): this.tags
    //#new obj(void net.sourceforge.pebble.index.TagIndex(Blog)): new ArrayList(TagIndex#2)
    //#new obj(void net.sourceforge.pebble.index.TagIndex(Blog)): new ArrayList(recalculateTagRankings#2)
    //#new obj(void net.sourceforge.pebble.index.TagIndex(Blog)): new HashMap(TagIndex#1)
    //#pre[1] (void net.sourceforge.pebble.index.TagIndex(Blog)): blog != null
    //#pre[2] (void net.sourceforge.pebble.index.TagIndex(Blog)): (soft) this.__Tag == net/sourceforge/pebble/index/TagIndex
    //#post(void net.sourceforge.pebble.index.TagIndex(Blog)): (soft) this.__Tag == net/sourceforge/pebble/index/TagIndex
    //#post(void net.sourceforge.pebble.index.TagIndex(Blog)): this.blog == blog
    //#post(void net.sourceforge.pebble.index.TagIndex(Blog)): this.blog != null
    //#post(void net.sourceforge.pebble.index.TagIndex(Blog)): this.orderedTags == One-of{&new ArrayList(TagIndex#2), &new ArrayList(recalculateTagRankings#2)}
    //#post(void net.sourceforge.pebble.index.TagIndex(Blog)): this.orderedTags in Addr_Set{&new ArrayList(TagIndex#2),&new ArrayList(recalculateTagRankings#2)}
    //#post(void net.sourceforge.pebble.index.TagIndex(Blog)): this.tags == &new HashMap(TagIndex#1)
    //#post(void net.sourceforge.pebble.index.TagIndex(Blog)): new ArrayList(TagIndex#2) num objects == 1
    //#post(void net.sourceforge.pebble.index.TagIndex(Blog)): new HashMap(TagIndex#1) num objects == 1
    //#post(void net.sourceforge.pebble.index.TagIndex(Blog)): new ArrayList(recalculateTagRankings#2) num objects <= 1
    //#unanalyzed(void net.sourceforge.pebble.index.TagIndex(Blog)): Effects-of-calling:encode
    //#unanalyzed(void net.sourceforge.pebble.index.TagIndex(Blog)): Effects-of-calling:java.util.Map:get
    //#unanalyzed(void net.sourceforge.pebble.index.TagIndex(Blog)): Effects-of-calling:net.sourceforge.pebble.index.IndexedTag
    //#unanalyzed(void net.sourceforge.pebble.index.TagIndex(Blog)): Effects-of-calling:java.util.Map:put
    //#unanalyzed(void net.sourceforge.pebble.index.TagIndex(Blog)): Effects-of-calling:java.util.Map:values
    //#unanalyzed(void net.sourceforge.pebble.index.TagIndex(Blog)): Effects-of-calling:java.util.Collection:iterator
    //#unanalyzed(void net.sourceforge.pebble.index.TagIndex(Blog)): Effects-of-calling:java.util.Iterator:hasNext
    //#unanalyzed(void net.sourceforge.pebble.index.TagIndex(Blog)): Effects-of-calling:java.util.Iterator:next
    //#unanalyzed(void net.sourceforge.pebble.index.TagIndex(Blog)): Effects-of-calling:addBlogEntry
    //#unanalyzed(void net.sourceforge.pebble.index.TagIndex(Blog)): Effects-of-calling:java.util.Map:size
    //#unanalyzed(void net.sourceforge.pebble.index.TagIndex(Blog)): Effects-of-calling:getNumberOfBlogEntries
    //#unanalyzed(void net.sourceforge.pebble.index.TagIndex(Blog)): Effects-of-calling:java.lang.Math:round
    //#unanalyzed(void net.sourceforge.pebble.index.TagIndex(Blog)): Effects-of-calling:java.util.ArrayList
    //#unanalyzed(void net.sourceforge.pebble.index.TagIndex(Blog)): Effects-of-calling:calculateRank
    //#unanalyzed(void net.sourceforge.pebble.index.TagIndex(Blog)): Effects-of-calling:java.util.List:add
    //#unanalyzed(void net.sourceforge.pebble.index.TagIndex(Blog)): Effects-of-calling:java.util.Collections:sort
    //#unanalyzed(void net.sourceforge.pebble.index.TagIndex(Blog)): Effects-of-calling:net.sourceforge.pebble.domain.Blog:getIndexesDirectory
    //#unanalyzed(void net.sourceforge.pebble.index.TagIndex(Blog)): Effects-of-calling:java.io.File
    //#unanalyzed(void net.sourceforge.pebble.index.TagIndex(Blog)): Effects-of-calling:org.apache.commons.logging.Log:error
    //#unanalyzed(void net.sourceforge.pebble.index.TagIndex(Blog)): Effects-of-calling:java.io.File:exists
    //#unanalyzed(void net.sourceforge.pebble.index.TagIndex(Blog)): Effects-of-calling:java.io.FileReader
    //#unanalyzed(void net.sourceforge.pebble.index.TagIndex(Blog)): Effects-of-calling:java.io.BufferedReader
    //#unanalyzed(void net.sourceforge.pebble.index.TagIndex(Blog)): Effects-of-calling:java.io.BufferedReader:readLine
    //#unanalyzed(void net.sourceforge.pebble.index.TagIndex(Blog)): Effects-of-calling:java.lang.String:split
    //#unanalyzed(void net.sourceforge.pebble.index.TagIndex(Blog)): Effects-of-calling:java.io.BufferedReader:close
    //#unanalyzed(void net.sourceforge.pebble.index.TagIndex(Blog)): Effects-of-calling:java.lang.String:trim
    //#unanalyzed(void net.sourceforge.pebble.index.TagIndex(Blog)): Effects-of-calling:java.lang.String:toLowerCase
    //#unanalyzed(void net.sourceforge.pebble.index.TagIndex(Blog)): Effects-of-calling:java.lang.String:replaceAll
    //#unanalyzed(void net.sourceforge.pebble.index.TagIndex(Blog)): Effects-of-calling:java.util.List:contains
    //#unanalyzed(void net.sourceforge.pebble.index.TagIndex(Blog)): Effects-of-calling:java.util.List:size
    this.blog = blog;

    readIndex();
    recalculateTagRankings();
  }
    //#tagindex.java:65: end of method: void net.sourceforge.pebble.index.TagIndex.net.sourceforge.pebble.index.TagIndex(Blog)

  /**
   * Clears the index.
   */
  public void clear() {
    tags = new HashMap<String,IndexedTag>();
    //#tagindex.java:71: method: void net.sourceforge.pebble.index.TagIndex.clear()
    //#input(void clear()): log
    //#input(void clear()): net/sourceforge/pebble/index/IndexedTag.__Descendant_Table[net/sourceforge/pebble/index/IndexedTag]
    //#input(void clear()): net/sourceforge/pebble/index/IndexedTag.__Descendant_Table[others]
    //#input(void clear()): net/sourceforge/pebble/index/IndexedTag.__Dispatch_Table.getBlogEntries()Ljava/util/List;
    //#input(void clear()): net/sourceforge/pebble/index/IndexedTag.__Dispatch_Table.getName()Ljava/lang/String;
    //#input(void clear()): this
    //#input(void clear()): this.blog
    //#output(void clear()): new HashMap(clear#1) num objects
    //#output(void clear()): this.tags
    //#new obj(void clear()): new HashMap(clear#1)
    //#pre[2] (void clear()): (soft) this.blog != null
    //#post(void clear()): this.tags == &new HashMap(clear#1)
    //#post(void clear()): new HashMap(clear#1) num objects == 1
    //#unanalyzed(void clear()): Effects-of-calling:java.util.Map:values
    //#unanalyzed(void clear()): Effects-of-calling:java.util.Collection:iterator
    //#unanalyzed(void clear()): Effects-of-calling:java.util.Iterator:hasNext
    //#unanalyzed(void clear()): Effects-of-calling:java.util.Iterator:next
    //#unanalyzed(void clear()): Effects-of-calling:getName
    //#unanalyzed(void clear()): Effects-of-calling:java.util.List:iterator
    //#unanalyzed(void clear()): Effects-of-calling:getBlogEntries
    //#unanalyzed(void clear()): Effects-of-calling:net.sourceforge.pebble.domain.Blog:getIndexesDirectory
    //#unanalyzed(void clear()): Effects-of-calling:java.io.File
    //#unanalyzed(void clear()): Effects-of-calling:java.io.FileWriter
    //#unanalyzed(void clear()): Effects-of-calling:java.io.BufferedWriter
    //#unanalyzed(void clear()): Effects-of-calling:java.io.BufferedWriter:write
    //#unanalyzed(void clear()): Effects-of-calling:java.io.BufferedWriter:newLine
    //#unanalyzed(void clear()): Effects-of-calling:java.io.BufferedWriter:flush
    //#unanalyzed(void clear()): Effects-of-calling:java.io.BufferedWriter:close
    //#unanalyzed(void clear()): Effects-of-calling:org.apache.commons.logging.Log:error
    //#unanalyzed(void clear()): Effects-of-calling:java.util.ArrayList
    writeIndex();
  }
    //#tagindex.java:73: end of method: void net.sourceforge.pebble.index.TagIndex.clear()

  /**
   * Indexes one or more blog entries.
   *
   * @param blogEntries   a List of BlogEntry instances
   */
  public synchronized void index(Collection<BlogEntry> blogEntries) {
    for (BlogEntry blogEntry : blogEntries) {
    //#tagindex.java:81: method: void net.sourceforge.pebble.index.TagIndex.index(Collection)
    //#input(void index(Collection)): __Descendant_Table[net/sourceforge/pebble/index/TagIndex]
    //#input(void index(Collection)): __Descendant_Table[others]
    //#input(void index(Collection)): __Dispatch_Table.getTag(Ljava/lang/String;)Lnet/sourceforge/pebble/index/IndexedTag;
    //#input(void index(Collection)): blogEntries
    //#input(void index(Collection)): log
    //#input(void index(Collection)): net.sourceforge.pebble.domain.State__static_init.new State(State__static_init#5).__Tag
    //#input(void index(Collection)): net.sourceforge.pebble.domain.State__static_init.new State(State__static_init#5).name
    //#input(void index(Collection)): net/sourceforge/pebble/domain/Blog.__Descendant_Table[net/sourceforge/pebble/domain/Blog]
    //#input(void index(Collection)): net/sourceforge/pebble/domain/Blog.__Descendant_Table[others]
    //#input(void index(Collection)): net/sourceforge/pebble/domain/Blog.__Dispatch_Table.getRootCategory()Lnet/sourceforge/pebble/domain/Category;
    //#input(void index(Collection)): net/sourceforge/pebble/domain/BlogEntry.__Descendant_Table[net/sourceforge/pebble/domain/BlogEntry]
    //#input(void index(Collection)): net/sourceforge/pebble/domain/BlogEntry.__Descendant_Table[others]
    //#input(void index(Collection)): net/sourceforge/pebble/domain/BlogEntry.__Dispatch_Table.getAllTags()Ljava/util/List;
    //#input(void index(Collection)): net/sourceforge/pebble/domain/BlogEntry.__Dispatch_Table.getBlog()Lnet/sourceforge/pebble/domain/Blog;
    //#input(void index(Collection)): net/sourceforge/pebble/domain/BlogEntry.__Dispatch_Table.getCategories()Ljava/util/Set;
    //#input(void index(Collection)): net/sourceforge/pebble/domain/BlogEntry.__Dispatch_Table.getId()Ljava/lang/String;
    //#input(void index(Collection)): net/sourceforge/pebble/domain/BlogEntry.__Dispatch_Table.getState()Lnet/sourceforge/pebble/domain/State;
    //#input(void index(Collection)): net/sourceforge/pebble/domain/BlogEntry.__Dispatch_Table.getTagsAsList()Ljava/util/List;
    //#input(void index(Collection)): net/sourceforge/pebble/domain/BlogEntry.__Dispatch_Table.isPublished()Z
    //#input(void index(Collection)): net/sourceforge/pebble/domain/Category.__Descendant_Table[net/sourceforge/pebble/domain/Category]
    //#input(void index(Collection)): net/sourceforge/pebble/domain/Category.__Descendant_Table[others]
    //#input(void index(Collection)): net/sourceforge/pebble/domain/Category.__Dispatch_Table.getAllTags()Ljava/util/List;
    //#input(void index(Collection)): net/sourceforge/pebble/domain/Category.__Dispatch_Table.getParent()Lnet/sourceforge/pebble/domain/Category;
    //#input(void index(Collection)): net/sourceforge/pebble/domain/Category.__Dispatch_Table.getTagsAsList()Ljava/util/List;
    //#input(void index(Collection)): net/sourceforge/pebble/domain/PageBasedContent.__Descendant_Table[net/sourceforge/pebble/domain/BlogEntry]
    //#input(void index(Collection)): net/sourceforge/pebble/domain/PageBasedContent.__Descendant_Table[net/sourceforge/pebble/domain/PageBasedContent]
    //#input(void index(Collection)): net/sourceforge/pebble/domain/PageBasedContent.__Descendant_Table[net/sourceforge/pebble/domain/StaticPage]
    //#input(void index(Collection)): net/sourceforge/pebble/domain/PageBasedContent.__Descendant_Table[others]
    //#input(void index(Collection)): net/sourceforge/pebble/domain/PageBasedContent.__Dispatch_Table.getState()Lnet/sourceforge/pebble/domain/State;
    //#input(void index(Collection)): net/sourceforge/pebble/domain/State.PUBLISHED
    //#input(void index(Collection)): net/sourceforge/pebble/domain/State.__Descendant_Table[net/sourceforge/pebble/domain/State]
    //#input(void index(Collection)): net/sourceforge/pebble/domain/State.__Descendant_Table[others]
    //#input(void index(Collection)): net/sourceforge/pebble/domain/State.__Dispatch_Table.equals(Ljava/lang/Object;)Z
    //#input(void index(Collection)): net/sourceforge/pebble/domain/State.__Dispatch_Table.getName()Ljava/lang/String;
    //#input(void index(Collection)): net/sourceforge/pebble/domain/StaticPage.__Dispatch_Table.getState()Lnet/sourceforge/pebble/domain/State;
    //#input(void index(Collection)): net/sourceforge/pebble/domain/Tag.__Descendant_Table[net/sourceforge/pebble/domain/Tag]
    //#input(void index(Collection)): net/sourceforge/pebble/domain/Tag.__Descendant_Table[net/sourceforge/pebble/index/IndexedTag]
    //#input(void index(Collection)): net/sourceforge/pebble/domain/Tag.__Descendant_Table[others]
    //#input(void index(Collection)): net/sourceforge/pebble/domain/Tag.__Dispatch_Table.getName()Ljava/lang/String;
    //#input(void index(Collection)): net/sourceforge/pebble/domain/Tag.__Dispatch_Table.setName(Ljava/lang/String;)V
    //#input(void index(Collection)): net/sourceforge/pebble/index/IndexedTag.__Descendant_Table[net/sourceforge/pebble/index/IndexedTag]
    //#input(void index(Collection)): net/sourceforge/pebble/index/IndexedTag.__Descendant_Table[others]
    //#input(void index(Collection)): net/sourceforge/pebble/index/IndexedTag.__Dispatch_Table.addBlogEntry(Ljava/lang/String;)V
    //#input(void index(Collection)): net/sourceforge/pebble/index/IndexedTag.__Dispatch_Table.calculateRank([I)V
    //#input(void index(Collection)): net/sourceforge/pebble/index/IndexedTag.__Dispatch_Table.getBlogEntries()Ljava/util/List;
    //#input(void index(Collection)): net/sourceforge/pebble/index/IndexedTag.__Dispatch_Table.getName()Ljava/lang/String;
    //#input(void index(Collection)): net/sourceforge/pebble/index/IndexedTag.__Dispatch_Table.getNumberOfBlogEntries()I
    //#input(void index(Collection)): net/sourceforge/pebble/index/IndexedTag.__Dispatch_Table.setName(Ljava/lang/String;)V
    //#input(void index(Collection)): this
    //#input(void index(Collection)): this.__Tag
    //#input(void index(Collection)): this.blog
    //#input(void index(Collection)): this.tags
    //#output(void index(Collection)): new ArrayList(recalculateTagRankings#2) num objects
    //#output(void index(Collection)): this.orderedTags
    //#new obj(void index(Collection)): new ArrayList(recalculateTagRankings#2)
    //#pre[1] (void index(Collection)): blogEntries != null
    //#pre[2] (void index(Collection)): (soft) net.sourceforge.pebble.domain.State__static_init.new State(State__static_init#5).name != null
    //#pre[5] (void index(Collection)): (soft) this.__Tag == net/sourceforge/pebble/index/TagIndex
    //#pre[6] (void index(Collection)): (soft) this.blog != null
    //#pre[7] (void index(Collection)): (soft) this.tags != null
    //#presumption(void index(Collection)): blogEntry.blog.__Tag@82 == net/sourceforge/pebble/domain/Blog
    //#presumption(void index(Collection)): blogEntry.blog.rootCategory...__Tag@82 == net/sourceforge/pebble/domain/Category
    //#presumption(void index(Collection)): blogEntry.blog.rootCategory.__Tag@82 == net/sourceforge/pebble/domain/Category
    //#presumption(void index(Collection)): blogEntry.blog.rootCategory@82 != null
    //#presumption(void index(Collection)): blogEntry.blog@82 != null
    //#presumption(void index(Collection)): blogEntry.state.__Tag@81 == net/sourceforge/pebble/domain/State
    //#presumption(void index(Collection)): blogEntry.state@81 != null
    //#presumption(void index(Collection)): blogEntry.tagsAsList@82 != null
    //#presumption(void index(Collection)): java.util.Iterator:next(...).__Tag@81 == net/sourceforge/pebble/domain/BlogEntry
    //#presumption(void index(Collection)): java.util.Iterator:next(...).__Tag@83 in {net/sourceforge/pebble/domain/Tag, net/sourceforge/pebble/index/IndexedTag}
    //#presumption(void index(Collection)): java.util.Iterator:next(...)@81 != null
    //#presumption(void index(Collection)): java.util.Iterator:next(...)@83 != null
    //#presumption(void index(Collection)): t.__Tag@84 == net/sourceforge/pebble/index/IndexedTag
    //#presumption(void index(Collection)): t.blogEntries@84 != null
    //#post(void index(Collection)): this.orderedTags == One-of{old this.orderedTags, &new ArrayList(recalculateTagRankings#2)}
    //#post(void index(Collection)): new ArrayList(recalculateTagRankings#2) num objects <= 1
    //#unanalyzed(void index(Collection)): Effects-of-calling:encode
    //#unanalyzed(void index(Collection)): Effects-of-calling:java.util.Map:get
    //#unanalyzed(void index(Collection)): Effects-of-calling:net.sourceforge.pebble.index.IndexedTag
    //#unanalyzed(void index(Collection)): Effects-of-calling:java.util.Map:put
    //#unanalyzed(void index(Collection)): Effects-of-calling:java.util.Map:values
    //#unanalyzed(void index(Collection)): Effects-of-calling:java.util.Collection:iterator
    //#unanalyzed(void index(Collection)): Effects-of-calling:java.util.Iterator:hasNext
    //#unanalyzed(void index(Collection)): Effects-of-calling:java.util.Iterator:next
    //#unanalyzed(void index(Collection)): Effects-of-calling:getName
    //#unanalyzed(void index(Collection)): Effects-of-calling:java.util.List:iterator
    //#unanalyzed(void index(Collection)): Effects-of-calling:getBlogEntries
    //#unanalyzed(void index(Collection)): Effects-of-calling:java.util.Map:size
    //#unanalyzed(void index(Collection)): Effects-of-calling:getNumberOfBlogEntries
    //#unanalyzed(void index(Collection)): Effects-of-calling:java.lang.Math:round
    //#unanalyzed(void index(Collection)): Effects-of-calling:java.util.ArrayList
    //#unanalyzed(void index(Collection)): Effects-of-calling:calculateRank
    //#unanalyzed(void index(Collection)): Effects-of-calling:java.util.List:add
    //#unanalyzed(void index(Collection)): Effects-of-calling:java.util.Collections:sort
    //#unanalyzed(void index(Collection)): Effects-of-calling:net.sourceforge.pebble.domain.Blog:getIndexesDirectory
    //#unanalyzed(void index(Collection)): Effects-of-calling:java.io.File
    //#unanalyzed(void index(Collection)): Effects-of-calling:java.io.FileWriter
    //#unanalyzed(void index(Collection)): Effects-of-calling:java.io.BufferedWriter
    //#unanalyzed(void index(Collection)): Effects-of-calling:java.io.BufferedWriter:write
    //#unanalyzed(void index(Collection)): Effects-of-calling:java.io.BufferedWriter:newLine
    //#unanalyzed(void index(Collection)): Effects-of-calling:java.io.BufferedWriter:flush
    //#unanalyzed(void index(Collection)): Effects-of-calling:java.io.BufferedWriter:close
    //#unanalyzed(void index(Collection)): Effects-of-calling:org.apache.commons.logging.Log:error
    //#unanalyzed(void index(Collection)): Effects-of-calling:java.lang.String:trim
    //#unanalyzed(void index(Collection)): Effects-of-calling:java.lang.String:toLowerCase
    //#unanalyzed(void index(Collection)): Effects-of-calling:java.lang.String:replaceAll
    //#unanalyzed(void index(Collection)): Effects-of-calling:java.lang.String:equals
    //#unanalyzed(void index(Collection)): Effects-of-calling:java.util.HashSet
    //#unanalyzed(void index(Collection)): Effects-of-calling:java.util.Set:iterator
    //#unanalyzed(void index(Collection)): Effects-of-calling:java.util.List:contains
    //#unanalyzed(void index(Collection)): Effects-of-calling:java.util.Set:size
    //#unanalyzed(void index(Collection)): Effects-of-calling:java.util.List:addAll
    //#unanalyzed(void index(Collection)): Effects-of-calling:java.util.Collections:reverse
    //#unanalyzed(void index(Collection)): Effects-of-calling:getRootCategory
    //#unanalyzed(void index(Collection)): Effects-of-calling:java.util.List:size
    //#test_vector(void index(Collection)): java.util.Iterator:hasNext(...)@81: {1}, {0}
    //#test_vector(void index(Collection)): java.util.Iterator:hasNext(...)@83: {1}, {0}
      if (blogEntry.isPublished()) {
        for (Tag tag : blogEntry.getAllTags()) {
          IndexedTag t = getTag(tag.getName());
          t.addBlogEntry(blogEntry.getId());
        }
      }
    }

    writeIndex();
    recalculateTagRankings();
  }
    //#tagindex.java:92: end of method: void net.sourceforge.pebble.index.TagIndex.index(Collection)

  /**
   * Indexes a single blog entry.
   *
   * @param blogEntry   a BlogEntry instance
   */
  public synchronized void index(BlogEntry blogEntry) {
    if (blogEntry.isPublished()) {
    //#tagindex.java:100: method: void net.sourceforge.pebble.index.TagIndex.index(BlogEntry)
    //#input(void index(BlogEntry)): __Descendant_Table[net/sourceforge/pebble/index/TagIndex]
    //#input(void index(BlogEntry)): __Descendant_Table[others]
    //#input(void index(BlogEntry)): __Dispatch_Table.getTag(Ljava/lang/String;)Lnet/sourceforge/pebble/index/IndexedTag;
    //#input(void index(BlogEntry)): blogEntry
    //#input(void index(BlogEntry)): blogEntry.__Tag
    //#input(void index(BlogEntry)): blogEntry.blog
    //#input(void index(BlogEntry)): blogEntry.blog.__Tag
    //#input(void index(BlogEntry)): blogEntry.blog.rootCategory
    //#input(void index(BlogEntry)): blogEntry.blog.rootCategory...__Tag
    //#input(void index(BlogEntry)): blogEntry.blog.rootCategory...parent
    //#input(void index(BlogEntry)): blogEntry.blog.rootCategory...tagsAsList
    //#input(void index(BlogEntry)): blogEntry.blog.rootCategory.__Tag
    //#input(void index(BlogEntry)): blogEntry.blog.rootCategory.parent
    //#input(void index(BlogEntry)): blogEntry.blog.rootCategory.tagsAsList
    //#input(void index(BlogEntry)): blogEntry.categories
    //#input(void index(BlogEntry)): blogEntry.id
    //#input(void index(BlogEntry)): blogEntry.state
    //#input(void index(BlogEntry)): blogEntry.state.__Tag
    //#input(void index(BlogEntry)): blogEntry.state.name
    //#input(void index(BlogEntry)): blogEntry.tagsAsList
    //#input(void index(BlogEntry)): log
    //#input(void index(BlogEntry)): net.sourceforge.pebble.domain.State__static_init.new State(State__static_init#5).__Tag
    //#input(void index(BlogEntry)): net.sourceforge.pebble.domain.State__static_init.new State(State__static_init#5).name
    //#input(void index(BlogEntry)): net/sourceforge/pebble/domain/Blog.__Descendant_Table[net/sourceforge/pebble/domain/Blog]
    //#input(void index(BlogEntry)): net/sourceforge/pebble/domain/Blog.__Descendant_Table[others]
    //#input(void index(BlogEntry)): net/sourceforge/pebble/domain/Blog.__Dispatch_Table.getRootCategory()Lnet/sourceforge/pebble/domain/Category;
    //#input(void index(BlogEntry)): net/sourceforge/pebble/domain/BlogEntry.__Descendant_Table[net/sourceforge/pebble/domain/BlogEntry]
    //#input(void index(BlogEntry)): net/sourceforge/pebble/domain/BlogEntry.__Descendant_Table[others]
    //#input(void index(BlogEntry)): net/sourceforge/pebble/domain/BlogEntry.__Dispatch_Table.getAllTags()Ljava/util/List;
    //#input(void index(BlogEntry)): net/sourceforge/pebble/domain/BlogEntry.__Dispatch_Table.getBlog()Lnet/sourceforge/pebble/domain/Blog;
    //#input(void index(BlogEntry)): net/sourceforge/pebble/domain/BlogEntry.__Dispatch_Table.getCategories()Ljava/util/Set;
    //#input(void index(BlogEntry)): net/sourceforge/pebble/domain/BlogEntry.__Dispatch_Table.getId()Ljava/lang/String;
    //#input(void index(BlogEntry)): net/sourceforge/pebble/domain/BlogEntry.__Dispatch_Table.getState()Lnet/sourceforge/pebble/domain/State;
    //#input(void index(BlogEntry)): net/sourceforge/pebble/domain/BlogEntry.__Dispatch_Table.getTagsAsList()Ljava/util/List;
    //#input(void index(BlogEntry)): net/sourceforge/pebble/domain/BlogEntry.__Dispatch_Table.isPublished()Z
    //#input(void index(BlogEntry)): net/sourceforge/pebble/domain/Category.__Descendant_Table[net/sourceforge/pebble/domain/Category]
    //#input(void index(BlogEntry)): net/sourceforge/pebble/domain/Category.__Descendant_Table[others]
    //#input(void index(BlogEntry)): net/sourceforge/pebble/domain/Category.__Dispatch_Table.getAllTags()Ljava/util/List;
    //#input(void index(BlogEntry)): net/sourceforge/pebble/domain/Category.__Dispatch_Table.getParent()Lnet/sourceforge/pebble/domain/Category;
    //#input(void index(BlogEntry)): net/sourceforge/pebble/domain/Category.__Dispatch_Table.getTagsAsList()Ljava/util/List;
    //#input(void index(BlogEntry)): net/sourceforge/pebble/domain/PageBasedContent.__Descendant_Table[net/sourceforge/pebble/domain/BlogEntry]
    //#input(void index(BlogEntry)): net/sourceforge/pebble/domain/PageBasedContent.__Descendant_Table[net/sourceforge/pebble/domain/PageBasedContent]
    //#input(void index(BlogEntry)): net/sourceforge/pebble/domain/PageBasedContent.__Descendant_Table[net/sourceforge/pebble/domain/StaticPage]
    //#input(void index(BlogEntry)): net/sourceforge/pebble/domain/PageBasedContent.__Descendant_Table[others]
    //#input(void index(BlogEntry)): net/sourceforge/pebble/domain/PageBasedContent.__Dispatch_Table.getState()Lnet/sourceforge/pebble/domain/State;
    //#input(void index(BlogEntry)): net/sourceforge/pebble/domain/State.PUBLISHED
    //#input(void index(BlogEntry)): net/sourceforge/pebble/domain/State.__Descendant_Table[net/sourceforge/pebble/domain/State]
    //#input(void index(BlogEntry)): net/sourceforge/pebble/domain/State.__Descendant_Table[others]
    //#input(void index(BlogEntry)): net/sourceforge/pebble/domain/State.__Dispatch_Table.equals(Ljava/lang/Object;)Z
    //#input(void index(BlogEntry)): net/sourceforge/pebble/domain/State.__Dispatch_Table.getName()Ljava/lang/String;
    //#input(void index(BlogEntry)): net/sourceforge/pebble/domain/StaticPage.__Dispatch_Table.getState()Lnet/sourceforge/pebble/domain/State;
    //#input(void index(BlogEntry)): net/sourceforge/pebble/domain/Tag.__Descendant_Table[net/sourceforge/pebble/domain/Tag]
    //#input(void index(BlogEntry)): net/sourceforge/pebble/domain/Tag.__Descendant_Table[net/sourceforge/pebble/index/IndexedTag]
    //#input(void index(BlogEntry)): net/sourceforge/pebble/domain/Tag.__Descendant_Table[others]
    //#input(void index(BlogEntry)): net/sourceforge/pebble/domain/Tag.__Dispatch_Table.getName()Ljava/lang/String;
    //#input(void index(BlogEntry)): net/sourceforge/pebble/domain/Tag.__Dispatch_Table.setName(Ljava/lang/String;)V
    //#input(void index(BlogEntry)): net/sourceforge/pebble/index/IndexedTag.__Descendant_Table[net/sourceforge/pebble/index/IndexedTag]
    //#input(void index(BlogEntry)): net/sourceforge/pebble/index/IndexedTag.__Descendant_Table[others]
    //#input(void index(BlogEntry)): net/sourceforge/pebble/index/IndexedTag.__Dispatch_Table.addBlogEntry(Ljava/lang/String;)V
    //#input(void index(BlogEntry)): net/sourceforge/pebble/index/IndexedTag.__Dispatch_Table.calculateRank([I)V
    //#input(void index(BlogEntry)): net/sourceforge/pebble/index/IndexedTag.__Dispatch_Table.getBlogEntries()Ljava/util/List;
    //#input(void index(BlogEntry)): net/sourceforge/pebble/index/IndexedTag.__Dispatch_Table.getName()Ljava/lang/String;
    //#input(void index(BlogEntry)): net/sourceforge/pebble/index/IndexedTag.__Dispatch_Table.getNumberOfBlogEntries()I
    //#input(void index(BlogEntry)): net/sourceforge/pebble/index/IndexedTag.__Dispatch_Table.setName(Ljava/lang/String;)V
    //#input(void index(BlogEntry)): this
    //#input(void index(BlogEntry)): this.__Tag
    //#input(void index(BlogEntry)): this.blog
    //#input(void index(BlogEntry)): this.tags
    //#output(void index(BlogEntry)): new ArrayList(recalculateTagRankings#2) num objects
    //#output(void index(BlogEntry)): this.orderedTags
    //#new obj(void index(BlogEntry)): new ArrayList(recalculateTagRankings#2)
    //#pre[1] (void index(BlogEntry)): blogEntry != null
    //#pre[2] (void index(BlogEntry)): blogEntry.__Tag == net/sourceforge/pebble/domain/BlogEntry
    //#pre[14] (void index(BlogEntry)): blogEntry.state != null
    //#pre[15] (void index(BlogEntry)): blogEntry.state.__Tag == net/sourceforge/pebble/domain/State
    //#pre[3] (void index(BlogEntry)): (soft) blogEntry.blog != null
    //#pre[4] (void index(BlogEntry)): (soft) blogEntry.blog.__Tag == net/sourceforge/pebble/domain/Blog
    //#pre[5] (void index(BlogEntry)): (soft) blogEntry.blog.rootCategory != null
    //#pre[6] (void index(BlogEntry)): (soft) blogEntry.blog.rootCategory...__Tag == net/sourceforge/pebble/domain/Category
    //#pre[7] (void index(BlogEntry)): (soft) init'ed(blogEntry.blog.rootCategory...parent)
    //#pre[8] (void index(BlogEntry)): (soft) init'ed(blogEntry.blog.rootCategory...tagsAsList)
    //#pre[9] (void index(BlogEntry)): (soft) blogEntry.blog.rootCategory.__Tag == net/sourceforge/pebble/domain/Category
    //#pre[10] (void index(BlogEntry)): (soft) init'ed(blogEntry.blog.rootCategory.parent)
    //#pre[11] (void index(BlogEntry)): (soft) init'ed(blogEntry.blog.rootCategory.tagsAsList)
    //#pre[12] (void index(BlogEntry)): (soft) init'ed(blogEntry.categories)
    //#pre[13] (void index(BlogEntry)): (soft) init'ed(blogEntry.id)
    //#pre[16] (void index(BlogEntry)): (soft) init'ed(blogEntry.state.name)
    //#pre[17] (void index(BlogEntry)): (soft) blogEntry.tagsAsList != null
    //#pre[18] (void index(BlogEntry)): (soft) net.sourceforge.pebble.domain.State__static_init.new State(State__static_init#5).name != null
    //#pre[21] (void index(BlogEntry)): (soft) this.__Tag == net/sourceforge/pebble/index/TagIndex
    //#pre[22] (void index(BlogEntry)): (soft) this.blog != null
    //#pre[23] (void index(BlogEntry)): (soft) this.tags != null
    //#presumption(void index(BlogEntry)): java.util.Iterator:next(...).__Tag@101 in {net/sourceforge/pebble/domain/Tag, net/sourceforge/pebble/index/IndexedTag}
    //#presumption(void index(BlogEntry)): java.util.Iterator:next(...)@101 != null
    //#presumption(void index(BlogEntry)): t.__Tag@102 == net/sourceforge/pebble/index/IndexedTag
    //#presumption(void index(BlogEntry)): t.blogEntries@102 != null
    //#post(void index(BlogEntry)): this.orderedTags == One-of{old this.orderedTags, &new ArrayList(recalculateTagRankings#2)}
    //#post(void index(BlogEntry)): new ArrayList(recalculateTagRankings#2) num objects <= 1
    //#unanalyzed(void index(BlogEntry)): Effects-of-calling:encode
    //#unanalyzed(void index(BlogEntry)): Effects-of-calling:java.util.Map:get
    //#unanalyzed(void index(BlogEntry)): Effects-of-calling:net.sourceforge.pebble.index.IndexedTag
    //#unanalyzed(void index(BlogEntry)): Effects-of-calling:java.util.Map:put
    //#unanalyzed(void index(BlogEntry)): Effects-of-calling:java.util.Map:values
    //#unanalyzed(void index(BlogEntry)): Effects-of-calling:java.util.Collection:iterator
    //#unanalyzed(void index(BlogEntry)): Effects-of-calling:java.util.Iterator:hasNext
    //#unanalyzed(void index(BlogEntry)): Effects-of-calling:java.util.Iterator:next
    //#unanalyzed(void index(BlogEntry)): Effects-of-calling:getName
    //#unanalyzed(void index(BlogEntry)): Effects-of-calling:java.util.List:iterator
    //#unanalyzed(void index(BlogEntry)): Effects-of-calling:getBlogEntries
    //#unanalyzed(void index(BlogEntry)): Effects-of-calling:java.util.Map:size
    //#unanalyzed(void index(BlogEntry)): Effects-of-calling:getNumberOfBlogEntries
    //#unanalyzed(void index(BlogEntry)): Effects-of-calling:java.lang.Math:round
    //#unanalyzed(void index(BlogEntry)): Effects-of-calling:java.util.ArrayList
    //#unanalyzed(void index(BlogEntry)): Effects-of-calling:calculateRank
    //#unanalyzed(void index(BlogEntry)): Effects-of-calling:java.util.List:add
    //#unanalyzed(void index(BlogEntry)): Effects-of-calling:java.util.Collections:sort
    //#unanalyzed(void index(BlogEntry)): Effects-of-calling:net.sourceforge.pebble.domain.Blog:getIndexesDirectory
    //#unanalyzed(void index(BlogEntry)): Effects-of-calling:java.io.File
    //#unanalyzed(void index(BlogEntry)): Effects-of-calling:java.io.FileWriter
    //#unanalyzed(void index(BlogEntry)): Effects-of-calling:java.io.BufferedWriter
    //#unanalyzed(void index(BlogEntry)): Effects-of-calling:java.io.BufferedWriter:write
    //#unanalyzed(void index(BlogEntry)): Effects-of-calling:java.io.BufferedWriter:newLine
    //#unanalyzed(void index(BlogEntry)): Effects-of-calling:java.io.BufferedWriter:flush
    //#unanalyzed(void index(BlogEntry)): Effects-of-calling:java.io.BufferedWriter:close
    //#unanalyzed(void index(BlogEntry)): Effects-of-calling:org.apache.commons.logging.Log:error
    //#unanalyzed(void index(BlogEntry)): Effects-of-calling:java.lang.String:trim
    //#unanalyzed(void index(BlogEntry)): Effects-of-calling:java.lang.String:toLowerCase
    //#unanalyzed(void index(BlogEntry)): Effects-of-calling:java.lang.String:replaceAll
    //#unanalyzed(void index(BlogEntry)): Effects-of-calling:java.lang.String:equals
    //#unanalyzed(void index(BlogEntry)): Effects-of-calling:java.util.HashSet
    //#unanalyzed(void index(BlogEntry)): Effects-of-calling:java.util.Set:iterator
    //#unanalyzed(void index(BlogEntry)): Effects-of-calling:java.util.List:contains
    //#unanalyzed(void index(BlogEntry)): Effects-of-calling:java.util.Set:size
    //#unanalyzed(void index(BlogEntry)): Effects-of-calling:java.util.List:addAll
    //#unanalyzed(void index(BlogEntry)): Effects-of-calling:java.util.Collections:reverse
    //#unanalyzed(void index(BlogEntry)): Effects-of-calling:getRootCategory
    //#unanalyzed(void index(BlogEntry)): Effects-of-calling:java.util.List:size
    //#test_vector(void index(BlogEntry)): java.util.Iterator:hasNext(...)@101: {1}, {0}
      for (Tag tag : blogEntry.getAllTags()) {
        IndexedTag t = getTag(tag.getName());
        t.addBlogEntry(blogEntry.getId());
      }

      writeIndex();
      recalculateTagRankings();
    }
  }
    //#tagindex.java:109: end of method: void net.sourceforge.pebble.index.TagIndex.index(BlogEntry)

  /**
   * Unindexes a single blog entry.
   *
   * @param blogEntry   a BlogEntry instance
   */
  public synchronized void unindex(BlogEntry blogEntry) {
    for (Tag tag : tags.values()) {
    //#tagindex.java:117: method: void net.sourceforge.pebble.index.TagIndex.unindex(BlogEntry)
    //#input(void unindex(BlogEntry)): __Descendant_Table[net/sourceforge/pebble/index/TagIndex]
    //#input(void unindex(BlogEntry)): __Descendant_Table[others]
    //#input(void unindex(BlogEntry)): __Dispatch_Table.getTag(Ljava/lang/String;)Lnet/sourceforge/pebble/index/IndexedTag;
    //#input(void unindex(BlogEntry)): blogEntry
    //#input(void unindex(BlogEntry)): blogEntry.__Tag
    //#input(void unindex(BlogEntry)): blogEntry.id
    //#input(void unindex(BlogEntry)): log
    //#input(void unindex(BlogEntry)): net/sourceforge/pebble/domain/BlogEntry.__Descendant_Table[net/sourceforge/pebble/domain/BlogEntry]
    //#input(void unindex(BlogEntry)): net/sourceforge/pebble/domain/BlogEntry.__Descendant_Table[others]
    //#input(void unindex(BlogEntry)): net/sourceforge/pebble/domain/BlogEntry.__Dispatch_Table.getId()Ljava/lang/String;
    //#input(void unindex(BlogEntry)): net/sourceforge/pebble/domain/Tag.__Descendant_Table[net/sourceforge/pebble/domain/Tag]
    //#input(void unindex(BlogEntry)): net/sourceforge/pebble/domain/Tag.__Descendant_Table[net/sourceforge/pebble/index/IndexedTag]
    //#input(void unindex(BlogEntry)): net/sourceforge/pebble/domain/Tag.__Descendant_Table[others]
    //#input(void unindex(BlogEntry)): net/sourceforge/pebble/domain/Tag.__Dispatch_Table.getName()Ljava/lang/String;
    //#input(void unindex(BlogEntry)): net/sourceforge/pebble/domain/Tag.__Dispatch_Table.setName(Ljava/lang/String;)V
    //#input(void unindex(BlogEntry)): net/sourceforge/pebble/index/IndexedTag.__Descendant_Table[net/sourceforge/pebble/index/IndexedTag]
    //#input(void unindex(BlogEntry)): net/sourceforge/pebble/index/IndexedTag.__Descendant_Table[others]
    //#input(void unindex(BlogEntry)): net/sourceforge/pebble/index/IndexedTag.__Dispatch_Table.calculateRank([I)V
    //#input(void unindex(BlogEntry)): net/sourceforge/pebble/index/IndexedTag.__Dispatch_Table.getBlogEntries()Ljava/util/List;
    //#input(void unindex(BlogEntry)): net/sourceforge/pebble/index/IndexedTag.__Dispatch_Table.getName()Ljava/lang/String;
    //#input(void unindex(BlogEntry)): net/sourceforge/pebble/index/IndexedTag.__Dispatch_Table.getNumberOfBlogEntries()I
    //#input(void unindex(BlogEntry)): net/sourceforge/pebble/index/IndexedTag.__Dispatch_Table.removeBlogEntry(Ljava/lang/String;)V
    //#input(void unindex(BlogEntry)): net/sourceforge/pebble/index/IndexedTag.__Dispatch_Table.setName(Ljava/lang/String;)V
    //#input(void unindex(BlogEntry)): this
    //#input(void unindex(BlogEntry)): this.__Tag
    //#input(void unindex(BlogEntry)): this.blog
    //#input(void unindex(BlogEntry)): this.tags
    //#output(void unindex(BlogEntry)): new ArrayList(recalculateTagRankings#2) num objects
    //#output(void unindex(BlogEntry)): this.orderedTags
    //#new obj(void unindex(BlogEntry)): new ArrayList(recalculateTagRankings#2)
    //#pre[8] (void unindex(BlogEntry)): this.tags != null
    //#pre[1] (void unindex(BlogEntry)): (soft) blogEntry != null
    //#pre[2] (void unindex(BlogEntry)): (soft) blogEntry.__Tag == net/sourceforge/pebble/domain/BlogEntry
    //#pre[3] (void unindex(BlogEntry)): (soft) init'ed(blogEntry.id)
    //#pre[6] (void unindex(BlogEntry)): (soft) this.__Tag == net/sourceforge/pebble/index/TagIndex
    //#pre[7] (void unindex(BlogEntry)): (soft) this.blog != null
    //#presumption(void unindex(BlogEntry)): java.util.Iterator:next(...).__Tag@117 in {net/sourceforge/pebble/domain/Tag, net/sourceforge/pebble/index/IndexedTag}
    //#presumption(void unindex(BlogEntry)): java.util.Iterator:next(...)@117 != null
    //#presumption(void unindex(BlogEntry)): java.util.Map:values(...)@117 != null
    //#presumption(void unindex(BlogEntry)): t.__Tag@118 == net/sourceforge/pebble/index/IndexedTag
    //#presumption(void unindex(BlogEntry)): t.blogEntries@118 != null
    //#post(void unindex(BlogEntry)): this.orderedTags == One-of{old this.orderedTags, &new ArrayList(recalculateTagRankings#2)}
    //#post(void unindex(BlogEntry)): new ArrayList(recalculateTagRankings#2) num objects <= 1
    //#unanalyzed(void unindex(BlogEntry)): Effects-of-calling:encode
    //#unanalyzed(void unindex(BlogEntry)): Effects-of-calling:java.util.Map:get
    //#unanalyzed(void unindex(BlogEntry)): Effects-of-calling:net.sourceforge.pebble.index.IndexedTag
    //#unanalyzed(void unindex(BlogEntry)): Effects-of-calling:java.util.Map:put
    //#unanalyzed(void unindex(BlogEntry)): Effects-of-calling:java.util.Map:values
    //#unanalyzed(void unindex(BlogEntry)): Effects-of-calling:java.util.Collection:iterator
    //#unanalyzed(void unindex(BlogEntry)): Effects-of-calling:java.util.Iterator:hasNext
    //#unanalyzed(void unindex(BlogEntry)): Effects-of-calling:java.util.Iterator:next
    //#unanalyzed(void unindex(BlogEntry)): Effects-of-calling:getName
    //#unanalyzed(void unindex(BlogEntry)): Effects-of-calling:java.util.List:iterator
    //#unanalyzed(void unindex(BlogEntry)): Effects-of-calling:getBlogEntries
    //#unanalyzed(void unindex(BlogEntry)): Effects-of-calling:java.util.Map:size
    //#unanalyzed(void unindex(BlogEntry)): Effects-of-calling:getNumberOfBlogEntries
    //#unanalyzed(void unindex(BlogEntry)): Effects-of-calling:java.lang.Math:round
    //#unanalyzed(void unindex(BlogEntry)): Effects-of-calling:java.util.ArrayList
    //#unanalyzed(void unindex(BlogEntry)): Effects-of-calling:calculateRank
    //#unanalyzed(void unindex(BlogEntry)): Effects-of-calling:java.util.List:add
    //#unanalyzed(void unindex(BlogEntry)): Effects-of-calling:java.util.Collections:sort
    //#unanalyzed(void unindex(BlogEntry)): Effects-of-calling:net.sourceforge.pebble.domain.Blog:getIndexesDirectory
    //#unanalyzed(void unindex(BlogEntry)): Effects-of-calling:java.io.File
    //#unanalyzed(void unindex(BlogEntry)): Effects-of-calling:java.io.FileWriter
    //#unanalyzed(void unindex(BlogEntry)): Effects-of-calling:java.io.BufferedWriter
    //#unanalyzed(void unindex(BlogEntry)): Effects-of-calling:java.io.BufferedWriter:write
    //#unanalyzed(void unindex(BlogEntry)): Effects-of-calling:java.io.BufferedWriter:newLine
    //#unanalyzed(void unindex(BlogEntry)): Effects-of-calling:java.io.BufferedWriter:flush
    //#unanalyzed(void unindex(BlogEntry)): Effects-of-calling:java.io.BufferedWriter:close
    //#unanalyzed(void unindex(BlogEntry)): Effects-of-calling:org.apache.commons.logging.Log:error
    //#unanalyzed(void unindex(BlogEntry)): Effects-of-calling:java.lang.String:trim
    //#unanalyzed(void unindex(BlogEntry)): Effects-of-calling:java.lang.String:toLowerCase
    //#unanalyzed(void unindex(BlogEntry)): Effects-of-calling:java.lang.String:replaceAll
    //#unanalyzed(void unindex(BlogEntry)): Effects-of-calling:java.util.List:remove
    //#unanalyzed(void unindex(BlogEntry)): Effects-of-calling:java.util.List:size
    //#test_vector(void unindex(BlogEntry)): java.util.Iterator:hasNext(...)@117: {1}, {0}
      IndexedTag t = getTag(tag.getName());
      t.removeBlogEntry(blogEntry.getId());
    }

    writeIndex();
    recalculateTagRankings();
  }
    //#tagindex.java:124: end of method: void net.sourceforge.pebble.index.TagIndex.unindex(BlogEntry)

  /**
   * Helper method to load the index.
   */
  private void readIndex() {
    File indexFile = new File(blog.getIndexesDirectory(), "tags.index");
    //#tagindex.java:130: method: void net.sourceforge.pebble.index.TagIndex.readIndex()
    //#tagindex.java:130: Warning: method not available
    //#    -- call on String net.sourceforge.pebble.domain.Blog:getIndexesDirectory()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.index.TagIndex
    //#    method: void readIndex()
    //#    unanalyzed callee: String net.sourceforge.pebble.domain.Blog:getIndexesDirectory()
    //#input(void readIndex()): __Descendant_Table[net/sourceforge/pebble/index/TagIndex]
    //#input(void readIndex()): __Descendant_Table[others]
    //#input(void readIndex()): __Dispatch_Table.getTag(Ljava/lang/String;)Lnet/sourceforge/pebble/index/IndexedTag;
    //#input(void readIndex()): log
    //#input(void readIndex()): net/sourceforge/pebble/domain/Tag.__Descendant_Table[net/sourceforge/pebble/domain/Tag]
    //#input(void readIndex()): net/sourceforge/pebble/domain/Tag.__Descendant_Table[net/sourceforge/pebble/index/IndexedTag]
    //#input(void readIndex()): net/sourceforge/pebble/domain/Tag.__Descendant_Table[others]
    //#input(void readIndex()): net/sourceforge/pebble/domain/Tag.__Dispatch_Table.setName(Ljava/lang/String;)V
    //#input(void readIndex()): net/sourceforge/pebble/index/IndexedTag.__Descendant_Table[net/sourceforge/pebble/index/IndexedTag]
    //#input(void readIndex()): net/sourceforge/pebble/index/IndexedTag.__Descendant_Table[others]
    //#input(void readIndex()): net/sourceforge/pebble/index/IndexedTag.__Dispatch_Table.addBlogEntry(Ljava/lang/String;)V
    //#input(void readIndex()): net/sourceforge/pebble/index/IndexedTag.__Dispatch_Table.setName(Ljava/lang/String;)V
    //#input(void readIndex()): this
    //#input(void readIndex()): this.__Tag
    //#input(void readIndex()): this.blog
    //#input(void readIndex()): this.tags
    //#pre[3] (void readIndex()): this.blog != null
    //#pre[2] (void readIndex()): (soft) this.__Tag == net/sourceforge/pebble/index/TagIndex
    //#pre[4] (void readIndex()): (soft) this.tags != null
    //#presumption(void readIndex()): blogEntries.length@140 <= 4_294_967_295
    //#presumption(void readIndex()): org.apache.commons.logging.LogFactory:getLog(...)@50 != null
    //#presumption(void readIndex()): tag.__Tag@137 == net/sourceforge/pebble/index/IndexedTag
    //#presumption(void readIndex()): tag.blogEntries@137 != null
    //#presumption(void readIndex()): tuple.length@136 >= 1
    //#unanalyzed(void readIndex()): Effects-of-calling:encode
    //#unanalyzed(void readIndex()): Effects-of-calling:java.util.Map:get
    //#unanalyzed(void readIndex()): Effects-of-calling:net.sourceforge.pebble.index.IndexedTag
    //#unanalyzed(void readIndex()): Effects-of-calling:java.util.Map:put
    //#unanalyzed(void readIndex()): Effects-of-calling:java.lang.String:trim
    //#unanalyzed(void readIndex()): Effects-of-calling:java.lang.String:toLowerCase
    //#unanalyzed(void readIndex()): Effects-of-calling:java.lang.String:replaceAll
    //#unanalyzed(void readIndex()): Effects-of-calling:java.util.ArrayList
    //#unanalyzed(void readIndex()): Effects-of-calling:java.util.List:contains
    //#unanalyzed(void readIndex()): Effects-of-calling:java.util.List:add
    //#unanalyzed(void readIndex()): Effects-of-calling:java.util.Collections:sort
    //#test_vector(void readIndex()): java.io.File:exists(...)@131: {0}, {1}
    //#test_vector(void readIndex()): tuple.length@136: {1}, {2..+Inf}
    //#test_vector(void readIndex()): tuple[1]@136: Addr_Set{null}, Inverse{null}
    if (indexFile.exists()) {
      try {
        BufferedReader reader = new BufferedReader(new FileReader(indexFile));
        String indexEntry = reader.readLine();
        while (indexEntry != null) {
          String[] tuple = indexEntry.split("=");
          IndexedTag tag = getTag(tuple[0]);

          if (tuple.length > 1 && tuple[1] != null) {
            String[] blogEntries = tuple[1].split(",");
            for (String blogEntry : blogEntries) {
              tag.addBlogEntry(blogEntry);
            }
          }

          indexEntry = reader.readLine();
        }

        reader.close();
      } catch (Exception e) {
        log.error("Error while reading index", e);
    //#tagindex.java:151: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:error(Object, Throwable)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.index.TagIndex
    //#    method: void readIndex()
    //#    unanalyzed callee: void org.apache.commons.logging.Log:error(Object, Throwable)
      }
    }
  }
    //#tagindex.java:154: end of method: void net.sourceforge.pebble.index.TagIndex.readIndex()

  /**
   * Helper method to write out the index to disk.
   */
  private void writeIndex() {
    try {
      File indexFile = new File(blog.getIndexesDirectory(), "tags.index");
    //#tagindex.java:161: method: void net.sourceforge.pebble.index.TagIndex.writeIndex()
    //#tagindex.java:161: Warning: method not available
    //#    -- call on String net.sourceforge.pebble.domain.Blog:getIndexesDirectory()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.index.TagIndex
    //#    method: void writeIndex()
    //#    unanalyzed callee: String net.sourceforge.pebble.domain.Blog:getIndexesDirectory()
    //#input(void writeIndex()): log
    //#input(void writeIndex()): net/sourceforge/pebble/index/IndexedTag.__Descendant_Table[net/sourceforge/pebble/index/IndexedTag]
    //#input(void writeIndex()): net/sourceforge/pebble/index/IndexedTag.__Descendant_Table[others]
    //#input(void writeIndex()): net/sourceforge/pebble/index/IndexedTag.__Dispatch_Table.getBlogEntries()Ljava/util/List;
    //#input(void writeIndex()): net/sourceforge/pebble/index/IndexedTag.__Dispatch_Table.getName()Ljava/lang/String;
    //#input(void writeIndex()): this
    //#input(void writeIndex()): this.blog
    //#input(void writeIndex()): this.tags
    //#pre[2] (void writeIndex()): (soft) this.blog != null
    //#pre[3] (void writeIndex()): (soft) this.tags != null
    //#presumption(void writeIndex()): java.util.Iterator:next(...).__Tag@164 == net/sourceforge/pebble/index/IndexedTag
    //#presumption(void writeIndex()): java.util.Iterator:next(...)@164 != null
    //#presumption(void writeIndex()): java.util.Map:values(...)@164 != null
    //#presumption(void writeIndex()): org.apache.commons.logging.LogFactory:getLog(...)@50 != null
    //#unanalyzed(void writeIndex()): Effects-of-calling:java.util.ArrayList
    //#test_vector(void writeIndex()): java.util.Iterator:hasNext(...)@164: {1}, {0}
    //#test_vector(void writeIndex()): java.util.Iterator:hasNext(...)@167: {1}, {0}
      BufferedWriter writer = new BufferedWriter(new FileWriter(indexFile));

      for (IndexedTag tag : tags.values()) {
        writer.write(tag.getName());
        writer.write("=");
        for (String blogEntry : tag.getBlogEntries()) {
          writer.write(blogEntry);
          writer.write(",");
        }
        writer.newLine();
      }

      writer.flush();
      writer.close();
    } catch (Exception e) {
      log.error("Error while writing index", e);
    //#tagindex.java:177: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:error(Object, Throwable)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.index.TagIndex
    //#    method: void writeIndex()
    //#    unanalyzed callee: void org.apache.commons.logging.Log:error(Object, Throwable)
    }
  }
    //#tagindex.java:179: end of method: void net.sourceforge.pebble.index.TagIndex.writeIndex()

  /**
   * Gets a tag from the index, creating it if necessary.
   *
   * @param name    the tag as a String
   * @return    a Tag instance
   */
  synchronized IndexedTag getTag(String name) {
    String encodedName = Tag.encode(name);
    //#tagindex.java:188: method: IndexedTag net.sourceforge.pebble.index.TagIndex.getTag(String)
    //#input(IndexedTag getTag(String)): name
    //#input(IndexedTag getTag(String)): net/sourceforge/pebble/domain/Tag.__Descendant_Table[net/sourceforge/pebble/domain/Tag]
    //#input(IndexedTag getTag(String)): net/sourceforge/pebble/domain/Tag.__Descendant_Table[net/sourceforge/pebble/index/IndexedTag]
    //#input(IndexedTag getTag(String)): net/sourceforge/pebble/domain/Tag.__Descendant_Table[others]
    //#input(IndexedTag getTag(String)): net/sourceforge/pebble/domain/Tag.__Dispatch_Table.setName(Ljava/lang/String;)V
    //#input(IndexedTag getTag(String)): net/sourceforge/pebble/index/IndexedTag.__Descendant_Table[net/sourceforge/pebble/index/IndexedTag]
    //#input(IndexedTag getTag(String)): net/sourceforge/pebble/index/IndexedTag.__Descendant_Table[others]
    //#input(IndexedTag getTag(String)): net/sourceforge/pebble/index/IndexedTag.__Dispatch_Table.setName(Ljava/lang/String;)V
    //#input(IndexedTag getTag(String)): this
    //#input(IndexedTag getTag(String)): this.blog
    //#input(IndexedTag getTag(String)): this.tags
    //#output(IndexedTag getTag(String)): new ArrayList(IndexedTag#1) num objects
    //#output(IndexedTag getTag(String)): new IndexedTag(getTag#1) num objects
    //#output(IndexedTag getTag(String)): new IndexedTag(getTag#1).__Tag
    //#output(IndexedTag getTag(String)): new IndexedTag(getTag#1).blog
    //#output(IndexedTag getTag(String)): new IndexedTag(getTag#1).blogEntries
    //#output(IndexedTag getTag(String)): new IndexedTag(getTag#1).name
    //#output(IndexedTag getTag(String)): return_value
    //#new obj(IndexedTag getTag(String)): new ArrayList(IndexedTag#1)
    //#new obj(IndexedTag getTag(String)): new IndexedTag(getTag#1)
    //#pre[4] (IndexedTag getTag(String)): this.tags != null
    //#pre[3] (IndexedTag getTag(String)): (soft) init'ed(this.blog)
    //#presumption(IndexedTag getTag(String)): java.util.Map:get(...).__Tag@189 == net/sourceforge/pebble/index/IndexedTag
    //#post(IndexedTag getTag(String)): return_value != null
    //#post(IndexedTag getTag(String)): new ArrayList(IndexedTag#1) num objects <= 1
    //#post(IndexedTag getTag(String)): new IndexedTag(getTag#1) num objects <= 1
    //#post(IndexedTag getTag(String)): new IndexedTag(getTag#1).__Tag == net/sourceforge/pebble/index/IndexedTag
    //#post(IndexedTag getTag(String)): new IndexedTag(getTag#1).blog == this.blog
    //#post(IndexedTag getTag(String)): (soft) init'ed(new IndexedTag(getTag#1).blog)
    //#post(IndexedTag getTag(String)): new IndexedTag(getTag#1).blogEntries == &new ArrayList(IndexedTag#1)
    //#post(IndexedTag getTag(String)): new IndexedTag(getTag#1).name != null
    //#unanalyzed(IndexedTag getTag(String)): Effects-of-calling:java.lang.String:trim
    //#unanalyzed(IndexedTag getTag(String)): Effects-of-calling:java.lang.String:toLowerCase
    //#unanalyzed(IndexedTag getTag(String)): Effects-of-calling:java.lang.String:replaceAll
    //#unanalyzed(IndexedTag getTag(String)): Effects-of-calling:java.util.ArrayList
    //#test_vector(IndexedTag getTag(String)): java.util.Map:get(...)@189: Inverse{null}, Addr_Set{null}
    IndexedTag tag = tags.get(encodedName);
    if (tag == null) {
      tag = new IndexedTag(name, blog);
      tags.put(encodedName, tag);
    }
    return tag;
    //#tagindex.java:194: end of method: IndexedTag net.sourceforge.pebble.index.TagIndex.getTag(String)
  }

  private synchronized void recalculateTagRankings() {
    if (tags.size() > 0) {
    //#tagindex.java:198: method: void net.sourceforge.pebble.index.TagIndex.recalculateTagRankings()
    //#input(void recalculateTagRankings()): net/sourceforge/pebble/index/IndexedTag.__Descendant_Table[net/sourceforge/pebble/index/IndexedTag]
    //#input(void recalculateTagRankings()): net/sourceforge/pebble/index/IndexedTag.__Descendant_Table[others]
    //#input(void recalculateTagRankings()): net/sourceforge/pebble/index/IndexedTag.__Dispatch_Table.calculateRank([I)V
    //#input(void recalculateTagRankings()): net/sourceforge/pebble/index/IndexedTag.__Dispatch_Table.getNumberOfBlogEntries()I
    //#input(void recalculateTagRankings()): this
    //#input(void recalculateTagRankings()): this.tags
    //#output(void recalculateTagRankings()): new ArrayList(recalculateTagRankings#2) num objects
    //#output(void recalculateTagRankings()): this.orderedTags
    //#new obj(void recalculateTagRankings()): new ArrayList(recalculateTagRankings#2)
    //#pre[3] (void recalculateTagRankings()): this.tags != null
    //#presumption(void recalculateTagRankings()): java.lang.Math:round(...)@209 in -2_147_483_648..4_294_967_295
    //#presumption(void recalculateTagRankings()): java.util.Iterator:next(...).__Tag@201 == net/sourceforge/pebble/index/IndexedTag
    //#presumption(void recalculateTagRankings()): java.util.Iterator:next(...).__Tag@215 == net/sourceforge/pebble/index/IndexedTag
    //#presumption(void recalculateTagRankings()): java.util.Iterator:next(...)@201 != null
    //#presumption(void recalculateTagRankings()): java.util.Iterator:next(...)@215 != null
    //#presumption(void recalculateTagRankings()): java.util.Map:values(...)@201 != null
    //#presumption(void recalculateTagRankings()): java.util.Map:values(...)@215 != null
    //#presumption(void recalculateTagRankings()): tag.blogEntries@201 != null
    //#presumption(void recalculateTagRankings()): tag.blogEntries@202 != null
    //#presumption(void recalculateTagRankings()): tag.blogEntries@215 != null
    //#presumption(void recalculateTagRankings()): tag.blogEntries@216 != null
    //#post(void recalculateTagRankings()): this.orderedTags == One-of{old this.orderedTags, &new ArrayList(recalculateTagRankings#2)}
    //#post(void recalculateTagRankings()): new ArrayList(recalculateTagRankings#2) num objects <= 1
    //#unanalyzed(void recalculateTagRankings()): Effects-of-calling:java.util.List:size
    //#test_vector(void recalculateTagRankings()): java.util.Iterator:hasNext(...)@201: {1}, {0}
    //#test_vector(void recalculateTagRankings()): java.util.Iterator:hasNext(...)@215: {1}, {0}
    //#test_vector(void recalculateTagRankings()): java.util.List:size(...)@100: {-2_147_483_648..0}, {1..4_294_967_295}
    //#test_vector(void recalculateTagRankings()): java.util.Map:size(...)@198: {-2_147_483_648..0}, {1..4_294_967_295}
      // find the maximum
      int maxBlogEntries = 0;
      for (IndexedTag tag : tags.values()) {
        if (tag.getNumberOfBlogEntries() > maxBlogEntries) {
          maxBlogEntries = tag.getNumberOfBlogEntries();
        }
      }

      int[] thresholds = new int[10];
      for (int i = 0; i < 10; i++) {
        thresholds[i] = (int)Math.round((maxBlogEntries/10.0) * (i+1));
      }

      orderedTags = new ArrayList<Tag>();

      // now rank the tags
      for (IndexedTag tag : tags.values()) {
        tag.calculateRank(thresholds);
    //#tagindex.java:216: ?precondition failure
    //#    net/sourceforge/pebble/index/IndexedTag.calculateRank: (soft) init'ed(thresholds[0..4_294_967_295])
    //#    severity: SUPPRESSED
    //#    class: net.sourceforge.pebble.index.TagIndex
    //#    method: void recalculateTagRankings()
    //#    basic block: bb_15
    //#    assertion: (soft) init'ed(thresholds[0..4_294_967_295])
    //#    callee: void net/sourceforge/pebble/index/IndexedTag.calculateRank(int[])
    //#    callee assertion: (soft) init'ed(thresholds[0..4_294_967_295])
    //#    callee file: indexedtag.java
    //#    callee precondition index: [7]
    //#    callee srcpos: 117
    //#    VN: thresholds[0..4_294_967_295]
    //#    Expected: {-2_147_483_648..4_294_967_295}
    //#    Bad: {Invalid}
    //#    Attribs:  Int  Soft  Bad only invalid  Uncertain

        if (tag.getNumberOfBlogEntries() > 0) {
          orderedTags.add(tag);
        }
      }

      Collections.sort(orderedTags);
    }

  }
    //#tagindex.java:226: end of method: void net.sourceforge.pebble.index.TagIndex.recalculateTagRankings()

  /**
   * Gets the list of tags associated with this blog.
   */
  public List<Tag> getTags() {
    return new ArrayList<Tag>(orderedTags);
    //#tagindex.java:232: method: List net.sourceforge.pebble.index.TagIndex.getTags()
    //#input(List getTags()): this
    //#input(List getTags()): this.orderedTags
    //#output(List getTags()): new ArrayList(getTags#1) num objects
    //#output(List getTags()): return_value
    //#new obj(List getTags()): new ArrayList(getTags#1)
    //#pre[2] (List getTags()): init'ed(this.orderedTags)
    //#post(List getTags()): return_value == &new ArrayList(getTags#1)
    //#post(List getTags()): new ArrayList(getTags#1) num objects == 1
    //#tagindex.java:232: end of method: List net.sourceforge.pebble.index.TagIndex.getTags()
  }

  /**
   * Gets the blog entries for a given tag.
   *
   * @param tag   a tag
   * @return  a List of blog entry IDs
   */
  public List<String> getRecentBlogEntries(Tag tag) {
    return new ArrayList<String>(getTag(tag.getName()).getBlogEntries());
    //#tagindex.java:242: method: List net.sourceforge.pebble.index.TagIndex.getRecentBlogEntries(Tag)
    //#tagindex.java:242: Warning: suspicious precondition
    //#    the precondition for tag.__Tag is not a contiguous range of values
    //#    severity: SUPPRESSED
    //#    class: net.sourceforge.pebble.index.TagIndex
    //#    method: List getRecentBlogEntries(Tag)
    //#    suspicious precondition index: [2]
    //#input(List getRecentBlogEntries(Tag)): __Descendant_Table[net/sourceforge/pebble/index/TagIndex]
    //#input(List getRecentBlogEntries(Tag)): __Descendant_Table[others]
    //#input(List getRecentBlogEntries(Tag)): __Dispatch_Table.getTag(Ljava/lang/String;)Lnet/sourceforge/pebble/index/IndexedTag;
    //#input(List getRecentBlogEntries(Tag)): net/sourceforge/pebble/domain/Tag.__Descendant_Table[net/sourceforge/pebble/domain/Tag]
    //#input(List getRecentBlogEntries(Tag)): net/sourceforge/pebble/domain/Tag.__Descendant_Table[net/sourceforge/pebble/index/IndexedTag]
    //#input(List getRecentBlogEntries(Tag)): net/sourceforge/pebble/domain/Tag.__Descendant_Table[others]
    //#input(List getRecentBlogEntries(Tag)): net/sourceforge/pebble/domain/Tag.__Dispatch_Table.getName()Ljava/lang/String;
    //#input(List getRecentBlogEntries(Tag)): net/sourceforge/pebble/domain/Tag.__Dispatch_Table.setName(Ljava/lang/String;)V
    //#input(List getRecentBlogEntries(Tag)): net/sourceforge/pebble/index/IndexedTag.__Descendant_Table[net/sourceforge/pebble/index/IndexedTag]
    //#input(List getRecentBlogEntries(Tag)): net/sourceforge/pebble/index/IndexedTag.__Descendant_Table[others]
    //#input(List getRecentBlogEntries(Tag)): net/sourceforge/pebble/index/IndexedTag.__Dispatch_Table.getBlogEntries()Ljava/util/List;
    //#input(List getRecentBlogEntries(Tag)): net/sourceforge/pebble/index/IndexedTag.__Dispatch_Table.getName()Ljava/lang/String;
    //#input(List getRecentBlogEntries(Tag)): net/sourceforge/pebble/index/IndexedTag.__Dispatch_Table.setName(Ljava/lang/String;)V
    //#input(List getRecentBlogEntries(Tag)): tag
    //#input(List getRecentBlogEntries(Tag)): tag.__Tag
    //#input(List getRecentBlogEntries(Tag)): tag.name
    //#input(List getRecentBlogEntries(Tag)): this
    //#input(List getRecentBlogEntries(Tag)): this.__Tag
    //#input(List getRecentBlogEntries(Tag)): this.blog
    //#input(List getRecentBlogEntries(Tag)): this.tags
    //#output(List getRecentBlogEntries(Tag)): new ArrayList(getRecentBlogEntries#1) num objects
    //#output(List getRecentBlogEntries(Tag)): return_value
    //#new obj(List getRecentBlogEntries(Tag)): new ArrayList(getRecentBlogEntries#1)
    //#pre[1] (List getRecentBlogEntries(Tag)): tag != null
    //#pre[2] (List getRecentBlogEntries(Tag)): tag.__Tag in {net/sourceforge/pebble/domain/Tag, net/sourceforge/pebble/index/IndexedTag}
    //#pre[3] (List getRecentBlogEntries(Tag)): init'ed(tag.name)
    //#pre[5] (List getRecentBlogEntries(Tag)): this.__Tag == net/sourceforge/pebble/index/TagIndex
    //#pre[7] (List getRecentBlogEntries(Tag)): this.tags != null
    //#pre[6] (List getRecentBlogEntries(Tag)): (soft) init'ed(this.blog)
    //#presumption(List getRecentBlogEntries(Tag)): getTag(...).__Tag@242 == net/sourceforge/pebble/index/IndexedTag
    //#post(List getRecentBlogEntries(Tag)): return_value == &new ArrayList(getRecentBlogEntries#1)
    //#post(List getRecentBlogEntries(Tag)): new ArrayList(getRecentBlogEntries#1) num objects == 1
    //#unanalyzed(List getRecentBlogEntries(Tag)): Effects-of-calling:encode
    //#unanalyzed(List getRecentBlogEntries(Tag)): Effects-of-calling:java.util.Map:get
    //#unanalyzed(List getRecentBlogEntries(Tag)): Effects-of-calling:net.sourceforge.pebble.index.IndexedTag
    //#unanalyzed(List getRecentBlogEntries(Tag)): Effects-of-calling:java.util.Map:put
    //#unanalyzed(List getRecentBlogEntries(Tag)): Effects-of-calling:java.lang.String:trim
    //#unanalyzed(List getRecentBlogEntries(Tag)): Effects-of-calling:java.lang.String:toLowerCase
    //#unanalyzed(List getRecentBlogEntries(Tag)): Effects-of-calling:java.lang.String:replaceAll
    //#unanalyzed(List getRecentBlogEntries(Tag)): Effects-of-calling:java.util.ArrayList
    //#tagindex.java:242: end of method: List net.sourceforge.pebble.index.TagIndex.getRecentBlogEntries(Tag)
  }

}
    //#tagindex.java:: end of class: net.sourceforge.pebble.index.TagIndex
