dba25e98ab0605865334a5ed5964cd0703e01822
[jalview.git] / src / org / biojava / dasobert / feature / SegmentImpl.java
1 /*
2  *                  BioJava development code
3  *
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,
7  * see:
8  *
9  *      http://www.gnu.org/copyleft/lesser.html
10  *
11  * Copyright for this code is held jointly by the individual
12  * authors.  These should be listed in @author doc comments.
13  *
14  * For more information on the BioJava project and its aims,
15  * or to join the biojava-l mailing list, visit the home page
16  * at:
17  *
18  *      http://www.biojava.org/
19  * 
20  * Created on May 22, 2007
21  * 
22  */
23
24 package org.biojava.dasobert.feature;
25
26 import java.awt.Color;
27
28 public class SegmentImpl extends AbstractSegment
29 {
30
31   public SegmentImpl()
32   {
33     super();
34     start = 0;
35     end = 0;
36     name = "Unknown";
37     color = Color.white;
38     txtColor = "white";
39     parent = null;
40     note = "";
41   }
42
43   public boolean equals(Segment s)
44   {
45     if (s == null)
46       return false;
47
48     if ((start == s.getStart()) && (end == s.getEnd())
49             && (name.equals(s.getName())))
50     {
51       if (note == null)
52       {
53         if (s.getNote() == null)
54           return true;
55       }
56       else
57       {
58         if (s.getNote() != null)
59         {
60           if (s.getNote().equals(note))
61             return true;
62         }
63       }
64
65     }
66
67     return false;
68   }
69
70   public Object clone()
71   {
72
73     Segment s = new SegmentImpl();
74     s.setStart(start);
75     s.setEnd(end);
76     s.setName(name);
77     s.setColor(color);
78     s.setTxtColor(txtColor);
79     s.setNote(note);
80     return s;
81
82   }
83 }