001package org.biopax.paxtools.controller;
002
003import org.biopax.paxtools.model.level2.conversion;
004import org.biopax.paxtools.model.level2.physicalEntityParticipant;
005
006import java.util.Map;
007import java.util.Set;
008
009/**
010 * Encapsulation of scores of conversions, and related information
011 *
012 * @author rodche //TODO Annotate
013 */
014public class ConversionScore implements Comparable
015{
016        private conversion conv1, conv2;
017        private Double score;
018        private boolean reverseMatch;
019        private Map<physicalEntityParticipant, physicalEntityParticipant> pepMap;
020
021        public ConversionScore(conversion conv1, conversion conv2, Double score,
022                               Map<physicalEntityParticipant, physicalEntityParticipant> pepMap,
023                               boolean reverseMatch)
024        {
025                this.conv1 = conv1;
026                this.conv2 = conv2;
027                this.score = score;
028                this.reverseMatch = reverseMatch;
029                this.pepMap = pepMap;
030        }
031
032        public Double getScore()
033        {
034                return score;
035        }
036
037        public conversion getConversion1()
038        {
039                return conv1;
040        }
041
042        public conversion getConversion2()
043        {
044                return conv2;
045        }
046
047        public boolean isReverseMatch()
048        {
049                return reverseMatch;
050        }
051
052        public physicalEntityParticipant getMatch(physicalEntityParticipant pep1)
053        {
054                return pepMap.get(pep1);
055        }
056
057        public Set<physicalEntityParticipant> getMatchedPEPs()
058        {
059                return pepMap.keySet();
060        }
061
062        public int compareTo(Object obj)
063        {
064                return ((int) Math.signum(
065                                this.getScore() - ((ConversionScore) obj).getScore()));
066        }
067}