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 /** 23 * @author <a href="mailto:trygvis@inamo.no">Trygve Laugstøl</a> 24 * @version $Id: ScmFile.java 522852 2007-03-27 10:06:03Z evenisse $ 25 */ 26 public class ScmFile 27 implements Comparable 28 { 29 private String path; 30 31 private ScmFileStatus status; 32 33 /** 34 * @param path The file path 35 * @param status The file status 36 */ 37 public ScmFile( String path, ScmFileStatus status ) 38 { 39 this.path = path; 40 41 this.status = status; 42 } 43 44 /** 45 * @return the file path 46 */ 47 public String getPath() 48 { 49 return path; 50 } 51 52 /** 53 * @return The file status 54 */ 55 public ScmFileStatus getStatus() 56 { 57 return status; 58 } 59 60 // ---------------------------------------------------------------------- 61 // Comparable Implementation 62 // ---------------------------------------------------------------------- 63 64 public int compareTo( Object other ) 65 { 66 return ( (ScmFile) other ).getPath().compareTo( path ); 67 } 68 69 // ---------------------------------------------------------------------- 70 // Object overrides 71 // ---------------------------------------------------------------------- 72 73 public boolean equals( Object other ) 74 { 75 if ( !( other instanceof ScmFile ) ) 76 { 77 return false; 78 } 79 80 return ( (ScmFile) other ).getPath().equals( path ); 81 } 82 83 public int hashCode() 84 { 85 return path.hashCode(); 86 } 87 88 public String toString() 89 { 90 return "[" + path + ":" + status + "]"; 91 } 92 }