001    /**
002     * Copyright (C) 2007-2011, Jens Lehmann
003     *
004     * This file is part of DL-Learner.
005     *
006     * DL-Learner is free software; you can redistribute it and/or modify
007     * it under the terms of the GNU General Public License as published by
008     * the Free Software Foundation; either version 3 of the License, or
009     * (at your option) any later version.
010     *
011     * DL-Learner is distributed in the hope that it will be useful,
012     * but WITHOUT ANY WARRANTY; without even the implied warranty of
013     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
014     * GNU General Public License for more details.
015     *
016     * You should have received a copy of the GNU General Public License
017     * along with this program.  If not, see <http://www.gnu.org/licenses/>.
018     */
019    
020    package org.dllearner.utilities.datastructures;
021    
022    import java.util.SortedSet;
023    
024    // class is not used anywhere and is not documented - delete?
025    public class ResultConceptSorter implements Comparable<ResultConceptSorter> {
026            String concept;
027            SortedSet<String> instances;
028            double accuracy;
029            double accuracy2;
030            int nrOfInstances;
031            SortedSet<String> coveredInRest;
032            SortedSet<String> possibleNewCandidates;
033            SortedSet<String> notCoveredInTotal;
034            
035            
036            public ResultConceptSorter(String concept, SortedSet<String> instances, double accuracy,
037                            double accuracy2, int nrOfInstances, SortedSet<String> coveredInRest,
038                            SortedSet<String> possibleNewCandidates, SortedSet<String> notCoveredInTotal) {
039                    super();
040                    this.concept = concept;
041                    this.instances = instances;
042                    this.accuracy = accuracy;
043                    this.accuracy2 = accuracy2;
044                    this.nrOfInstances = nrOfInstances;
045                    this.coveredInRest = coveredInRest;
046                    this.possibleNewCandidates = possibleNewCandidates;
047                    this.notCoveredInTotal = notCoveredInTotal;
048            }
049    
050    
051    
052    
053            public int compareTo(ResultConceptSorter in) {
054                    ResultConceptSorter obj = in;
055                    if(obj.accuracy > this.accuracy) return 1;
056                    else if(obj.accuracy == this.accuracy){
057                            
058                            if(obj.nrOfInstances<this.nrOfInstances)return 1;
059                            else if(obj.nrOfInstances>this.nrOfInstances)return -1;
060                            else return 1;
061                                    //if(obj.nrOfInstances==this.nrOfInstances)return 0;
062                    }
063                    else {//if(obj.accuracy < this.accuracy){
064                            return -1;
065                    }
066                    
067            }
068    
069    
070            
071            
072            public String toStringFull(){
073                    String ret="";
074                    ret+="concept\t"+concept+"\n";
075                    ret+="instances\t"+instances+"\n";
076                    ret+="accuracy\t"+accuracy+"\n";
077                    ret+="nrOfInstances\t"+nrOfInstances+"\n";
078                    ret+="accuracy2\t"+accuracy2+"\n";
079                    ret+="coveredInRest("+coveredInRest.size()+")\t"+coveredInRest+"\n";
080                    ret+="possibleNewCandidates("+possibleNewCandidates.size()+")\t"+possibleNewCandidates+"\n";
081                    ret+="notCoveredInTotal("+notCoveredInTotal.size()+")\t"+notCoveredInTotal+"\n";
082                    
083                    return ret;
084                    
085            }
086            
087            @Override
088            public String toString(){
089                    String ret="";
090                    ret+="concept\t"+concept+"\n";
091                    //ret+="instances\t"+instances+"\n";
092                    ret+="accuracy\t"+accuracy+"\n";
093                    ret+="nrOfInstances\t"+nrOfInstances+"\n";
094                    ret+="accuracy2\t"+accuracy2+"\n";
095                    //ret+="coveredInRest("+coveredInRest.size()+")\t"+coveredInRest+"\n";
096                    //ret+="possibleNewCandidates("+possibleNewCandidates.size()+")\t"+possibleNewCandidates+"\n";
097                    //ret+="notCoveredInTotal("+notCoveredInTotal.size()+")\t"+notCoveredInTotal+"\n";
098                    
099                    return ret;
100                    
101            }
102            
103            
104    
105            
106            
107    }