File Source: BookmarkComparator.java

         /* 
    P/P   *  Method: org.apache.roller.weblogger.pojos.BookmarkComparator__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 java.io.Serializable;
    21  import java.util.Comparator;
    22  
         /* 
    P/P   *  Method: void org.apache.roller.weblogger.pojos.BookmarkComparator()
          */
    23  public class BookmarkComparator implements Comparator, Serializable
    24  {
    25      static final long serialVersionUID = 4009699640952161148L;
    26      
    27      public int compare(Object val1, Object val2)
    28      throws ClassCastException
    29      {
                 /* 
    P/P           *  Method: int compare(Object, Object)
                  * 
                  *  Preconditions:
                  *    val1 != null
                  *    val2 != null
                  * 
                  *  Presumptions:
                  *    org.apache.roller.weblogger.pojos.WeblogBookmark:getName(...)@46 != null
                  *    org.apache.roller.weblogger.pojos.WeblogBookmark:getPriority(...)@32 != null
                  *    org.apache.roller.weblogger.pojos.WeblogBookmark:getPriority(...)@33 != null
                  * 
                  *  Postconditions:
                  *    init'ed(return_value)
                  */
    30          WeblogBookmark bd1 = (WeblogBookmark)val1;
    31          WeblogBookmark bd2 = (WeblogBookmark)val2;
    32          int priority1 = bd1.getPriority().intValue();
    33          int priority2 = bd2.getPriority().intValue();
    34  
    35          if (priority1 > priority2)
    36          {
    37              return 1;
    38          }
    39          else if (priority1 < priority2)
    40          {
    41              return -1;
    42          }
    43  
    44          // if priorities are the same, return
    45          // results of String.compareTo()
    46          return bd1.getName().compareTo(bd2.getName());
    47  
    48      }
    49  
    50  }








SofCheck Inspector Build Version : 2.18479
BookmarkComparator.java 2009-Jan-02 14:24:48
BookmarkComparator.class 2009-Sep-04 03:12:30