//# 1 errors, 232 messages
//#
/*
    //#referer.java:1:1: class: net.sourceforge.pebble.logging.Referer
 * 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.logging;

import java.net.URLDecoder;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * Represents a referer URL along with a count of how many times
 * it has been refered from.
 *
 * @author    Simon Brown
 */
public class Referer extends CountedUrl {

  /** regular expression to pull out the query from a Google referer */
  private static final Pattern GOOGLE_QUERY_STRING_PATTERN = Pattern.compile("[?&]q=[^&]+&*");
    //#referer.java:47: method: net.sourceforge.pebble.logging.Referer.net.sourceforge.pebble.logging.Referer__static_init
    //#output(net.sourceforge.pebble.logging.Referer__static_init): BING_QUERY_STRING_PATTERN
    //#output(net.sourceforge.pebble.logging.Referer__static_init): GOOGLE_IMAGES_QUERY_STRING_PATTERN
    //#output(net.sourceforge.pebble.logging.Referer__static_init): GOOGLE_QUERY_STRING_PATTERN
    //#output(net.sourceforge.pebble.logging.Referer__static_init): JAVABLOGS_HOT_ENTRIES_PATTERN
    //#output(net.sourceforge.pebble.logging.Referer__static_init): JAVABLOGS_WELCOME_PATTERN
    //#output(net.sourceforge.pebble.logging.Referer__static_init): MSN_QUERY_STRING_PATTERN
    //#output(net.sourceforge.pebble.logging.Referer__static_init): YAHOO_QUERY_STRING_PATTERN
    //#output(net.sourceforge.pebble.logging.Referer__static_init): __Descendant_Table[net/sourceforge/pebble/logging/Referer]
    //#output(net.sourceforge.pebble.logging.Referer__static_init): __Dispatch_Table.addLogEntry(Lnet/sourceforge/pebble/logging/LogEntry;)V
    //#output(net.sourceforge.pebble.logging.Referer__static_init): __Dispatch_Table.equals(Ljava/lang/Object;)Z
    //#output(net.sourceforge.pebble.logging.Referer__static_init): __Dispatch_Table.extractQuery(Ljava/util/regex/Pattern;Ljava/lang/String;)Ljava/lang/String;
    //#output(net.sourceforge.pebble.logging.Referer__static_init): __Dispatch_Table.getCount()I
    //#output(net.sourceforge.pebble.logging.Referer__static_init): __Dispatch_Table.getDomainFilter()Ljava/lang/String;
    //#output(net.sourceforge.pebble.logging.Referer__static_init): __Dispatch_Table.getLogEntries()Ljava/util/List;
    //#output(net.sourceforge.pebble.logging.Referer__static_init): __Dispatch_Table.getName()Ljava/lang/String;
    //#output(net.sourceforge.pebble.logging.Referer__static_init): __Dispatch_Table.getTruncatedName()Ljava/lang/String;
    //#output(net.sourceforge.pebble.logging.Referer__static_init): __Dispatch_Table.getUrl()Ljava/lang/String;
    //#output(net.sourceforge.pebble.logging.Referer__static_init): __Dispatch_Table.hashCode()I
    //#output(net.sourceforge.pebble.logging.Referer__static_init): __Dispatch_Table.isFileDownload()Z
    //#output(net.sourceforge.pebble.logging.Referer__static_init): __Dispatch_Table.isNewsFeed()Z
    //#output(net.sourceforge.pebble.logging.Referer__static_init): __Dispatch_Table.isPageView()Z
    //#output(net.sourceforge.pebble.logging.Referer__static_init): __Dispatch_Table.setFileDownload(Z)V
    //#output(net.sourceforge.pebble.logging.Referer__static_init): __Dispatch_Table.setName(Ljava/lang/String;)V
    //#output(net.sourceforge.pebble.logging.Referer__static_init): __Dispatch_Table.setNewsFeed(Z)V
    //#output(net.sourceforge.pebble.logging.Referer__static_init): __Dispatch_Table.setPageView(Z)V
    //#output(net.sourceforge.pebble.logging.Referer__static_init): __Dispatch_Table.setUrl(Ljava/lang/String;)V
    //#output(net.sourceforge.pebble.logging.Referer__static_init): net/sourceforge/pebble/logging/CountedUrl.__Descendant_Table[net/sourceforge/pebble/logging/Referer]
    //#post(net.sourceforge.pebble.logging.Referer__static_init): init'ed(BING_QUERY_STRING_PATTERN)
    //#post(net.sourceforge.pebble.logging.Referer__static_init): init'ed(GOOGLE_IMAGES_QUERY_STRING_PATTERN)
    //#post(net.sourceforge.pebble.logging.Referer__static_init): init'ed(GOOGLE_QUERY_STRING_PATTERN)
    //#post(net.sourceforge.pebble.logging.Referer__static_init): init'ed(JAVABLOGS_HOT_ENTRIES_PATTERN)
    //#post(net.sourceforge.pebble.logging.Referer__static_init): init'ed(JAVABLOGS_WELCOME_PATTERN)
    //#post(net.sourceforge.pebble.logging.Referer__static_init): init'ed(MSN_QUERY_STRING_PATTERN)
    //#post(net.sourceforge.pebble.logging.Referer__static_init): init'ed(YAHOO_QUERY_STRING_PATTERN)
    //#post(net.sourceforge.pebble.logging.Referer__static_init): __Descendant_Table[net/sourceforge/pebble/logging/Referer] == &__Dispatch_Table
    //#post(net.sourceforge.pebble.logging.Referer__static_init): net/sourceforge/pebble/logging/CountedUrl.__Descendant_Table[net/sourceforge/pebble/logging/Referer] == &__Dispatch_Table
    //#post(net.sourceforge.pebble.logging.Referer__static_init): __Dispatch_Table.addLogEntry(Lnet/sourceforge/pebble/logging/LogEntry;)V == &net/sourceforge/pebble/logging/CountedUrl.addLogEntry
    //#post(net.sourceforge.pebble.logging.Referer__static_init): __Dispatch_Table.equals(Ljava/lang/Object;)Z == &net/sourceforge/pebble/logging/CountedUrl.equals
    //#post(net.sourceforge.pebble.logging.Referer__static_init): __Dispatch_Table.extractQuery(Ljava/util/regex/Pattern;Ljava/lang/String;)Ljava/lang/String; == &extractQuery
    //#post(net.sourceforge.pebble.logging.Referer__static_init): __Dispatch_Table.getCount()I == &net/sourceforge/pebble/logging/CountedUrl.getCount
    //#post(net.sourceforge.pebble.logging.Referer__static_init): __Dispatch_Table.getDomainFilter()Ljava/lang/String; == &getDomainFilter
    //#post(net.sourceforge.pebble.logging.Referer__static_init): __Dispatch_Table.getLogEntries()Ljava/util/List; == &net/sourceforge/pebble/logging/CountedUrl.getLogEntries
    //#post(net.sourceforge.pebble.logging.Referer__static_init): __Dispatch_Table.getName()Ljava/lang/String; == &net/sourceforge/pebble/logging/CountedUrl.getName
    //#post(net.sourceforge.pebble.logging.Referer__static_init): __Dispatch_Table.getTruncatedName()Ljava/lang/String; == &net/sourceforge/pebble/logging/CountedUrl.getTruncatedName
    //#post(net.sourceforge.pebble.logging.Referer__static_init): __Dispatch_Table.getUrl()Ljava/lang/String; == &net/sourceforge/pebble/logging/CountedUrl.getUrl
    //#post(net.sourceforge.pebble.logging.Referer__static_init): __Dispatch_Table.hashCode()I == &net/sourceforge/pebble/logging/CountedUrl.hashCode
    //#post(net.sourceforge.pebble.logging.Referer__static_init): __Dispatch_Table.isFileDownload()Z == &net/sourceforge/pebble/logging/CountedUrl.isFileDownload
    //#post(net.sourceforge.pebble.logging.Referer__static_init): __Dispatch_Table.isNewsFeed()Z == &net/sourceforge/pebble/logging/CountedUrl.isNewsFeed
    //#post(net.sourceforge.pebble.logging.Referer__static_init): __Dispatch_Table.isPageView()Z == &net/sourceforge/pebble/logging/CountedUrl.isPageView
    //#post(net.sourceforge.pebble.logging.Referer__static_init): __Dispatch_Table.setFileDownload(Z)V == &net/sourceforge/pebble/logging/CountedUrl.setFileDownload
    //#post(net.sourceforge.pebble.logging.Referer__static_init): __Dispatch_Table.setName(Ljava/lang/String;)V == &net/sourceforge/pebble/logging/CountedUrl.setName
    //#post(net.sourceforge.pebble.logging.Referer__static_init): __Dispatch_Table.setNewsFeed(Z)V == &net/sourceforge/pebble/logging/CountedUrl.setNewsFeed
    //#post(net.sourceforge.pebble.logging.Referer__static_init): __Dispatch_Table.setPageView(Z)V == &net/sourceforge/pebble/logging/CountedUrl.setPageView
    //#post(net.sourceforge.pebble.logging.Referer__static_init): __Dispatch_Table.setUrl(Ljava/lang/String;)V == &setUrl

