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.survival.cox;
022
023/**
024 * Not used and probably should be deleted
025 * @author Scooter Willis <willishf at gmail dot com>
026 */
027public class SurvivalInfoIndex implements Comparable<SurvivalInfoIndex> {
028
029        private double time;
030        private int event;
031        private int index;
032        private double[] data;
033
034        /**
035         *
036         * @param t
037         * @param e
038         * @param i
039         */
040        public SurvivalInfoIndex(double t, int e, int i) {
041                time = t;
042                event = e;
043                index = i;
044        }
045
046        /**
047         *
048         * @param t
049         * @param e
050         * @param i
051         * @param d
052         */
053        public SurvivalInfoIndex(double t, int e, int i, double[] d) {
054                time = t;
055                event = e;
056                index = i;
057                data = d;
058        }
059
060        /**
061         *
062         * @param t
063         * @param e
064         * @param i
065         * @param d
066         */
067        public SurvivalInfoIndex(double t, int e, int i, double d) {
068                time = t;
069                event = e;
070                index = i;
071                data = new double[1];
072                data[0] = d;
073        }
074
075        @Override
076        public String toString() {
077                return "t=" + time + " e=" + event + " o=" + index;
078        }
079        //    double CompNum4Sort(double[] a, double[] b) {
080        //(time - time - (event -event) /1024)
081        //    return (a[0] - b[0] - (a[1] - b[1]) / 1024);
082        // }
083
084        @Override
085        public int compareTo(SurvivalInfoIndex o) {
086        //    double compare = (this.time - o.time - (this.event - o.event) / 1024);
087                if (time < o.time) {
088                        return -1;
089                } else if (time > o.time) {
090                        return 1;
091                } else {
092                        if (this.event == o.event) {
093                                return 0;
094                        } else if (event == 1) {
095                                return -1;
096                        } else {
097                                return 1;
098                        }
099                }
100
101        }
102}