/* **********************************
 *   CheaperDerivativeComparator.java
 *     CheaperDerivativeComparator
 ************************************/
package utils.comparator;

import config.GlobalConfig;
import gen.Derivative;

public class CheaperDerivative extends SameDerivative{
    public CheaperDerivative(Derivative l){ super(l); }

    /** Is Derivative d cheaper than look? */
    public boolean huh(Derivative d) {
        boolean validPrice = look.price.val - d.price.val > -GlobalConfig.MAX_PRICE_ERROR;
        return (d.name.equals(look.name)&&validPrice&&d.seller.equals(look.seller)&&d.type.equals(look.type));
    }
}