1 package fr.orsay.lri.varna.models.rna;
4 import java.io.Serializable;
5 import java.util.ArrayList;
6 import java.util.Hashtable;
8 import javax.xml.transform.sax.TransformerHandler;
10 import org.xml.sax.SAXException;
11 import org.xml.sax.helpers.AttributesImpl;
13 import fr.orsay.lri.varna.models.rna.ModeleBackboneElement.BackboneType;
14 import fr.orsay.lri.varna.utils.XMLUtils;
16 public class ModeleBackbone implements Serializable{
21 private Hashtable<Integer,ModeleBackboneElement> elems = new Hashtable<Integer,ModeleBackboneElement>();
23 private static final long serialVersionUID = -614968737102943216L;
27 public static String XML_ELEMENT_NAME = "backbone";
29 public void toXML(TransformerHandler hd) throws SAXException
31 AttributesImpl atts = new AttributesImpl();
32 hd.startElement("","",XML_ELEMENT_NAME,atts);
33 for (ModeleBackboneElement bck:elems.values())
37 hd.endElement("","",XML_ELEMENT_NAME);
41 public void addElement(ModeleBackboneElement mbe)
43 elems.put(mbe.getIndex(),mbe);
46 public BackboneType getTypeBefore(int indexBase)
48 return getTypeAfter(indexBase-1);
51 public BackboneType getTypeAfter(int indexBase)
53 if (elems.containsKey(indexBase))
54 return elems.get(indexBase).getType();
56 return BackboneType.SOLID_TYPE;
59 public Color getColorBefore(int indexBase, Color defCol)
61 return getColorAfter(indexBase-1,defCol);
64 public Color getColorAfter(int indexBase, Color defCol)
66 if (elems.containsKey(indexBase))
68 Color c = elems.get(indexBase).getColor();