xref: /OpenGrok/opengrok-indexer/src/main/java/org/opengrok/indexer/index/PendingFileRenaming.java (revision 5d9f3aa0ca3da3a714233f987fa732f62c0965f6)
1b5840353SAdam Hornáček /*
2b5840353SAdam Hornáček  * CDDL HEADER START
3b5840353SAdam Hornáček  *
4b5840353SAdam Hornáček  * The contents of this file are subject to the terms of the
5b5840353SAdam Hornáček  * Common Development and Distribution License (the "License").
6b5840353SAdam Hornáček  * You may not use this file except in compliance with the License.
7b5840353SAdam Hornáček  *
8b5840353SAdam Hornáček  * See LICENSE.txt included in this distribution for the specific
9b5840353SAdam Hornáček  * language governing permissions and limitations under the License.
10b5840353SAdam Hornáček  *
11b5840353SAdam Hornáček  * When distributing Covered Code, include this CDDL HEADER in each
12b5840353SAdam Hornáček  * file and include the License file at LICENSE.txt.
13b5840353SAdam Hornáček  * If applicable, add the following below this CDDL HEADER, with the
14b5840353SAdam Hornáček  * fields enclosed by brackets "[]" replaced with your own identifying
15a72324b1SAdam Hornáček  * information: Portions Copyright [yyyy] [name of copyright owner]
16b5840353SAdam Hornáček  *
17b5840353SAdam Hornáček  * CDDL HEADER END
18b5840353SAdam Hornáček  */
19b5840353SAdam Hornáček 
20b5840353SAdam Hornáček /*
21*5d9f3aa0SAdam Hornáček  * Copyright (c) 2017, 2018, Chris Fraire <cfraire@me.com>.
22b5840353SAdam Hornáček  */
239805b761SAdam Hornáček package org.opengrok.indexer.index;
24b5840353SAdam Hornáček 
25b5840353SAdam Hornáček /**
26b5840353SAdam Hornáček  * Represents the metadata for a pending file renaming.
27b5840353SAdam Hornáček  */
28b5840353SAdam Hornáček public final class PendingFileRenaming {
29b5840353SAdam Hornáček     private final String absolutePath;
30b5840353SAdam Hornáček     private final String transientPath;
31b5840353SAdam Hornáček 
PendingFileRenaming(String absolutePath, String transientPath)32b5840353SAdam Hornáček     public PendingFileRenaming(String absolutePath, String transientPath) {
33b5840353SAdam Hornáček         this.absolutePath = absolutePath;
34b5840353SAdam Hornáček         this.transientPath = transientPath;
35b5840353SAdam Hornáček     }
36b5840353SAdam Hornáček 
37b5840353SAdam Hornáček     /**
38b5840353SAdam Hornáček      * @return the final, absolute path
39b5840353SAdam Hornáček      */
getAbsolutePath()40b5840353SAdam Hornáček     public String getAbsolutePath() {
41b5840353SAdam Hornáček         return absolutePath;
42b5840353SAdam Hornáček     }
43b5840353SAdam Hornáček 
44b5840353SAdam Hornáček     /**
45b5840353SAdam Hornáček      * @return the transient, absolute path
46b5840353SAdam Hornáček      */
getTransientPath()47b5840353SAdam Hornáček     public String getTransientPath() {
48b5840353SAdam Hornáček         return transientPath;
49b5840353SAdam Hornáček     }
50b5840353SAdam Hornáček 
51b5840353SAdam Hornáček     /**
52b5840353SAdam Hornáček      * Compares {@code absolutePath} to the other object's value.
53b5840353SAdam Hornáček      * @param o other object for comparison
54b5840353SAdam Hornáček      * @return {@code true} if the two compared objects are identical;
55b5840353SAdam Hornáček      * otherwise false
56b5840353SAdam Hornáček      */
57b5840353SAdam Hornáček     @Override
equals(Object o)58b5840353SAdam Hornáček     public boolean equals(Object o) {
59a72324b1SAdam Hornáček         if (!(o instanceof PendingFileRenaming)) {
60a72324b1SAdam Hornáček             return false;
61a72324b1SAdam Hornáček         }
62b5840353SAdam Hornáček         PendingFileRenaming other = (PendingFileRenaming) o;
63b5840353SAdam Hornáček         return this.absolutePath.equals(other.absolutePath);
64b5840353SAdam Hornáček     }
65b5840353SAdam Hornáček 
66b5840353SAdam Hornáček     @Override
hashCode()67b5840353SAdam Hornáček     public int hashCode() {
68b5840353SAdam Hornáček         return this.absolutePath.hashCode();
69b5840353SAdam Hornáček     }
70b5840353SAdam Hornáček }
71