KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > cpmake > ExplicitDependency


1 /*
2  * Copyright (c) 2004, Brian Hawkins
3  * brianhks@activeclickweb.com
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License as published by the Free
7  * Software Foundation; either version 2 of the License, or (at your option)
8  * any later version.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13  * for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the
17  * Free Software Foundation, Inc.,
18  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  */

20  
21
22 package cpmake;
23
24 import java.io.*;
25
26 class ExplicitDependency implements Dependency
27     {
28     private String JavaDoc m_target;
29     private File m_targetFile;
30     private String JavaDoc[] m_dependencies;
31     private CPMake m_make;
32     
33     public ExplicitDependency(CPMake make, File target, String JavaDoc[] dependencies)
34         {
35         m_target = target.getName();
36         m_targetFile = target;
37         m_dependencies = dependencies;
38         m_make = make;
39         }
40         
41     public boolean matchTarget(String JavaDoc target)
42         {
43         File tFile = new File(m_make.getWorkingDirectory(), target);
44         if (m_target.equals(target))
45             return (true);
46         else if (tFile.getAbsolutePath().equals(m_targetFile.getAbsolutePath()))
47             return (true);
48         else
49             return (false);
50         }
51         
52     public String JavaDoc[] getDependencies(String JavaDoc target)
53         {
54         return (m_dependencies);
55         }
56         
57     public String JavaDoc toString()
58         {
59         StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
60         
61         sb.append(m_target + " : ");
62         if (m_dependencies.length > 0)
63             for (int I = 0; I < m_dependencies.length; I ++)
64                 sb.append(m_dependencies[I] + " ");
65                 
66         return (sb.toString());
67         }
68     }
69
Popular Tags