  /** the prefix for all Google referers */
  private static final String GOOGLE_PREFIX = "http://www.google.";

  /** regular expression to pull out the query from a Google referer */
  private static final Pattern GOOGLE_IMAGES_QUERY_STRING_PATTERN = Pattern.compile("[?&]prev=[^&]+&*");

  /** the prefix for all Google imagesearch referers */
  private static final String GOOGLE_IMAGES_PREFIX = "http://images.google.";

  /** regular expression to pull out the query from a Yahoo! referer */
  private static final Pattern YAHOO_QUERY_STRING_PATTERN = Pattern.compile("[?&]p=[^&]+&*");

  /** the prefix for all Yahoo! referers */
  private static final String YAHOO_PREFIX = "http://search.yahoo.";

  /** regular expression to pull out the query from an MSN referer */
  private static final Pattern MSN_QUERY_STRING_PATTERN = Pattern.compile("[?&]q=[^&]+&*");

  /** the prefix for all MSN referers */
  private static final String MSN_PREFIX = "http://search.msn.";

  /** the prefix for all MSN Beta referers */
  private static final String MSN_BETA_PREFIX = "http://beta.search.msn.";

  /** regular expression to pull out the query from an BING referer */
  private static final Pattern BING_QUERY_STRING_PATTERN = Pattern.compile("[?&]q=[^&]+&*");

