//# 0 errors, 24 messages
//#
/*
    //#BookmarkComparator.java:1:1: class: org.apache.roller.weblogger.pojos.BookmarkComparator
    //#BookmarkComparator.java:1:1: method: org.apache.roller.weblogger.pojos.BookmarkComparator.org.apache.roller.weblogger.pojos.BookmarkComparator__static_init
* Licensed to the Apache Software Foundation (ASF) under one or more
*  contributor license agreements.  The ASF licenses this file to You
* under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*     http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.  For additional information regarding
* copyright in this work, please see the NOTICE file in the top level
* directory of this distribution.
*/
package org.apache.roller.weblogger.pojos;

import java.io.Serializable;
import java.util.Comparator;

public class BookmarkComparator implements Comparator, Serializable
    //#BookmarkComparator.java:23: method: void org.apache.roller.weblogger.pojos.BookmarkComparator.org.apache.roller.weblogger.pojos.BookmarkComparator()
    //#BookmarkComparator.java:23: end of method: void org.apache.roller.weblogger.pojos.BookmarkComparator.org.apache.roller.weblogger.pojos.BookmarkComparator()
{
    static final long serialVersionUID = 4009699640952161148L;
    
    public int compare(Object val1, Object val2)
    throws ClassCastException
    {
        WeblogBookmark bd1 = (WeblogBookmark)val1;
    //#BookmarkComparator.java:30: method: int org.apache.roller.weblogger.pojos.BookmarkComparator.compare(Object, Object)
    //#input(int compare(Object, Object)): val1
    //#input(int compare(Object, Object)): val2
    //#output(int compare(Object, Object)): return_value
    //#pre[1] (int compare(Object, Object)): val1 != null
    //#pre[2] (int compare(Object, Object)): val2 != null
    //#presumption(int compare(Object, Object)): org.apache.roller.weblogger.pojos.WeblogBookmark:getName(...)@46 != null
    //#presumption(int compare(Object, Object)): org.apache.roller.weblogger.pojos.WeblogBookmark:getPriority(...)@32 != null
    //#presumption(int compare(Object, Object)): org.apache.roller.weblogger.pojos.WeblogBookmark:getPriority(...)@33 != null
    //#post(int compare(Object, Object)): init'ed(return_value)
        WeblogBookmark bd2 = (WeblogBookmark)val2;
        int priority1 = bd1.getPriority().intValue();
    //#BookmarkComparator.java:32: Warning: method not available
    //#    -- call on Integer org.apache.roller.weblogger.pojos.WeblogBookmark:getPriority()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.pojos.BookmarkComparator
    //#    method: int compare(Object, Object)
    //#    unanalyzed callee: Integer org.apache.roller.weblogger.pojos.WeblogBookmark:getPriority()
        int priority2 = bd2.getPriority().intValue();
    //#BookmarkComparator.java:33: Warning: method not available
    //#    -- call on Integer org.apache.roller.weblogger.pojos.WeblogBookmark:getPriority()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.pojos.BookmarkComparator
    //#    method: int compare(Object, Object)
    //#    unanalyzed callee: Integer org.apache.roller.weblogger.pojos.WeblogBookmark:getPriority()

        if (priority1 > priority2)
        {
            return 1;
        }
        else if (priority1 < priority2)
        {
            return -1;
        }

        // if priorities are the same, return
        // results of String.compareTo()
        return bd1.getName().compareTo(bd2.getName());
    //#BookmarkComparator.java:46: Warning: method not available
    //#    -- call on String org.apache.roller.weblogger.pojos.WeblogBookmark:getName()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.pojos.BookmarkComparator
    //#    method: int compare(Object, Object)
    //#    unanalyzed callee: String org.apache.roller.weblogger.pojos.WeblogBookmark:getName()
    //#BookmarkComparator.java:46: end of method: int org.apache.roller.weblogger.pojos.BookmarkComparator.compare(Object, Object)

    }

}
    //#output(org.apache.roller.weblogger.pojos.BookmarkComparator__static_init): __Descendant_Table[org/apache/roller/weblogger/pojos/BookmarkComparator]
    //#output(org.apache.roller.weblogger.pojos.BookmarkComparator__static_init): __Dispatch_Table.compare(Ljava/lang/Object;Ljava/lang/Object;)I
    //#post(org.apache.roller.weblogger.pojos.BookmarkComparator__static_init): __Descendant_Table[org/apache/roller/weblogger/pojos/BookmarkComparator] == &__Dispatch_Table
    //#post(org.apache.roller.weblogger.pojos.BookmarkComparator__static_init): __Dispatch_Table.compare(Ljava/lang/Object;Ljava/lang/Object;)I == &compare
    //#BookmarkComparator.java:: end of method: org.apache.roller.weblogger.pojos.BookmarkComparator.org.apache.roller.weblogger.pojos.BookmarkComparator__static_init
    //#BookmarkComparator.java:: end of class: org.apache.roller.weblogger.pojos.BookmarkComparator
