5a0585f8345b1ab0ef6e63a0edccefd3c0699dc1
[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     public SegmentImpl() {
31         super();
32         start = 0 ;
33         end   = 0 ;
34         name  = "Unknown";
35         color = Color.white ;
36         txtColor = "white" ;
37         parent = null ;
38         note = "";
39     }
40     
41     public boolean equals(Segment s){
42         if ( s == null)
43             return false;
44         
45         if (    ( start == s.getStart() ) &&
46                 ( end == s.getEnd() ) &&
47                 ( name.equals(s.getName()))               
48                 )      
49         {
50             if ( note == null) {
51                 if (s.getNote() == null)
52                     return true;
53             } else {
54                 if (s.getNote() != null){
55                     if (s.getNote().equals(note))
56                         return true;
57                 }
58             }
59             
60         }
61         
62         
63         return false;
64     }
65     
66     public Object clone(){
67         
68         Segment s = new SegmentImpl();
69         s.setStart(start);
70         s.setEnd(end);
71         s.setName(name);
72         s.setColor(color);
73         s.setTxtColor(txtColor);
74         s.setNote(note);
75         return s;
76         
77     }
78 }