  /** the prefix for all BING referers */
  private static final String BING_PREFIX = "http://www.bing.com";

  /** pattern for java.blogs welcome page referers */
  private static final Pattern JAVABLOGS_WELCOME_PATTERN = Pattern.compile(".*javablogs.com/Welcome.*");

  /** pattern for java.blogs hot entries page referers */
  private static final Pattern JAVABLOGS_HOT_ENTRIES_PATTERN = Pattern.compile(".*javablogs.com/ViewHotBlogEntries.*");
    //#referer.java:83: end of method: net.sourceforge.pebble.logging.Referer.net.sourceforge.pebble.logging.Referer__static_init

  /**
   * Creates a new instance representing the specified url.
   *
   * @param url   the url as a String
   */
  public Referer(String url) {
    super(url);
    //#referer.java:91: method: void net.sourceforge.pebble.logging.Referer.net.sourceforge.pebble.logging.Referer(String)
    //#referer.java:91: Warning: suspicious precondition
    //#    the precondition for this.__Tag is not a contiguous range of values
    //#    severity: SUPPRESSED
    //#    class: net.sourceforge.pebble.logging.Referer
    //#    method: void net.sourceforge.pebble.logging.Referer(String)
    //#    suspicious precondition index: [1]
    //#input(void net.sourceforge.pebble.logging.Referer(String)): BING_QUERY_STRING_PATTERN
    //#input(void net.sourceforge.pebble.logging.Referer(String)): GOOGLE_IMAGES_QUERY_STRING_PATTERN
    //#input(void net.sourceforge.pebble.logging.Referer(String)): GOOGLE_QUERY_STRING_PATTERN
    //#input(void net.sourceforge.pebble.logging.Referer(String)): JAVABLOGS_HOT_ENTRIES_PATTERN
    //#input(void net.sourceforge.pebble.logging.Referer(String)): JAVABLOGS_WELCOME_PATTERN
    //#input(void net.sourceforge.pebble.logging.Referer(String)): MSN_QUERY_STRING_PATTERN
    //#input(void net.sourceforge.pebble.logging.Referer(String)): YAHOO_QUERY_STRING_PATTERN
    //#input(void net.sourceforge.pebble.logging.Referer(String)): __Descendant_Table[net/sourceforge/pebble/logging/Referer]
    //#input(void net.sourceforge.pebble.logging.Referer(String)): __Descendant_Table[others]
    //#input(void net.sourceforge.pebble.logging.Referer(String)): __Dispatch_Table.setName(Ljava/lang/String;)V
    //#input(void net.sourceforge.pebble.logging.Referer(String)): __Dispatch_Table.setUrl(Ljava/lang/String;)V
    //#input(void net.sourceforge.pebble.logging.Referer(String)): net/sourceforge/pebble/logging/CountedUrl.__Descendant_Table[net/sourceforge/pebble/logging/CountedUrl]
    //#input(void net.sourceforge.pebble.logging.Referer(String)): net/sourceforge/pebble/logging/CountedUrl.__Descendant_Table[net/sourceforge/pebble/logging/Referer]
    //#input(void net.sourceforge.pebble.logging.Referer(String)): net/sourceforge/pebble/logging/CountedUrl.__Descendant_Table[net/sourceforge/pebble/logging/Request]
    //#input(void net.sourceforge.pebble.logging.Referer(String)): net/sourceforge/pebble/logging/CountedUrl.__Descendant_Table[others]
    //#input(void net.sourceforge.pebble.logging.Referer(String)): net/sourceforge/pebble/logging/CountedUrl.__Dispatch_Table.setUrl(Ljava/lang/String;)V
    //#input(void net.sourceforge.pebble.logging.Referer(String)): net/sourceforge/pebble/logging/Request.AUTHOR_FEED_REGEX
    //#input(void net.sourceforge.pebble.logging.Referer(String)): net/sourceforge/pebble/logging/Request.CATEGORY_FEED_REGEX
    //#input(void net.sourceforge.pebble.logging.Referer(String)): net/sourceforge/pebble/logging/Request.RESPONSES_FEED_REGEX
    //#input(void net.sourceforge.pebble.logging.Referer(String)): net/sourceforge/pebble/logging/Request.TAG_FEED_REGEX
    //#input(void net.sourceforge.pebble.logging.Referer(String)): net/sourceforge/pebble/logging/Request.__Descendant_Table[net/sourceforge/pebble/logging/Request]
    //#input(void net.sourceforge.pebble.logging.Referer(String)): net/sourceforge/pebble/logging/Request.__Descendant_Table[others]
    //#input(void net.sourceforge.pebble.logging.Referer(String)): net/sourceforge/pebble/logging/Request.__Dispatch_Table.getName()Ljava/lang/String;
    //#input(void net.sourceforge.pebble.logging.Referer(String)): net/sourceforge/pebble/logging/Request.__Dispatch_Table.setFileDownload(Z)V
    //#input(void net.sourceforge.pebble.logging.Referer(String)): net/sourceforge/pebble/logging/Request.__Dispatch_Table.setName(Ljava/lang/String;)V
    //#input(void net.sourceforge.pebble.logging.Referer(String)): net/sourceforge/pebble/logging/Request.__Dispatch_Table.setNewsFeed(Z)V
    //#input(void net.sourceforge.pebble.logging.Referer(String)): net/sourceforge/pebble/logging/Request.__Dispatch_Table.setPageView(Z)V
    //#input(void net.sourceforge.pebble.logging.Referer(String)): net/sourceforge/pebble/logging/Request.__Dispatch_Table.setUrl(Ljava/lang/String;)V
    //#input(void net.sourceforge.pebble.logging.Referer(String)): net/sourceforge/pebble/permalink/DefaultPermalinkProvider.__Descendant_Table[net/sourceforge/pebble/permalink/DefaultPermalinkProvider]
    //#input(void net.sourceforge.pebble.logging.Referer(String)): net/sourceforge/pebble/permalink/DefaultPermalinkProvider.__Dispatch_Table.setBlog(Lnet/sourceforge/pebble/domain/Blog;)V
    //#input(void net.sourceforge.pebble.logging.Referer(String)): this
    //#input(void net.sourceforge.pebble.logging.Referer(String)): this.__Tag
    //#input(void net.sourceforge.pebble.logging.Referer(String)): url
    //#output(void net.sourceforge.pebble.logging.Referer(String)): new LinkedList(CountedUrl#1) num objects
    //#output(void net.sourceforge.pebble.logging.Referer(String)): this.__Tag
    //#output(void net.sourceforge.pebble.logging.Referer(String)): this.blog
    //#output(void net.sourceforge.pebble.logging.Referer(String)): this.fileDownload
    //#output(void net.sourceforge.pebble.logging.Referer(String)): this.logEntries
    //#output(void net.sourceforge.pebble.logging.Referer(String)): this.name
    //#output(void net.sourceforge.pebble.logging.Referer(String)): this.newsFeed
    //#output(void net.sourceforge.pebble.logging.Referer(String)): this.pageView
    //#output(void net.sourceforge.pebble.logging.Referer(String)): this.url
    //#new obj(void net.sourceforge.pebble.logging.Referer(String)): new LinkedList(CountedUrl#1)
    //#pre[1] (void net.sourceforge.pebble.logging.Referer(String)): this.__Tag in {net/sourceforge/pebble/logging/CountedUrl, net/sourceforge/pebble/logging/Referer, net/sourceforge/pebble/logging/Request}
    //#post(void net.sourceforge.pebble.logging.Referer(String)): this.__Tag == old this.__Tag
    //#post(void net.sourceforge.pebble.logging.Referer(String)): this.__Tag in {net/sourceforge/pebble/logging/CountedUrl, net/sourceforge/pebble/logging/Referer, net/sourceforge/pebble/logging/Request}
    //#post(void net.sourceforge.pebble.logging.Referer(String)): init'ed(this.blog)
    //#post(void net.sourceforge.pebble.logging.Referer(String)): init'ed(this.fileDownload)
    //#post(void net.sourceforge.pebble.logging.Referer(String)): this.logEntries == &new LinkedList(CountedUrl#1)
    //#post(void net.sourceforge.pebble.logging.Referer(String)): possibly_updated(this.name)
    //#post(void net.sourceforge.pebble.logging.Referer(String)): init'ed(this.newsFeed)
    //#post(void net.sourceforge.pebble.logging.Referer(String)): init'ed(this.pageView)
    //#post(void net.sourceforge.pebble.logging.Referer(String)): init'ed(this.url)
    //#post(void net.sourceforge.pebble.logging.Referer(String)): new LinkedList(CountedUrl#1) num objects == 1
    //#unanalyzed(void net.sourceforge.pebble.logging.Referer(String)): Effects-of-calling:java.util.LinkedList
    //#unanalyzed(void net.sourceforge.pebble.logging.Referer(String)): Effects-of-calling:net.sourceforge.pebble.api.permalink.PermalinkProvider:isBlogEntryPermalink
    //#unanalyzed(void net.sourceforge.pebble.logging.Referer(String)): Effects-of-calling:net.sourceforge.pebble.api.permalink.PermalinkProvider:getBlogEntry
    //#unanalyzed(void net.sourceforge.pebble.logging.Referer(String)): Effects-of-calling:java.lang.StringBuilder
    //#unanalyzed(void net.sourceforge.pebble.logging.Referer(String)): Effects-of-calling:net.sourceforge.pebble.domain.BlogEntry:getTitle
    //#unanalyzed(void net.sourceforge.pebble.logging.Referer(String)): Effects-of-calling:java.lang.StringBuilder:append
    //#unanalyzed(void net.sourceforge.pebble.logging.Referer(String)): Effects-of-calling:java.lang.StringBuilder:toString
    //#unanalyzed(void net.sourceforge.pebble.logging.Referer(String)): Effects-of-calling:setName
    //#unanalyzed(void net.sourceforge.pebble.logging.Referer(String)): Effects-of-calling:setPageView
    //#unanalyzed(void net.sourceforge.pebble.logging.Referer(String)): Effects-of-calling:net.sourceforge.pebble.api.permalink.PermalinkProvider:isMonthPermalink
    //#unanalyzed(void net.sourceforge.pebble.logging.Referer(String)): Effects-of-calling:net.sourceforge.pebble.api.permalink.PermalinkProvider:getMonth
    //#unanalyzed(void net.sourceforge.pebble.logging.Referer(String)): Effects-of-calling:net.sourceforge.pebble.domain.Blog:getLocale
    //#unanalyzed(void net.sourceforge.pebble.logging.Referer(String)): Effects-of-calling:java.text.SimpleDateFormat
    //#unanalyzed(void net.sourceforge.pebble.logging.Referer(String)): Effects-of-calling:net.sourceforge.pebble.domain.Blog:getTimeZone
    //#unanalyzed(void net.sourceforge.pebble.logging.Referer(String)): Effects-of-calling:java.text.SimpleDateFormat:setTimeZone
    //#unanalyzed(void net.sourceforge.pebble.logging.Referer(String)): Effects-of-calling:net.sourceforge.pebble.domain.Month:getDate
    //#unanalyzed(void net.sourceforge.pebble.logging.Referer(String)): Effects-of-calling:java.text.SimpleDateFormat:format
    //#unanalyzed(void net.sourceforge.pebble.logging.Referer(String)): Effects-of-calling:net.sourceforge.pebble.api.permalink.PermalinkProvider:isDayPermalink
    //#unanalyzed(void net.sourceforge.pebble.logging.Referer(String)): Effects-of-calling:net.sourceforge.pebble.api.permalink.PermalinkProvider:getDay
    //#unanalyzed(void net.sourceforge.pebble.logging.Referer(String)): Effects-of-calling:net.sourceforge.pebble.domain.Day:getDate
    //#unanalyzed(void net.sourceforge.pebble.logging.Referer(String)): Effects-of-calling:setUrl
    //#unanalyzed(void net.sourceforge.pebble.logging.Referer(String)): Effects-of-calling:java.lang.String:length
    //#unanalyzed(void net.sourceforge.pebble.logging.Referer(String)): Effects-of-calling:java.util.regex.Pattern:matcher
    //#unanalyzed(void net.sourceforge.pebble.logging.Referer(String)): Effects-of-calling:java.util.regex.Matcher:matches
    //#unanalyzed(void net.sourceforge.pebble.logging.Referer(String)): Effects-of-calling:setNewsFeed
    //#unanalyzed(void net.sourceforge.pebble.logging.Referer(String)): Effects-of-calling:java.lang.String:lastIndexOf
    //#unanalyzed(void net.sourceforge.pebble.logging.Referer(String)): Effects-of-calling:java.lang.String:substring
    //#unanalyzed(void net.sourceforge.pebble.logging.Referer(String)): Effects-of-calling:java.lang.String:indexOf
    //#unanalyzed(void net.sourceforge.pebble.logging.Referer(String)): Effects-of-calling:java.lang.String:equals
    //#unanalyzed(void net.sourceforge.pebble.logging.Referer(String)): Effects-of-calling:java.lang.String:startsWith
    //#unanalyzed(void net.sourceforge.pebble.logging.Referer(String)): Effects-of-calling:java.lang.String:endsWith
    //#unanalyzed(void net.sourceforge.pebble.logging.Referer(String)): Effects-of-calling:setFileDownload
    //#unanalyzed(void net.sourceforge.pebble.logging.Referer(String)): Effects-of-calling:net.sourceforge.pebble.domain.Blog:getPermalinkProvider
    //#unanalyzed(void net.sourceforge.pebble.logging.Referer(String)): Effects-of-calling:getName
    //#unanalyzed(void net.sourceforge.pebble.logging.Referer(String)): Effects-of-calling:java.util.regex.Matcher:find
    //#unanalyzed(void net.sourceforge.pebble.logging.Referer(String)): Effects-of-calling:java.util.regex.Matcher:start
    //#unanalyzed(void net.sourceforge.pebble.logging.Referer(String)): Effects-of-calling:java.util.regex.Matcher:end
    //#unanalyzed(void net.sourceforge.pebble.logging.Referer(String)): Effects-of-calling:java.net.URLDecoder:decode
    //#unanalyzed(void net.sourceforge.pebble.logging.Referer(String)): Effects-of-calling:java.lang.String:equalsIgnoreCase
  }
    //#referer.java:92: end of method: void net.sourceforge.pebble.logging.Referer.net.sourceforge.pebble.logging.Referer(String)

