]>
Commit | Line | Data |
---|---|---|
878ddf1f | 1 | /*\r |
2 | * \r | |
3 | * Copyright 2002-2004 The Ant-Contrib project\r | |
4 | *\r | |
5 | * Licensed under the Apache License, Version 2.0 (the "License");\r | |
6 | * you may not use this file except in compliance with the License.\r | |
7 | * You may obtain a copy of the License at\r | |
8 | *\r | |
9 | * http://www.apache.org/licenses/LICENSE-2.0\r | |
10 | *\r | |
11 | * Unless required by applicable law or agreed to in writing, software\r | |
12 | * distributed under the License is distributed on an "AS IS" BASIS,\r | |
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r | |
14 | * See the License for the specific language governing permissions and\r | |
15 | * limitations under the License.\r | |
16 | */\r | |
17 | package net.sf.antcontrib.cpptasks;\r | |
18 | import java.util.Vector;\r | |
19 | /**\r | |
20 | * @author Curt Arnold\r | |
21 | */\r | |
22 | public final class DependencyInfo {\r | |
23 | /**\r | |
24 | * Last modified time of this file or anything that it depends on.\r | |
25 | * \r | |
26 | * Not persisted since almost any change could invalidate it. Initialized\r | |
27 | * to long.MIN_VALUE on construction.\r | |
28 | */\r | |
29 | private long compositeLastModified;\r | |
30 | private/* final */String includePathIdentifier;\r | |
31 | private/* final */String[] includes;\r | |
32 | private/* final */String source;\r | |
33 | private/* final */long sourceLastModified;\r | |
34 | private/* final */String[] sysIncludes;\r | |
35 | public DependencyInfo(String includePathIdentifier, String source,\r | |
36 | long sourceLastModified, Vector includes, Vector sysIncludes) {\r | |
37 | if (source == null) {\r | |
38 | throw new NullPointerException("source");\r | |
39 | }\r | |
40 | if (includePathIdentifier == null) {\r | |
41 | throw new NullPointerException("includePathIdentifier");\r | |
42 | }\r | |
43 | this.source = source;\r | |
44 | this.sourceLastModified = sourceLastModified;\r | |
45 | this.includePathIdentifier = includePathIdentifier;\r | |
46 | this.includes = new String[includes.size()];\r | |
47 | if (includes.size() == 0) {\r | |
48 | compositeLastModified = sourceLastModified;\r | |
49 | } else {\r | |
50 | includes.copyInto(this.includes);\r | |
51 | compositeLastModified = Long.MIN_VALUE;\r | |
52 | }\r | |
53 | this.sysIncludes = new String[sysIncludes.size()];\r | |
54 | sysIncludes.copyInto(this.sysIncludes);\r | |
55 | }\r | |
56 | /**\r | |
57 | * Returns the latest modification date of the source or anything that it\r | |
58 | * depends on.\r | |
59 | * \r | |
60 | * @returns the composite lastModified time, returns Long.MIN_VALUE if not\r | |
61 | * set\r | |
62 | */\r | |
63 | public long getCompositeLastModified() {\r | |
64 | return compositeLastModified;\r | |
65 | }\r | |
66 | public String getIncludePathIdentifier() {\r | |
67 | return includePathIdentifier;\r | |
68 | }\r | |
69 | public String[] getIncludes() {\r | |
70 | String[] includesClone = (String[]) includes.clone();\r | |
71 | return includesClone;\r | |
72 | }\r | |
73 | public String getSource() {\r | |
74 | return source;\r | |
75 | }\r | |
76 | public long getSourceLastModified() {\r | |
77 | return sourceLastModified;\r | |
78 | }\r | |
79 | public String[] getSysIncludes() {\r | |
80 | String[] sysIncludesClone = (String[]) sysIncludes.clone();\r | |
81 | return sysIncludesClone;\r | |
82 | }\r | |
83 | public void setCompositeLastModified(long lastMod) {\r | |
84 | compositeLastModified = lastMod;\r | |
85 | }\r | |
86 | }\r |