~ubuntu-branches/ubuntu/utopic/build-helper-maven-plugin/utopic

« back to all changes in this revision

Viewing changes to src/main/java/org/codehaus/mojo/buildhelper/OsgiArtifactVersion.java

  • Committer: Package Import Robot
  • Author(s): tony mancill, Emmanuel Bourg, tony mancill
  • Date: 2013-06-01 20:19:34 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20130601201934-hzv7zmdcgazfyupp
Tags: 1.7-1
[ Emmanuel Bourg ]
* Team upload.
* New upstream release
* Set the compiler source/target to 1.5
* Updated Standards-Version to 3.9.4 (no changes)
* debian/copyright:
  - Updated the Format URI to 1.0
  - Removed the duplicate Copyright fields

[ tony mancill ]
* debian/control:
  - Add libmaven-invoker-plugin-java to build-depends-indep.
  - Wrap long lines.
  - Update Vcs-Git URL.

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
/**
32
32
 * Default implementation of artifact versioning.
33
33
 *
 
34
 * @author Robert Scholte
 
35
 * @version $Id: OsgiArtifactVersion.java 14209 2011-06-21 21:49:10Z rfscholte $
34
36
 */
35
37
public class OsgiArtifactVersion
36
38
    implements ArtifactVersion
45
47
 
46
48
    private String qualifier;
47
49
 
 
50
    /**
 
51
     * <p>Constructor for OsgiArtifactVersion.</p>
 
52
     *
 
53
     * @param version a {@link java.lang.String} object.
 
54
     */
48
55
    public OsgiArtifactVersion( String version )
49
56
    {
50
57
        parseVersion( version );
51
58
    }
52
59
 
 
60
    /** {@inheritDoc} */
53
61
    public int compareTo( Object o )
54
62
    {
55
63
        OsgiArtifactVersion otherVersion = (OsgiArtifactVersion) o;
73
81
            {
74
82
                if ( otherVersion.qualifier != null )
75
83
                {
76
 
                    if ( qualifier.length() > otherVersion.qualifier.length() &&
77
 
                        qualifier.startsWith( otherVersion.qualifier ) )
 
84
                    if ( qualifier.length() > otherVersion.qualifier.length() 
 
85
                                    && qualifier.startsWith( otherVersion.qualifier ) )
78
86
                    {
79
87
                        // here, the longer one that otherwise match is considered older
80
88
                        result = -1;
81
89
                    }
82
 
                    else if ( qualifier.length() < otherVersion.qualifier.length() &&
83
 
                        otherVersion.qualifier.startsWith( qualifier ) )
 
90
                    else if ( qualifier.length() < otherVersion.qualifier.length() 
 
91
                                    && otherVersion.qualifier.startsWith( qualifier ) )
84
92
                    {
85
93
                        // here, the longer one that otherwise match is considered older
86
94
                        result = 1;
125
133
        }
126
134
    }
127
135
 
 
136
    /**
 
137
     * <p>Getter for the field <code>majorVersion</code>.</p>
 
138
     *
 
139
     * @return a int.
 
140
     */
128
141
    public int getMajorVersion()
129
142
    {
130
143
        return majorVersion != null ? majorVersion.intValue() : 0;
131
144
    }
132
145
 
 
146
    /**
 
147
     * <p>Getter for the field <code>minorVersion</code>.</p>
 
148
     *
 
149
     * @return a int.
 
150
     */
133
151
    public int getMinorVersion()
134
152
    {
135
153
        return minorVersion != null ? minorVersion.intValue() : 0;
136
154
    }
137
155
 
 
156
    /**
 
157
     * <p>Getter for the field <code>incrementalVersion</code>.</p>
 
158
     *
 
159
     * @return a int.
 
160
     */
138
161
    public int getIncrementalVersion()
139
162
    {
140
163
        return incrementalVersion != null ? incrementalVersion.intValue() : 0;
141
164
    }
142
165
 
 
166
    /**
 
167
     * <p>Getter for the field <code>buildNumber</code>.</p>
 
168
     *
 
169
     * @return a int.
 
170
     */
143
171
    public int getBuildNumber()
144
172
    {
145
173
        return buildNumber != null ? buildNumber.intValue() : 0;
146
174
    }
147
175
 
 
176
    /**
 
177
     * <p>Getter for the field <code>qualifier</code>.</p>
 
178
     *
 
179
     * @return a {@link java.lang.String} object.
 
180
     */
148
181
    public String getQualifier()
149
182
    {
150
183
        return qualifier;
151
184
    }
152
185
 
 
186
    /** {@inheritDoc} */
153
187
    public void parseVersion( String version )
154
188
    {
155
189
        boolean fallback = false;
204
238
        return Integer.valueOf( s );
205
239
    }
206
240
 
 
241
    /**
 
242
     * <p>toString</p>
 
243
     *
 
244
     * @return a {@link java.lang.String} object.
 
245
     */
207
246
    public String toString()
208
247
    {
209
248
        StringBuffer buf = new StringBuffer();