Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
ScmFile |
|
| 1.2857142857142858;1,286 |
1 | package org.apache.maven.scm; | |
2 | ||
3 | /* | |
4 | * Licensed to the Apache Software Foundation (ASF) under one | |
5 | * or more contributor license agreements. See the NOTICE file | |
6 | * distributed with this work for additional information | |
7 | * regarding copyright ownership. The ASF licenses this file | |
8 | * to you under the Apache License, Version 2.0 (the | |
9 | * "License"); you may not use this file except in compliance | |
10 | * with the License. You may obtain a copy of the License at | |
11 | * | |
12 | * http://www.apache.org/licenses/LICENSE-2.0 | |
13 | * | |
14 | * Unless required by applicable law or agreed to in writing, | |
15 | * software distributed under the License is distributed on an | |
16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
17 | * KIND, either express or implied. See the License for the | |
18 | * specific language governing permissions and limitations | |
19 | * under the License. | |
20 | */ | |
21 | ||
22 | import java.io.Serializable; | |
23 | ||
24 | /** | |
25 | * @author <a href="mailto:trygvis@inamo.no">Trygve Laugstøl</a> | |
26 | * @version $Id: ScmFile.java 1054126 2010-12-31 15:18:11Z olamy $ | |
27 | */ | |
28 | 0 | public class ScmFile |
29 | implements Comparable<ScmFile>, Serializable | |
30 | { | |
31 | private static final long serialVersionUID = -9133015730693522690L; | |
32 | ||
33 | private String path; | |
34 | ||
35 | private ScmFileStatus status; | |
36 | ||
37 | /** | |
38 | * @param path The file path | |
39 | * @param status The file status | |
40 | */ | |
41 | public ScmFile( String path, ScmFileStatus status ) | |
42 | 0 | { |
43 | 0 | this.path = path; |
44 | ||
45 | 0 | this.status = status; |
46 | 0 | } |
47 | ||
48 | /** | |
49 | * @return the file path | |
50 | */ | |
51 | public String getPath() | |
52 | { | |
53 | 0 | return path; |
54 | } | |
55 | ||
56 | /** | |
57 | * @return The file status | |
58 | */ | |
59 | public ScmFileStatus getStatus() | |
60 | { | |
61 | 0 | return status; |
62 | } | |
63 | ||
64 | // ---------------------------------------------------------------------- | |
65 | // Comparable Implementation | |
66 | // ---------------------------------------------------------------------- | |
67 | ||
68 | /** {@inheritDoc} */ | |
69 | public int compareTo( ScmFile other ) | |
70 | { | |
71 | 0 | return other.getPath().compareTo( path ); |
72 | } | |
73 | ||
74 | // ---------------------------------------------------------------------- | |
75 | // Object overrides | |
76 | // ---------------------------------------------------------------------- | |
77 | ||
78 | /** {@inheritDoc} */ | |
79 | public boolean equals( Object other ) | |
80 | { | |
81 | 0 | if ( !( other instanceof ScmFile ) ) |
82 | { | |
83 | 0 | return false; |
84 | } | |
85 | ||
86 | 0 | return ( (ScmFile) other ).getPath().equals( path ); |
87 | } | |
88 | ||
89 | /** {@inheritDoc} */ | |
90 | public int hashCode() | |
91 | { | |
92 | 0 | return path.hashCode(); |
93 | } | |
94 | ||
95 | /** {@inheritDoc} */ | |
96 | public String toString() | |
97 | { | |
98 | 0 | return "[" + path + ":" + status + "]"; |
99 | } | |
100 | } |