/* Copyright (c) 2011 Peter Troshin * * JAva Bioinformatics Analysis Web Services (JABAWS) @version: 2.0 * * This library is free software; you can redistribute it and/or modify it under the terms of the * Apache License version 2 as published by the Apache Software Foundation * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Apache * License for more details. * * A copy of the license is in apache_license.txt. It is also available here: * @see: http://www.apache.org/licenses/LICENSE-2.0.txt * * Any republication or derived work distributed in source code form * must include this copyright and license notice. */ package compbio.pipeline._jpred; import java.util.Comparator; public class Hit { String name; String number; String accession; String seq; String evalue; @Override public String toString() { return "accession=" + accession + ", name=" + name + ", num=" + number + ", evalue=" + evalue + "\n"; // + ", seq=" + seq + } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((name == null) ? 0 : name.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Hit other = (Hit) obj; if (name == null) { if (other.name != null) return false; } else if (!name.equals(other.name)) return false; return true; } public static final class NumberComporator implements Comparator { @Override public int compare(Hit o1, Hit o2) { return Integer.valueOf(o1.number).compareTo( Integer.valueOf(o2.number)); } } public static final class EvalueComporator implements Comparator { @Override public int compare(Hit o1, Hit o2) { return Double.valueOf(o1.evalue).compareTo( Double.valueOf(o2.evalue)); } } }