001/*
002 *                    BioJava development code
003 *
004 * This code may be freely distributed and modified under the
005 * terms of the GNU Lesser General Public Licence.  This should
006 * be distributed with the code.  If you do not have a copy,
007 * see:
008 *
009 *      http://www.gnu.org/copyleft/lesser.html
010 *
011 * Copyright for this code is held jointly by the individual
012 * authors.  These should be listed in @author doc comments.
013 *
014 * For more information on the BioJava project and its aims,
015 * or to join the biojava-l mailing list, visit the home page
016 * at:
017 *
018 *      http://www.biojava.org/
019 *
020 */
021package org.biojava.nbio.structure.domain.pdp;
022
023import java.io.Serializable;
024
025
026
027public class Segment implements Serializable, Comparable<Segment> {
028        /**
029         *
030         */
031        private static final long serialVersionUID = 1393487067559539657L;
032        private Integer from;
033        private Integer to;
034        double score;
035
036        public Segment(){
037
038        }
039
040
041
042        @Override
043        public String toString() {
044                return "Segment [from=" + from + ", to=" + to + ", score=" + score
045                                + "]";
046        }
047
048
049
050        public Integer getFrom() {
051                return from;
052        }
053
054        public void setFrom(Integer from) {
055                this.from = from;
056        }
057
058        public Integer getTo() {
059                return to;
060        }
061
062        public void setTo(Integer to) {
063                this.to = to;
064        }
065
066        public double getScore() {
067                return score;
068        }
069
070        public void setScore(double score) {
071                this.score = score;
072        }
073
074
075
076        @Override
077        public int compareTo(Segment o) {
078
079                Integer s1 = getFrom();
080                Integer s2 = o.getFrom();
081
082                int comp = s1.compareTo(s2);
083                if ( comp != 0)
084                        return comp;
085
086                Integer e1 = getTo();
087                Integer e2 = o.getTo();
088
089                return e1.compareTo(e2);
090
091        }
092
093
094}