]> gitweb.fperrin.net Git - Dictionary.git/blob - jars/icu4j-4_2_1-src/src/com/ibm/icu/dev/tool/tzu/IncludePath.java
icu4jsrc
[Dictionary.git] / jars / icu4j-4_2_1-src / src / com / ibm / icu / dev / tool / tzu / IncludePath.java
1 /*\r
2  * ******************************************************************************\r
3  * Copyright (C) 2007, International Business Machines Corporation and others.\r
4  * All Rights Reserved.\r
5  * ******************************************************************************\r
6  */\r
7 package com.ibm.icu.dev.tool.tzu;\r
8 \r
9 import java.io.File;\r
10 \r
11 /**\r
12  * Represents a path and whether it should be included or excluded.\r
13  */\r
14 public class IncludePath {\r
15     /**\r
16      * Whether to include or exclude the path represented by this IncludePath.\r
17      */\r
18     private boolean include;\r
19 \r
20     /**\r
21      * The path represented by this IncludePath.\r
22      */\r
23     private File path;\r
24 \r
25     /**\r
26      * Constructs an IncludePath around a file or directory and whether it should be included or\r
27      * excluded.\r
28      * \r
29      * @param path\r
30      *            The file / directory to be used.\r
31      * @param include\r
32      *            Whether the file should be included / excluded.\r
33      */\r
34     public IncludePath(File path, boolean include) {\r
35         this.path = path;\r
36         this.include = include;\r
37     }\r
38 \r
39     /**\r
40      * Returns true if the other object is an IncludePath and the path that both objects represent\r
41      * are the same. It is not required for both IncludePaths to be included or excluded.\r
42      * \r
43      * @param other\r
44      *            The other IncludePath to compare this one to.\r
45      * @return Whether the two IncludePaths are considered equal by the criteria above.\r
46      */\r
47     public boolean equals(Object other) {\r
48         return !(other instanceof IncludePath) ? false : path.getAbsoluteFile().equals(\r
49                 ((IncludePath) other).path.getAbsoluteFile());\r
50     }\r
51 \r
52     /**\r
53      * Returns the path of this IncludePath.\r
54      * \r
55      * @return The path of this IncludePath.\r
56      */\r
57     public File getPath() {\r
58         return path;\r
59     }\r
60 \r
61     /**\r
62      * Returns whether the path is included or not.\r
63      * \r
64      * @return Whether the path is included or not.\r
65      */\r
66     public boolean isIncluded() {\r
67         return include;\r
68     }\r
69 \r
70     /**\r
71      * Outputs this IncludePath in the form (<b>+</b>|<b>-</b>)<i>pathstring</i>.\r
72      * \r
73      * @return The IncludePath as a string.\r
74      */\r
75     public String toString() {\r
76         return (include ? '+' : '-') + path.toString();\r
77     }\r
78 }\r