View Javadoc

1   /*
2    * #%L
3    * Native ARchive plugin for Maven
4    * %%
5    * Copyright (C) 2002 - 2014 NAR Maven Plugin developers.
6    * %%
7    * Licensed under the Apache License, Version 2.0 (the "License");
8    * you may not use this file except in compliance with the License.
9    * You may obtain a copy of the License at
10   * 
11   * http://www.apache.org/licenses/LICENSE-2.0
12   * 
13   * Unless required by applicable law or agreed to in writing, software
14   * distributed under the License is distributed on an "AS IS" BASIS,
15   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   * See the License for the specific language governing permissions and
17   * limitations under the License.
18   * #L%
19   */
20  package com.github.maven_nar.cpptasks;
21  
22  import java.util.Vector;
23  
24  /**
25   * @author Curt Arnold
26   */
27  public final class DependencyInfo {
28    /**
29     * Last modified time of this file or anything that it depends on.
30     * 
31     * Not persisted since almost any change could invalidate it. Initialized
32     * to long.MIN_VALUE on construction.
33     */
34    // FREEHEP
35    // private long compositeLastModified;
36    private final/* final */String includePathIdentifier;
37    private final/* final */String[] includes;
38    private final/* final */String source;
39    private final/* final */long sourceLastModified;
40    private final/* final */String[] sysIncludes;
41    // FREEHEP
42    private Object tag = null;
43  
44    public DependencyInfo(final String includePathIdentifier, final String source, final long sourceLastModified,
45        final Vector includes, final Vector sysIncludes) {
46      if (source == null) {
47        throw new NullPointerException("source");
48      }
49      if (includePathIdentifier == null) {
50        throw new NullPointerException("includePathIdentifier");
51      }
52      this.source = source;
53      this.sourceLastModified = sourceLastModified;
54      this.includePathIdentifier = includePathIdentifier;
55      this.includes = new String[includes.size()];
56      // BEGINFREEHEP
57      // if (includes.size() == 0) {
58      // compositeLastModified = sourceLastModified;
59      // } else {
60      // includes.copyInto(this.includes);
61      // compositeLastModified = Long.MIN_VALUE;
62      // }
63      // ENDFREEHEP
64      this.sysIncludes = new String[sysIncludes.size()];
65      // FREEHEP
66      includes.copyInto(this.includes);
67      sysIncludes.copyInto(this.sysIncludes);
68    }
69  
70    // ENDFREEHEP
71    public String getIncludePathIdentifier() {
72      return this.includePathIdentifier;
73    }
74  
75    public String[] getIncludes() {
76      final String[] includesClone = this.includes.clone();
77      return includesClone;
78    }
79  
80    public String getSource() {
81      return this.source;
82    }
83  
84    public long getSourceLastModified() {
85      return this.sourceLastModified;
86    }
87  
88    public String[] getSysIncludes() {
89      final String[] sysIncludesClone = this.sysIncludes.clone();
90      return sysIncludesClone;
91    }
92  
93    // BEGINFREEHEP
94    /**
95     * Returns true, if dependency info is tagged with object t.
96     * 
97     * @param t
98     *          object to compare with
99     * 
100    * @return boolean, true, if tagged with t, otherwise false
101    */
102   public boolean hasTag(final Object t) {
103     return this.tag == t;
104   }
105 
106   // public void setCompositeLastModified(long lastMod) {
107   // compositeLastModified = lastMod;
108   // }
109   // ENDFREEHEP
110   /**
111    * Returns the latest modification date of the source or anything that it
112    * depends on.
113    * 
114    * @returns the composite lastModified time, returns Long.MIN_VALUE if not
115    *          set
116    */
117   // BEGINFREEHEP
118   // public long getCompositeLastModified() {
119   // return compositeLastModified;
120   // }
121   public void setTag(final Object t) {
122     this.tag = t;
123   }
124 }