//# 0 errors, 119 messages
//#
/*
    //#refererfilter.java:1:1: class: net.sourceforge.pebble.domain.RefererFilter
    //#refererfilter.java:1:1: method: net.sourceforge.pebble.domain.RefererFilter.net.sourceforge.pebble.domain.RefererFilter__static_init
 * 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.domain;

import java.util.regex.Pattern;

/**
 * Represents a blog category.
 *
 * @author    Simon Brown
 */
public class RefererFilter implements Comparable {

  // the internal ID for this filter
  private long id;

  /** the underlying filter expression */
  private String expression;

  /** the compiled version of the expression */
  private Pattern compiledExpression;

  public RefererFilter() {
    //#refererfilter.java:52: method: void net.sourceforge.pebble.domain.RefererFilter.net.sourceforge.pebble.domain.RefererFilter()
  }
    //#refererfilter.java:53: end of method: void net.sourceforge.pebble.domain.RefererFilter.net.sourceforge.pebble.domain.RefererFilter()

  /**
   * Creates a new category with the specified properties.
   *
   * @param expression    the filter expression
   */
  public RefererFilter(String expression) {
    //#refererfilter.java:60: method: void net.sourceforge.pebble.domain.RefererFilter.net.sourceforge.pebble.domain.RefererFilter(String)
    //#input(void net.sourceforge.pebble.domain.RefererFilter(String)): __Descendant_Table[net/sourceforge/pebble/domain/RefererFilter]
    //#input(void net.sourceforge.pebble.domain.RefererFilter(String)): __Descendant_Table[others]
    //#input(void net.sourceforge.pebble.domain.RefererFilter(String)): __Dispatch_Table.setExpression(Ljava/lang/String;)V
    //#input(void net.sourceforge.pebble.domain.RefererFilter(String)): expression
    //#input(void net.sourceforge.pebble.domain.RefererFilter(String)): this
    //#input(void net.sourceforge.pebble.domain.RefererFilter(String)): this.__Tag
    //#output(void net.sourceforge.pebble.domain.RefererFilter(String)): this.compiledExpression
    //#output(void net.sourceforge.pebble.domain.RefererFilter(String)): this.expression
    //#pre[3] (void net.sourceforge.pebble.domain.RefererFilter(String)): this.__Tag == net/sourceforge/pebble/domain/RefererFilter
    //#post(void net.sourceforge.pebble.domain.RefererFilter(String)): init'ed(this.compiledExpression)
    //#post(void net.sourceforge.pebble.domain.RefererFilter(String)): this.expression == One-of{&"", expression}
    //#post(void net.sourceforge.pebble.domain.RefererFilter(String)): this.expression != null
    //#unanalyzed(void net.sourceforge.pebble.domain.RefererFilter(String)): Effects-of-calling:java.util.regex.Pattern:compile
    setExpression(expression);
  }
    //#refererfilter.java:62: end of method: void net.sourceforge.pebble.domain.RefererFilter.net.sourceforge.pebble.domain.RefererFilter(String)

  void setId(long id) {
    this.id = id;
    //#refererfilter.java:65: method: void net.sourceforge.pebble.domain.RefererFilter.setId(long)
    //#input(void setId(long)): id
    //#input(void setId(long)): this
    //#output(void setId(long)): this.id
    //#post(void setId(long)): this.id == id
    //#post(void setId(long)): init'ed(this.id)
  }
    //#refererfilter.java:66: end of method: void net.sourceforge.pebble.domain.RefererFilter.setId(long)

  public long getId() {
    return this.id;
    //#refererfilter.java:69: method: long net.sourceforge.pebble.domain.RefererFilter.getId()
    //#input(long getId()): this
    //#input(long getId()): this.id
    //#output(long getId()): return_value
    //#pre[2] (long getId()): init'ed(this.id)
    //#post(long getId()): return_value == this.id
    //#post(long getId()): init'ed(return_value)
    //#refererfilter.java:69: end of method: long net.sourceforge.pebble.domain.RefererFilter.getId()
  }

  /**
   * Gets the expression.
   *
   * @return    the expression as a String
   */
  public String getExpression() {
    return this.expression;
    //#refererfilter.java:78: method: String net.sourceforge.pebble.domain.RefererFilter.getExpression()
    //#input(String getExpression()): this
    //#input(String getExpression()): this.expression
    //#output(String getExpression()): return_value
    //#pre[2] (String getExpression()): init'ed(this.expression)
    //#post(String getExpression()): return_value == this.expression
    //#post(String getExpression()): init'ed(return_value)
    //#refererfilter.java:78: end of method: String net.sourceforge.pebble.domain.RefererFilter.getExpression()
  }

