Changeset 27 for trunk/CrossPare/src/de


Ignore:
Timestamp:
01/26/15 11:43:30 (10 years ago)
Author:
sherbold
Message:
  • updated experiment and SoftwareVersion? such that the order of the results will now always be the same and not depend on the order of the data loading. Instead, it depends on the string-order of the projects and versions that are loaded.
Location:
trunk/CrossPare/src/de/ugoe/cs/cpdp
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/CrossPare/src/de/ugoe/cs/cpdp/Experiment.java

    r6 r27  
    22 
    33import java.io.File; 
     4import java.util.Collections; 
    45import java.util.LinkedList; 
    56import java.util.List; 
     
    9091                } 
    9192                 
     93                // sort versions 
     94                Collections.sort(versions); 
     95                 
    9296                for( SoftwareVersion testVersion : versions ) { 
    9397                        if( isVersion(testVersion, config.getTestVersionFilters()) ) { 
  • trunk/CrossPare/src/de/ugoe/cs/cpdp/versions/SoftwareVersion.java

    r2 r27  
    77 * @author Steffen Herbold 
    88 */ 
    9 public class SoftwareVersion { 
     9public class SoftwareVersion implements Comparable<SoftwareVersion> { 
    1010 
    1111        /** 
     
    5959                return new Instances(instances); 
    6060        } 
     61 
     62        /**  
     63         * Compares first based on project name and then based on version. Only string comparisons are performed.  
     64         * @see java.lang.Comparable#compareTo(java.lang.Object) 
     65         */ 
     66        @Override 
     67        public int compareTo(SoftwareVersion o) { 
     68                int projectStrCmp = 0; 
     69                if( project!=null ) { 
     70                        projectStrCmp = project.compareTo(o.project); 
     71                }  
     72                if( projectStrCmp==0 && version!=null ) { 
     73                        return version.compareTo(o.version);                     
     74                } else { 
     75                        return projectStrCmp; 
     76                } 
     77        } 
    6178} 
Note: See TracChangeset for help on using the changeset viewer.