source: trunk/CrossPare/src/de/ugoe/cs/cpdp/versions/SoftwareVersion.java @ 29

Last change on this file since 29 was 27, checked in by sherbold, 10 years ago
  • 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.
  • Property svn:mime-type set to text/plain
File size: 1.6 KB
Line 
1package de.ugoe.cs.cpdp.versions;
2
3import weka.core.Instances;
4
5/**
6 * Data class for software versions.
7 * @author Steffen Herbold
8 */
9public class SoftwareVersion implements Comparable<SoftwareVersion> {
10
11        /**
12         * name of the project
13         */
14        private final String project;
15       
16        /**
17         * version of the project
18         */
19        private final String version;
20
21        /**
22         * data of the version
23         */
24        private final Instances instances;
25       
26        /**
27         * Constructor. Creates a new version.
28         * @param project name of the project
29         * @param version name of the version
30         * @param instances data of the version
31         */
32        public SoftwareVersion(String project, String version, Instances instances) {
33                this.project = project;
34                this.version = version;
35                this.instances = instances;
36        }
37       
38        /**
39         * returns the project name
40         * @return project name
41         */
42        public String getProject() {
43                return project;
44        }
45       
46        /**
47         * returns the name of the version
48         * @return name of the version
49         */
50        public String getVersion() {
51                return version;
52        }
53       
54        /**
55         * returns the data of the version
56         * @return data
57         */
58        public Instances getInstances() {
59                return new Instances(instances);
60        }
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        }
78}
Note: See TracBrowser for help on using the repository browser.