  /**
   * Sets the expression.
   *
   * @param expression    the expression as a String
   */
  public void setExpression(String expression) {
    if (expression == null) {
    //#refererfilter.java:87: method: void net.sourceforge.pebble.domain.RefererFilter.setExpression(String)
    //#input(void setExpression(String)): expression
    //#input(void setExpression(String)): this
    //#output(void setExpression(String)): this.compiledExpression
    //#output(void setExpression(String)): this.expression
    //#post(void setExpression(String)): init'ed(this.compiledExpression)
    //#post(void setExpression(String)): this.expression == One-of{&"", expression}
    //#post(void setExpression(String)): this.expression != null
    //#test_vector(void setExpression(String)): expression: Inverse{null}, Addr_Set{null}
      this.expression = "";
    } else {
      this.expression = expression;
    }
    this.compiledExpression = Pattern.compile(this.expression);
  }
    //#refererfilter.java:93: end of method: void net.sourceforge.pebble.domain.RefererFilter.setExpression(String)

  /**
   * Gets the compiled version of the expression.
   *
   * @return    the compiled expression as a Pattern
   */
  public Pattern getCompiledExpression() {
    return this.compiledExpression;
    //#refererfilter.java:101: method: Pattern net.sourceforge.pebble.domain.RefererFilter.getCompiledExpression()
    //#input(Pattern getCompiledExpression()): this
    //#input(Pattern getCompiledExpression()): this.compiledExpression
    //#output(Pattern getCompiledExpression()): return_value
    //#pre[2] (Pattern getCompiledExpression()): init'ed(this.compiledExpression)
    //#post(Pattern getCompiledExpression()): return_value == this.compiledExpression
    //#post(Pattern getCompiledExpression()): init'ed(return_value)
    //#refererfilter.java:101: end of method: Pattern net.sourceforge.pebble.domain.RefererFilter.getCompiledExpression()
  }

  /**
   * Gets the hashcode of this object.
   *
   * @return  the hashcode as an int
   */
  public int hashCode() {
    return expression.hashCode();
    //#refererfilter.java:110: method: int net.sourceforge.pebble.domain.RefererFilter.hashCode()
    //#input(int hashCode()): this
    //#input(int hashCode()): this.expression
    //#output(int hashCode()): return_value
    //#pre[2] (int hashCode()): this.expression != null
    //#post(int hashCode()): init'ed(return_value)
    //#refererfilter.java:110: end of method: int net.sourceforge.pebble.domain.RefererFilter.hashCode()
  }

  /**
   * Determines whether the specified object is equal to this one.
   *
   * @param o   the object to compare against
   * @return    true if Object o represents the same category, false otherwise
   */
  public boolean equals(Object o) {
    if (!(o instanceof RefererFilter)) {
    //#refererfilter.java:120: method: bool net.sourceforge.pebble.domain.RefererFilter.equals(Object)
    //#input(bool equals(Object)): __Descendant_Table[net/sourceforge/pebble/domain/RefererFilter]
    //#input(bool equals(Object)): __Descendant_Table[others]
    //#input(bool equals(Object)): __Dispatch_Table.getExpression()Ljava/lang/String;
    //#input(bool equals(Object)): o
    //#input(bool equals(Object)): o.__Tag
    //#input(bool equals(Object)): o.expression
    //#input(bool equals(Object)): this
    //#input(bool equals(Object)): this.expression
    //#output(bool equals(Object)): return_value
    //#pre[3] (bool equals(Object)): (soft) o.expression != null
    //#pre[5] (bool equals(Object)): (soft) init'ed(this.expression)
    //#post(bool equals(Object)): init'ed(return_value)
      return false;
    }

    RefererFilter filter = (RefererFilter)o;
    return (filter.getExpression().equals(expression));
    //#refererfilter.java:125: end of method: bool net.sourceforge.pebble.domain.RefererFilter.equals(Object)
  }