  protected void setUrl(String url) {
    super.setUrl(url);
    //#referer.java:95: method: void net.sourceforge.pebble.logging.Referer.setUrl(String)
    //#input(void setUrl(String)): BING_QUERY_STRING_PATTERN
    //#input(void setUrl(String)): GOOGLE_IMAGES_QUERY_STRING_PATTERN
    //#input(void setUrl(String)): GOOGLE_QUERY_STRING_PATTERN
    //#input(void setUrl(String)): JAVABLOGS_HOT_ENTRIES_PATTERN
    //#input(void setUrl(String)): JAVABLOGS_WELCOME_PATTERN
    //#input(void setUrl(String)): MSN_QUERY_STRING_PATTERN
    //#input(void setUrl(String)): YAHOO_QUERY_STRING_PATTERN
    //#input(void setUrl(String)): __Descendant_Table[net/sourceforge/pebble/logging/Referer]
    //#input(void setUrl(String)): __Descendant_Table[others]
    //#input(void setUrl(String)): __Dispatch_Table.setName(Ljava/lang/String;)V
    //#input(void setUrl(String)): this
    //#input(void setUrl(String)): this.__Tag
    //#input(void setUrl(String)): url
    //#output(void setUrl(String)): this.name
    //#output(void setUrl(String)): this.url
    //#pre[2] (void setUrl(String)): this.__Tag == net/sourceforge/pebble/logging/Referer
    //#presumption(void setUrl(String)): java.util.regex.Pattern:compile(...)@47 != null
    //#presumption(void setUrl(String)): java.util.regex.Pattern:compile(...)@53 != null
    //#presumption(void setUrl(String)): java.util.regex.Pattern:compile(...)@59 != null
    //#presumption(void setUrl(String)): java.util.regex.Pattern:compile(...)@65 != null
    //#presumption(void setUrl(String)): java.util.regex.Pattern:compile(...)@74 != null
    //#presumption(void setUrl(String)): java.util.regex.Pattern:compile(...)@80 != null
    //#presumption(void setUrl(String)): java.util.regex.Pattern:compile(...)@83 != null
    //#presumption(void setUrl(String)): java.util.regex.Pattern:matcher(...)@130 != null
    //#presumption(void setUrl(String)): java.util.regex.Pattern:matcher(...)@132 != null
    //#post(void setUrl(String)): this.name != null
    //#post(void setUrl(String)): this.url == url
    //#post(void setUrl(String)): init'ed(this.url)
    //#unanalyzed(void setUrl(String)): Effects-of-calling:java.util.regex.Pattern:matcher
    //#unanalyzed(void setUrl(String)): Effects-of-calling:java.util.regex.Matcher:find
    //#unanalyzed(void setUrl(String)): Effects-of-calling:java.util.regex.Matcher:start
    //#unanalyzed(void setUrl(String)): Effects-of-calling:java.util.regex.Matcher:end
    //#unanalyzed(void setUrl(String)): Effects-of-calling:java.lang.String:substring
    //#unanalyzed(void setUrl(String)): Effects-of-calling:java.lang.String:endsWith
    //#unanalyzed(void setUrl(String)): Effects-of-calling:java.lang.String:length
    //#unanalyzed(void setUrl(String)): Effects-of-calling:java.net.URLDecoder:decode
    //#test_vector(void setUrl(String)): url: Addr_Set{null}, Inverse{null}
    //#test_vector(void setUrl(String)): java.lang.String:equalsIgnoreCase(...)@100: {0}, {1}
    //#test_vector(void setUrl(String)): java.lang.String:equalsIgnoreCase(...)@105: {0}, {1}
    //#test_vector(void setUrl(String)): java.lang.String:equalsIgnoreCase(...)@111: {0}, {1}
    //#test_vector(void setUrl(String)): java.lang.String:equalsIgnoreCase(...)@116: {0}, {1}
    //#test_vector(void setUrl(String)): java.lang.String:equalsIgnoreCase(...)@121: {0}, {1}
    //#test_vector(void setUrl(String)): java.lang.String:equalsIgnoreCase(...)@126: {0}, {1}
    //#test_vector(void setUrl(String)): java.lang.String:length(...)@97: {1..4_294_967_295}, {0}
    //#test_vector(void setUrl(String)): java.util.regex.Matcher:matches(...)@130: {0}, {1}
    //#test_vector(void setUrl(String)): java.util.regex.Matcher:matches(...)@132: {0}, {1}

    if (url == null || url.length() == 0) {
      setName("None");
    } else if (url.length() > GOOGLE_PREFIX.length() &&
        url.substring(0, GOOGLE_PREFIX.length()).equalsIgnoreCase(GOOGLE_PREFIX)) {

      String query = extractQuery(GOOGLE_QUERY_STRING_PATTERN, url);
      setName("Google : " + query);
    } else if (url.length() > GOOGLE_IMAGES_PREFIX.length() &&
        url.substring(0, GOOGLE_IMAGES_PREFIX.length()).equalsIgnoreCase(GOOGLE_IMAGES_PREFIX)) {

      String query = extractQuery(GOOGLE_IMAGES_QUERY_STRING_PATTERN, url);
      query = extractQuery(GOOGLE_QUERY_STRING_PATTERN, query);
    //#referer.java:108: ?precondition failure
    //#    net/sourceforge/pebble/logging/Referer.extractQuery: (soft) url != null
    //#    severity: SUPPRESSED
    //#    class: net.sourceforge.pebble.logging.Referer
    //#    method: void setUrl(String)
    //#    basic block: bb_9
    //#    assertion: (soft) extractQuery(...) != null
    //#    callee: String net/sourceforge/pebble/logging/Referer.extractQuery(Pattern, String)
    //#    callee assertion: (soft) url != null
    //#    callee file: referer.java
    //#    callee precondition index: [2]
    //#    callee srcpos: 140
    //#    VN: extractQuery(...)
    //#    Expected: Inverse{null}
    //#    Bad: Addr_Set{null}
    //#    Attribs:  Ptr  null in Bad  Soft
      setName("Google Images : " + query);
    } else if (url.length() > YAHOO_PREFIX.length() &&
        url.substring(0, YAHOO_PREFIX.length()).equalsIgnoreCase(YAHOO_PREFIX)) {

      String query = extractQuery(YAHOO_QUERY_STRING_PATTERN, url);
      setName("Yahoo! : " + query);
    } else if (url.length() > MSN_PREFIX.length() &&
        url.substring(0, MSN_PREFIX.length()).equalsIgnoreCase(MSN_PREFIX)) {

      String query = extractQuery(MSN_QUERY_STRING_PATTERN, url);
      setName("MSN : " + query);
    } else if (url.length() > MSN_BETA_PREFIX.length() &&
        url.substring(0, MSN_BETA_PREFIX.length()).equalsIgnoreCase(MSN_BETA_PREFIX)) {

      String query = extractQuery(MSN_QUERY_STRING_PATTERN, url);
      setName("MSN beta : " + query);
    } else if (url.length() >= BING_PREFIX.length() &&
        url.substring(0, BING_PREFIX.length()).equalsIgnoreCase(BING_PREFIX)) {

      String query = extractQuery(BING_QUERY_STRING_PATTERN, url);
      setName("Bing : " + query);
    } else if (JAVABLOGS_WELCOME_PATTERN.matcher(url).matches()) {
      setName("java.blogs : Welcome");
    } else if (JAVABLOGS_HOT_ENTRIES_PATTERN.matcher(url).matches()) {
      setName("java.blogs : Hot Entries");
    } else {
      setName(url);
    }
  }
    //#referer.java:137: end of method: void net.sourceforge.pebble.logging.Referer.setUrl(String)

