2 VARNA is a tool for the automated drawing, visualization and annotation of the secondary structure of RNA, designed as a companion software for web servers and databases.
3 Copyright (C) 2008 Kevin Darty, Alain Denise and Yann Ponty.
4 electronic mail : Yann.Ponty@lri.fr
5 paper mail : LRI, bat 490 Universit� Paris-Sud 91405 Orsay Cedex France
7 This file is part of VARNA version 3.1.
8 VARNA version 3.1 is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
9 as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
11 VARNA version 3.1 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
12 without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 See the GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License along with VARNA version 3.1.
16 If not, see http://www.gnu.org/licenses.
18 package fr.orsay.lri.varna.models.rna;
20 import java.awt.geom.Point2D;
21 import java.io.Serializable;
23 import javax.xml.transform.sax.TransformerHandler;
25 import org.xml.sax.SAXException;
26 import org.xml.sax.helpers.AttributesImpl;
28 import fr.orsay.lri.varna.models.annotations.HighlightRegionAnnotation;
29 import fr.orsay.lri.varna.models.annotations.TextAnnotation;
33 * The abstract rna base model
38 public abstract class ModeleBase implements Serializable, java.lang.Comparable<ModeleBase> {
44 protected ModelBaseStyle _styleBase = new ModelBaseStyle();
46 * TRUE if this InterfaceBase has to be colored, else FALSE.
48 protected Boolean _colorie = new Boolean(true);
50 * The coordinate representation of this InterfaceBase on the final graphic.
52 protected VARNAPoint _coords = new VARNAPoint();
54 * The nearest loop center of this InterfaceBase.
56 protected VARNAPoint _center = new VARNAPoint();
59 * The label of this base.
61 protected String _label = "";
63 protected double _value;
64 protected int _realIndex = -1;
66 public abstract void toXML(TransformerHandler hd) throws SAXException;
71 * The internal index for this Base
73 public abstract int getIndex();
75 public abstract String getContent();
76 public abstract void setContent(String s);
79 * Gets this InterfaceBase style.
81 * @return this InterfaceBase style.
83 public ModelBaseStyle getStyleBase() {
87 public double getValue()
92 public void setValue(double d)
99 * Sets this InterfaceBase style.
102 * - This InterfaceBase new style.
104 public void setStyleBase(ModelBaseStyle base) {
105 _styleBase = new ModelBaseStyle(base);
109 * Gets this InterfaceBase color statement.
111 * @return TRUE if this InterfaceBase has to be colored, else FALSE.
113 public final Boolean getColorie() {
118 * Sets this InterfaceBase color statement.
121 * - TRUE if you want this InterfaceBase to be colored, else
124 public final void setColorie(Boolean _colorie) {
125 this._colorie = _colorie;
130 * Gets this InterfaceBase associated structure element.
132 * @return this InterfaceBase associated structure element.
134 public int getElementStructure() {
139 if (_BP.getPartner5()==this)
140 return _BP.getPartner3().getIndex();
142 return _BP.getPartner5().getIndex();
148 * Sets this InterfaceBase assiocated structure element.
151 * - This new assiocated structure element.
153 public void setElementStructure(int structure) {
154 setElementStructure(structure, new ModeleBP());
158 * Sets this InterfaceBase associated structure element.
161 * - This new associated structure element.
163 * - The type of this base pair.
165 public void setElementStructure(int structure, ModeleBP type) {
166 // _elementStructure = structure;
171 public void removeElementStructure() {
172 // _elementStructure = -1;
178 * Gets the base pair type for this element.
180 * @return the base pair type for this element.
182 public ModeleBP getStyleBP() {
187 * Sets the base pair type for this element.
190 * - The new base pair type for this element.
192 public void setStyleBP(ModeleBP type) {
196 public int getBaseNumber() {
200 public void setBaseNumber(int bn) {
204 public Point2D.Double getCoords() {
205 return new Point2D.Double(_coords.x,_coords.y);
208 public void setCoords(Point2D.Double coords) {
209 this._coords.x = coords.x;
210 this._coords.y = coords.y;
213 public Point2D.Double getCenter() {
214 return new Point2D.Double(_center.x,_center.y);
217 public void setCenter(Point2D.Double center) {
218 this._center.x = center.x;
219 this._center.y = center.y;
222 public String getLabel() {
223 if (_label==null || _label.equals(""))
225 return ""+this.getBaseNumber();
234 public void setLabel(String s) {
238 public void setLabel(Point2D.Double center) {
239 this._center.x = center.x;
240 this._center.y = center.y;
244 public int compareTo(ModeleBase other) {
245 int nombre1 = ((ModeleBase) other).getIndex();
246 int nombre2 = this.getIndex();
247 if (nombre1 > nombre2) return -1;
248 else if(nombre1 == nombre2) return 0;
252 public static String XML_VAR_TYPE_NAME = "type";
253 public static String XML_VAR_INDEX_NAME = "index";
254 public static String XML_VAR_LABEL_NAME = "label";
255 public static String XML_VAR_VALUE_NAME = "val";
256 public static String XML_VAR_POSITION_NAME = "pos";
257 public static String XML_VAR_CENTER_NAME = "center";
258 public static String XML_VAR_NUMBER_NAME = "num";
259 public static String XML_VAR_CUSTOM_DRAWN_NAME = "custom";