  /**
   * Compares this object with the specified object for order.  Returns a
   * negative integer, zero, or a positive integer if this object is less
   * than, equal to, or greater than the specified object.
   *
   * @param   o the Object to be compared.
   * @return  a negative integer, zero, or a positive integer if this object
   *		is less than, equal to, or greater than the specified object.
   *
   * @throws ClassCastException if the specified object's type prevents it
   *         from being compared to this Object.
   */
  public int compareTo(Object o) {
    RefererFilter category = (RefererFilter)o;
    //#refererfilter.java:141: method: int net.sourceforge.pebble.domain.RefererFilter.compareTo(Object)
    //#input(int compareTo(Object)): __Descendant_Table[net/sourceforge/pebble/domain/RefererFilter]
    //#input(int compareTo(Object)): __Descendant_Table[others]
    //#input(int compareTo(Object)): __Dispatch_Table.getExpression()Ljava/lang/String;
    //#input(int compareTo(Object)): o
    //#input(int compareTo(Object)): o.__Tag
    //#input(int compareTo(Object)): o.expression
    //#input(int compareTo(Object)): this
    //#input(int compareTo(Object)): this.__Tag
    //#input(int compareTo(Object)): this.expression
    //#output(int compareTo(Object)): return_value
    //#pre[1] (int compareTo(Object)): o != null
    //#pre[2] (int compareTo(Object)): o.__Tag == net/sourceforge/pebble/domain/RefererFilter
    //#pre[3] (int compareTo(Object)): init'ed(o.expression)
    //#pre[5] (int compareTo(Object)): this.__Tag == net/sourceforge/pebble/domain/RefererFilter
    //#pre[6] (int compareTo(Object)): this.expression != null
    //#post(int compareTo(Object)): init'ed(return_value)
    return getExpression().compareTo(category.getExpression());
    //#refererfilter.java:142: end of method: int net.sourceforge.pebble.domain.RefererFilter.compareTo(Object)
  }

}    //#output(net.sourceforge.pebble.domain.RefererFilter__static_init): __Descendant_Table[net/sourceforge/pebble/domain/RefererFilter]
    //#output(net.sourceforge.pebble.domain.RefererFilter__static_init): __Dispatch_Table.compareTo(Ljava/lang/Object;)I
    //#output(net.sourceforge.pebble.domain.RefererFilter__static_init): __Dispatch_Table.equals(Ljava/lang/Object;)Z
    //#output(net.sourceforge.pebble.domain.RefererFilter__static_init): __Dispatch_Table.getCompiledExpression()Ljava/util/regex/Pattern;
    //#output(net.sourceforge.pebble.domain.RefererFilter__static_init): __Dispatch_Table.getExpression()Ljava/lang/String;
    //#output(net.sourceforge.pebble.domain.RefererFilter__static_init): __Dispatch_Table.getId()J
    //#output(net.sourceforge.pebble.domain.RefererFilter__static_init): __Dispatch_Table.hashCode()I
    //#output(net.sourceforge.pebble.domain.RefererFilter__static_init): __Dispatch_Table.setExpression(Ljava/lang/String;)V
    //#output(net.sourceforge.pebble.domain.RefererFilter__static_init): __Dispatch_Table.setId(J)V
    //#post(net.sourceforge.pebble.domain.RefererFilter__static_init): __Descendant_Table[net/sourceforge/pebble/domain/RefererFilter] == &__Dispatch_Table
    //#post(net.sourceforge.pebble.domain.RefererFilter__static_init): __Dispatch_Table.compareTo(Ljava/lang/Object;)I == &compareTo
    //#post(net.sourceforge.pebble.domain.RefererFilter__static_init): __Dispatch_Table.equals(Ljava/lang/Object;)Z == &equals
    //#post(net.sourceforge.pebble.domain.RefererFilter__static_init): __Dispatch_Table.getCompiledExpression()Ljava/util/regex/Pattern; == &getCompiledExpression
    //#post(net.sourceforge.pebble.domain.RefererFilter__static_init): __Dispatch_Table.getExpression()Ljava/lang/String; == &getExpression
    //#post(net.sourceforge.pebble.domain.RefererFilter__static_init): __Dispatch_Table.getId()J == &getId
    //#post(net.sourceforge.pebble.domain.RefererFilter__static_init): __Dispatch_Table.hashCode()I == &hashCode
    //#post(net.sourceforge.pebble.domain.RefererFilter__static_init): __Dispatch_Table.setExpression(Ljava/lang/String;)V == &setExpression
    //#post(net.sourceforge.pebble.domain.RefererFilter__static_init): __Dispatch_Table.setId(J)V == &setId
    //#refererfilter.java:: end of method: net.sourceforge.pebble.domain.RefererFilter.net.sourceforge.pebble.domain.RefererFilter__static_init
    //#refererfilter.java:: end of class: net.sourceforge.pebble.domain.RefererFilter