  private String extractQuery(Pattern pattern, String url) {
    Matcher m = pattern.matcher(url);
    //#referer.java:140: method: String net.sourceforge.pebble.logging.Referer.extractQuery(Pattern, String)
    //#input(String extractQuery(Pattern, String)): pattern
    //#input(String extractQuery(Pattern, String)): url
    //#output(String extractQuery(Pattern, String)): return_value
    //#pre[1] (String extractQuery(Pattern, String)): pattern != null
    //#pre[2] (String extractQuery(Pattern, String)): (soft) url != null
    //#presumption(String extractQuery(Pattern, String)): java.util.regex.Matcher:start(...)@143 <= 4_294_967_292
    //#presumption(String extractQuery(Pattern, String)): java.util.regex.Pattern:matcher(...)@140 != null
    //#post(String extractQuery(Pattern, String)): init'ed(return_value)
    //#test_vector(String extractQuery(Pattern, String)): java.lang.String:endsWith(...)@146: {0}, {1}
    //#test_vector(String extractQuery(Pattern, String)): java.util.regex.Matcher:find(...)@142: {0}, {1}
    String query = "";
    if (m.find()) {
      int start = m.start();
      int end = m.end();
      query = url.substring(start+3, end);
      if (query.endsWith("&")) {
        query = query.substring(0, query.length()-1);
      }
      try {
        query = URLDecoder.decode(query, "UTF-8");
      } catch (Exception e) {
      }
    }

    return query;
    //#referer.java:155: end of method: String net.sourceforge.pebble.logging.Referer.extractQuery(Pattern, String)
  }

