2 * BioJava development code
4 * This code may be freely distributed and modified under the
5 * terms of the GNU Lesser General Public Licence. This should
6 * be distributed with the code. If you do not have a copy,
9 * http://www.gnu.org/copyleft/lesser.html
11 * Copyright for this code is held jointly by the individual
12 * authors. These should be listed in @author doc comments.
14 * For more information on the BioJava project and its aims,
15 * or to join the biojava-l mailing list, visit the home page
18 * http://www.biojava.org/
20 * Created on 23.09.2004
21 * @author Andreas Prlic
25 package org.biojava.dasobert.feature;
27 import java.util.Comparator;
31 * a comparator to sort Features if they are still in a Map ( sorts by type )
33 * @author Andreas Prlic
36 public class FeatureMapComparator implements Comparator
39 public FeatureMapComparator()
43 public int compare(Object a, Object b)
48 String typea = (String) x.get("TYPE");
49 String typeb = (String) y.get("TYPE");
51 if (isSecstruc(typea) && isSecstruc(typeb))
55 return typea.compareTo(typeb);
58 public boolean isSecstruc(String type)
60 if (type.equals("HELIX") || type.equals("STRAND")
61 || type.equals("TURN"))