@@ -0,0 +1,2015 @@
+/**%0A * Copyright (C) 2012 Karsten Schulz %3Clennylinux.ks@googlemail.com%3E%0A *%0A * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and%0A * associated documentation files (the %22Software%22), to deal in the Software without restriction,%0A * including without limitation the rights to use, copy, modify, merge, publish, distribute,%0A * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is%0A * furnished to do so, subject to the following conditions:%0A *%0A * The above copyright notice and this permission notice shall be included in all copies or%0A * substantial portions of the Software.%0A *%0A * THE SOFTWARE IS PROVIDED %22AS IS%22, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT%0A * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND%0A * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,%0A * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT%0A * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.%0A */%0Apackage com.google.code.tickconverter.util;%0A%0Aimport java.util.Comparator;%0A%0Aimport com.google.code.tickconverter.bean.IDukascopyRO;%0A%0A/**%0A * @author Karsten Schulz %3Ca href=%22mailto:lennylinux.ks@googlmail.com%22%3E(lennylinux.ks@googlmail.com)%3C/a%3E%0A */%0Apublic final class DukascopyAskBidComparator%0A    implements Comparator%3CIDukascopyRO%3E%0A%7B%0A%0A    /*%0A     * (non-Javadoc)%0A     * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)%0A     */%0A    @Override%0A    public int compare( final IDukascopyRO o1, final IDukascopyRO o2 )%0A    %7B%0A        double valueFirst = ( o1.getAsk() + o1.getBid() ) / 2;%0A        double valueSecond = ( o2.getAsk() + o2.getBid() ) / 2;%0A        double diff = valueFirst - valueSecond;%0A%0A        if ( diff %3C 0 )%0A        %7B%0A            return -1;%0A        %7D%0A        if ( diff %3E 0 )%0A        %7B%0A            return 1;%0A        %7D%0A        return 0;%0A    %7D%0A%0A%7D%0A

implement an ask and bid comparator