File Source: StatCount.java

         /* 
    P/P   *  Method: org.apache.roller.weblogger.pojos.StatCount__static_init
          */
     1  /*
     2  * Licensed to the Apache Software Foundation (ASF) under one or more
     3  *  contributor license agreements.  The ASF licenses this file to You
     4  * under the Apache License, Version 2.0 (the "License"); you may not
     5  * use this file except in compliance with the License.
     6  * You may obtain a copy of the License at
     7  *
     8  *     http://www.apache.org/licenses/LICENSE-2.0
     9  *
    10  * Unless required by applicable law or agreed to in writing, software
    11  * distributed under the License is distributed on an "AS IS" BASIS,
    12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  * See the License for the specific language governing permissions and
    14  * limitations under the License.  For additional information regarding
    15  * copyright in this work, please see the NOTICE file in the top level
    16  * directory of this distribution.
    17  */
    18  package org.apache.roller.weblogger.pojos;
    19  
    20  import org.apache.commons.lang.builder.EqualsBuilder;
    21  import org.apache.commons.lang.builder.HashCodeBuilder;
    22  
    23  /**
    24   * Represents a statistical count.
    25   */
    26  public class StatCount { 
    27      
    28      /** Id of the subject of the statistic */
    29      private String subjectId;
    30      
    31      /** Short name of the subject of the statistic */
    32      private String subjectNameShort;
    33      
    34      /** Long name of the subject of the statistic */
    35      private String subjectNameLong; 
    36      
    37      /** I18N key that describes the type of statistic */
    38      private String typeKey;
    39      
    40      /** The statistical count */    
    41      private long count;
    42      
    43      /** Weblog handle of weblog that stat is associated with, or null if none */
    44      private String weblogHandle = null;
    45  
             /* 
    P/P       *  Method: void org.apache.roller.weblogger.pojos.StatCount(String, String, String, String, long)
              * 
              *  Postconditions:
              *    this.count == count
              *    init'ed(this.count)
              *    this.subjectId == subjectId
              *    init'ed(this.subjectId)
              *    this.subjectNameLong == subjectNameLong
              *    init'ed(this.subjectNameLong)
              *    this.subjectNameShort == subjectNameShort
              *    init'ed(this.subjectNameShort)
              *    this.typeKey == typeKey
              *    init'ed(this.typeKey)
              *    ...
              */
    46      public StatCount(String subjectId, String subjectNameShort, String subjectNameLong, String typeKey, long count) {
    47          this.setSubjectId(subjectId);
    48          this.setSubjectNameShort(subjectNameShort);
    49          this.setSubjectNameLong(subjectNameLong);
    50          this.setTypeKey(typeKey);
    51          this.setCount(count);
    52      } 
    53      
    54      public String getTypeKey() {
                 /* 
    P/P           *  Method: String getTypeKey()
                  * 
                  *  Preconditions:
                  *    init'ed(this.typeKey)
                  * 
                  *  Postconditions:
                  *    return_value == this.typeKey
                  *    init'ed(return_value)
                  */
    55          return typeKey;
    56      }
    57      
    58      public void setTypeKey(String typeKey) {
                 /* 
    P/P           *  Method: void setTypeKey(String)
                  * 
                  *  Postconditions:
                  *    this.typeKey == typeKey
                  *    init'ed(this.typeKey)
                  */
    59          this.typeKey = typeKey;
    60      }
    61      
    62      public long getCount() {
                 /* 
    P/P           *  Method: long getCount()
                  * 
                  *  Preconditions:
                  *    init'ed(this.count)
                  * 
                  *  Postconditions:
                  *    return_value == this.count
                  *    init'ed(return_value)
                  */
    63          return count;
    64      }
    65      
    66      public void setCount(long count) {
                 /* 
    P/P           *  Method: void setCount(long)
                  * 
                  *  Postconditions:
                  *    this.count == count
                  *    init'ed(this.count)
                  */
    67          this.count = count;
    68      }
    69      
    70      public String getSubjectId() {
                 /* 
    P/P           *  Method: String getSubjectId()
                  * 
                  *  Preconditions:
                  *    init'ed(this.subjectId)
                  * 
                  *  Postconditions:
                  *    return_value == this.subjectId
                  *    init'ed(return_value)
                  */
    71          return subjectId;
    72      }
    73      
    74      public void setSubjectId(String subjectId) {
                 /* 
    P/P           *  Method: void setSubjectId(String)
                  * 
                  *  Postconditions:
                  *    this.subjectId == subjectId
                  *    init'ed(this.subjectId)
                  */
    75          this.subjectId = subjectId;
    76      }
    77      
    78      public String getSubjectNameShort() {
                 /* 
    P/P           *  Method: String getSubjectNameShort()
                  * 
                  *  Preconditions:
                  *    init'ed(this.subjectNameShort)
                  * 
                  *  Postconditions:
                  *    return_value == this.subjectNameShort
                  *    init'ed(return_value)
                  */
    79          return subjectNameShort;
    80      }
    81      
    82      public void setSubjectNameShort(String subjectNameShort) {
                 /* 
    P/P           *  Method: void setSubjectNameShort(String)
                  * 
                  *  Postconditions:
                  *    this.subjectNameShort == subjectNameShort
                  *    init'ed(this.subjectNameShort)
                  */
    83          this.subjectNameShort = subjectNameShort;
    84      }
    85      
    86      public String getSubjectNameLong() {
                 /* 
    P/P           *  Method: String getSubjectNameLong()
                  * 
                  *  Preconditions:
                  *    init'ed(this.subjectNameLong)
                  * 
                  *  Postconditions:
                  *    return_value == this.subjectNameLong
                  *    init'ed(return_value)
                  */
    87          return subjectNameLong;
    88      }
    89      
    90      public void setSubjectNameLong(String subjectNameLong) {
                 /* 
    P/P           *  Method: void setSubjectNameLong(String)
                  * 
                  *  Postconditions:
                  *    this.subjectNameLong == subjectNameLong
                  *    init'ed(this.subjectNameLong)
                  */
    91          this.subjectNameLong = subjectNameLong;
    92      }
    93  
    94      public String getWeblogHandle() {
                 /* 
    P/P           *  Method: String getWeblogHandle()
                  * 
                  *  Preconditions:
                  *    init'ed(this.weblogHandle)
                  * 
                  *  Postconditions:
                  *    return_value == this.weblogHandle
                  *    init'ed(return_value)
                  */
    95          return weblogHandle;
    96      }
    97  
    98      public void setWeblogHandle(String weblogHandle) {
                 /* 
    P/P           *  Method: void setWeblogHandle(String)
                  * 
                  *  Postconditions:
                  *    this.weblogHandle == weblogHandle
                  *    init'ed(this.weblogHandle)
                  */
    99          this.weblogHandle = weblogHandle;
   100      }
   101      
   102      //------------------------------------------------------- Good citizenship
   103  
   104      public String toString() {
                 /* 
    P/P           *  Method: String toString()
                  * 
                  *  Preconditions:
                  *    init'ed(this.count)
                  *    init'ed(this.weblogHandle)
                  * 
                  *  Postconditions:
                  *    java.lang.StringBuffer:toString(...)._tainted == this.weblogHandle._tainted
                  *    init'ed(java.lang.StringBuffer:toString(...)._tainted)
                  *    return_value == &java.lang.StringBuffer:toString(...)
                  */
   105          StringBuffer buf = new StringBuffer();
   106          buf.append("{");
   107          buf.append(this.weblogHandle);
   108          buf.append(", ").append(this.count);
   109          buf.append("}");
   110          return buf.toString();
   111      }
   112  
   113      public boolean equals(Object other) {
                 /* 
    P/P           *  Method: bool equals(Object)
                  * 
                  *  Preconditions:
                  *    (soft) init'ed(other.subjectId)
                  *    (soft) init'ed(other.typeKey)
                  *    (soft) init'ed(this.subjectId)
                  *    (soft) init'ed(this.typeKey)
                  * 
                  *  Presumptions:
                  *    org.apache.commons.lang.builder.EqualsBuilder:append(...)@117 != null
                  * 
                  *  Postconditions:
                  *    init'ed(return_value)
                  * 
                  *  Test Vectors:
                  *    other == this: {0}, {1}
                  */
   114          if (other == this) return true;
   115          if (other instanceof StatCount != true) return false;
   116          StatCount o = (StatCount)other;
   117          return new EqualsBuilder()
   118              .append(getSubjectId(), o.getSubjectId()) 
   119              .append(getTypeKey(), o.getTypeKey()) 
   120              .isEquals();
   121      }
   122      
   123      public int hashCode() { 
                 /* 
    P/P           *  Method: int hashCode()
                  * 
                  *  Preconditions:
                  *    init'ed(this.subjectId)
                  *    init'ed(this.typeKey)
                  * 
                  *  Presumptions:
                  *    org.apache.commons.lang.builder.HashCodeBuilder:append(...)@124 != null
                  * 
                  *  Postconditions:
                  *    init'ed(return_value)
                  */
   124          return new HashCodeBuilder()
   125              .append(getSubjectId())
   126              .append(getTypeKey())
   127              .toHashCode();
   128      }
   129  }








SofCheck Inspector Build Version : 2.18479
StatCount.java 2009-Jan-02 14:25:40
StatCount.class 2009-Sep-04 03:12:32