  /**
   * Gets a regex expression that will filter out other referers with the same domain.
   *
   * @return  a regex as a String
   */
  public String getDomainFilter() {
    // and set the domain name
    if (getUrl() == null) {
    //#referer.java:165: method: String net.sourceforge.pebble.logging.Referer.getDomainFilter()
    //#input(String getDomainFilter()): __Descendant_Table[net/sourceforge/pebble/logging/Referer]
    //#input(String getDomainFilter()): __Descendant_Table[others]
    //#input(String getDomainFilter()): __Dispatch_Table.getUrl()Ljava/lang/String;
    //#input(String getDomainFilter()): this
    //#input(String getDomainFilter()): this.__Tag
    //#input(String getDomainFilter()): this.url
    //#output(String getDomainFilter()): return_value
    //#pre[2] (String getDomainFilter()): this.__Tag == net/sourceforge/pebble/logging/Referer
    //#pre[3] (String getDomainFilter()): init'ed(this.url)
    //#presumption(String getDomainFilter()): java.lang.String:indexOf(...)@169 <= 4_294_967_292
    //#post(String getDomainFilter()): init'ed(return_value)
    //#test_vector(String getDomainFilter()): this.url: Inverse{null}, Addr_Set{null}
    //#test_vector(String getDomainFilter()): java.lang.String:indexOf(...)@169: {-2_147_483_648..-2, 0..4_294_967_292}, {-1}
    //#test_vector(String getDomainFilter()): java.lang.String:indexOf(...)@175: {-2_147_483_648..-1}, {0..4_294_967_295}
    //#test_vector(String getDomainFilter()): java.lang.String:indexOf(...)@181: {-2_147_483_648..-1}, {0..4_294_967_295}
      return null;
    }

    int index = getUrl().indexOf("://");
    if (index == -1) {
      return getUrl();
    }
    
    String domainName = getUrl().substring(index+3);
    index = domainName.indexOf("/");

    if (index > -1) {
      domainName = domainName.substring(0, index);
    }

    if (domainName.indexOf(":") > -1) {
      // the domain name still has a port number so remove it
      domainName = domainName.substring(0, domainName.indexOf(":"));
    }

    return ".*" + domainName + ".*";
    //#referer.java:186: end of method: String net.sourceforge.pebble.logging.Referer.getDomainFilter()
  }

}    //#referer.java:: end of class: net.sourceforge.pebble.logging.Referer
