View Javadoc

1   package test.crispy.example.model;
2   
3   import java.util.HashSet;
4   import java.util.Set;
5   
6   /**
7    * Test Node with get-method without set-method.
8    * 
9    * @author Linke
10   *
11   */
12  public class ProblemNode {
13  
14  	private Long id = null;
15  	private String name = null;
16  	private Set sets = new HashSet(); 
17  	private SpecialTestClass aSpecialTestClass = null;
18  	private SpecialTestClass vSpecialTestClass = null;
19  	
20  	public ProblemNode() {}
21  	public ProblemNode(String pvName) {
22  		setName(pvName);
23  	}
24  	public ProblemNode(String pvName, Long pvId) {
25  		setName(pvName);
26  		setId(pvId);
27  	}
28  
29  
30  	
31  	public void setAspecialTestClass(SpecialTestClass pvSpecialTestClass1) { aSpecialTestClass = pvSpecialTestClass1; }
32  	public SpecialTestClass getAspecialTestClass() { return aSpecialTestClass; }
33  
34  	
35  	public void setVspecialTestClass(SpecialTestClass pvSpecialTestClass2) { vSpecialTestClass = pvSpecialTestClass2; }
36  	public SpecialTestClass getVspecialTestClass() { return vSpecialTestClass; }
37  
38  
39  	
40  	protected void setId(Long pvId) { id = pvId; }
41  	protected Long getId() { return id; }
42  	 
43  	public String getName() { return this.name; }
44  	private void setName(String pvName) { this.name = pvName; }
45  	
46  	public Set getANoSetSets() { return sets; }
47  	public Set getSets() { return sets; }
48  	public void setSets(Set pvSets) { sets = pvSets; }
49  	
50  
51  	public int hashCode() {
52  		if (getId() == null) {
53  			return super.hashCode();
54  		} else {
55  			return getId().intValue();
56  		}
57  	}
58  	
59  	public boolean equals(Object pvObj) {
60  		if (pvObj == null) {
61  			return false;
62  		}
63  		else if (this.getClass().isAssignableFrom(pvObj.getClass()) == false) {
64  			return false;
65  		}
66  		else if (getId() != null) {
67  			return getId().equals( ((ProblemNode) pvObj ).getId());
68  		}
69  		return super.equals(pvObj);
70  	}
71  }