View Javadoc

1   package net.sf.jlayercheck.util.model;
2   
3   import java.util.Set;
4   import java.util.TreeSet;
5   
6   /**
7    * Represents the dependency to a specified class.
8    * 
9    * @author webmaster@earth3d.org
10   */
11  public class ClassDependency {
12  	protected String dependency;
13  	protected Set<Integer> lineNumbers = new TreeSet<Integer>();
14  	protected boolean unallowedDependency;
15  	
16  	public ClassDependency(String dependency) {
17  		this.dependency = dependency;
18  	}
19  	
20  	@Override
21  	public boolean equals(Object obj) {
22  		return dependency.equals(obj);
23  	}
24  
25  	@Override
26  	public int hashCode() {
27  		return dependency.hashCode();
28  	}
29  
30  	public void addLineNumber(int lineNumber) {
31  		lineNumbers.add(lineNumber);
32  	}
33  
34  	/**
35  	 * Returns a Set of line numbers, where dependencies to this
36  	 * class occured in the source file.
37  	 * 
38  	 * @return Set of line numbers
39  	 */
40  	public Set<Integer> getLineNumbers() {
41  		return lineNumbers;
42  	}
43  
44  	/**
45  	 * The name of the class to which the dependency exists.
46  	 * 
47  	 * @return classname
48  	 */
49  	public String getDependency() {
50  		return dependency;
51  	}
52  
53  	/**
54  	 * If this dependency is allowed or not by the module/architecture configuration.
55  	 * @return
56  	 */
57  	public boolean isUnallowedDependency() {
58  		return unallowedDependency;
59  	}
60  
61  	public void setUnallowedDependency(boolean unallowedDependency) {
62  		this.unallowedDependency = unallowedDependency;
63  	}
64  }