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

Last change on this file since 145 was 142, checked in by atrautsch, 8 years ago

heterogenous experiments

  • Property svn:mime-type set to text/plain
File size: 3.3 KB
Line 
1// Copyright 2015 Georg-August-Universität Göttingen, Germany
2//
3//   Licensed under the Apache License, Version 2.0 (the "License");
4//   you may not use this file except in compliance with the License.
5//   You may obtain a copy of the License at
6//
7//       http://www.apache.org/licenses/LICENSE-2.0
8//
9//   Unless required by applicable law or agreed to in writing, software
10//   distributed under the License is distributed on an "AS IS" BASIS,
11//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12//   See the License for the specific language governing permissions and
13//   limitations under the License.
14
15package de.ugoe.cs.cpdp.versions;
16
17import java.util.List;
18
19import weka.core.Instances;
20
21/**
22 * Data class for software versions.
23 *
24 * @author Steffen Herbold
25 */
26public class SoftwareVersion implements Comparable<SoftwareVersion> {
27
28    private final String dataset;
29   
30    /**
31     * name of the project
32     */
33    private final String project;
34
35    /**
36     * version of the project
37     */
38    private final String version;
39
40    /**
41     * data of the version
42     */
43    private final Instances instances;
44
45    /**
46     * Review effort per instance.
47     */
48    private final List<Double> efforts;
49
50    /**
51     * Constructor. Creates a new version.
52     *
53     * @param project
54     *            name of the project
55     * @param version
56     *            name of the version
57     * @param instances
58     *            data of the version
59     * @param efforts
60     *            review efforts for the version
61     */
62    public SoftwareVersion(String dataset,
63                           String project,
64                           String version,
65                           Instances instances,
66                           List<Double> efforts)
67    {
68        this.dataset = dataset;
69        this.project = project;
70        this.version = version;
71        this.instances = instances;
72        this.efforts = efforts;
73    }
74
75    public String getDataset() {
76        return dataset;
77    }
78   
79    /**
80     * returns the project name
81     *
82     * @return project name
83     */
84    public String getProject() {
85        return project;
86    }
87
88    /**
89     * returns the name of the version
90     *
91     * @return name of the version
92     */
93    public String getVersion() {
94        return version;
95    }
96
97    /**
98     * returns the data of the version
99     *
100     * @return data
101     */
102    public Instances getInstances() {
103        return new Instances(instances);
104    }
105
106    /**
107     * <p>
108     * returns the review effort of the version
109     * </p>
110     *
111     * @return the review efforts
112     */
113    public List<Double> getEfforts() {
114        return efforts;
115    }
116
117    /**
118     * Compares first based on project name and then based on version. Only string comparisons are
119     * performed.
120     *
121     * @see java.lang.Comparable#compareTo(java.lang.Object)
122     */
123    @Override
124    public int compareTo(SoftwareVersion o) {
125        int projectStrCmp = 0;
126        if (project != null) {
127            projectStrCmp = project.compareTo(o.project);
128        }
129        if (projectStrCmp == 0 && version != null) {
130            return version.compareTo(o.version);
131        }
132        else {
133            return projectStrCmp;
134        }
135    }
136}
Note: See TracBrowser for help on using the repository browser.