View Javadoc

1   package net.sourceforge.basher.impl;
2   
3   import java.util.List;
4   
5   import net.sourceforge.basher.Task;
6   import net.sourceforge.basher.TaskConfiguration;
7   
8   /** Gaderian configuration of a task.  Extends the <code>TaskConfiguration</code> by adding a task, class or object
9    * instance.
10   * @author Johan Lindquist
11   */
12  public class TaskContribution extends TaskConfiguration
13  {
14      private Task _task;
15      private List<TaskContribution> _taskContributions;
16  
17      public TaskContribution(final Task task, final TaskConfiguration taskConfiguration)
18      {
19          this(task);
20          initialize(taskConfiguration);
21      }
22  
23      protected TaskContribution()
24      {
25      }
26  
27      public TaskContribution(final Task task)
28      {
29          _task = task;
30      }
31  
32      public Task getTask()
33      {
34          return _task;
35      }
36  
37      public void setTask( final Task task )
38      {
39          _task = task;
40      }
41  
42      public void setFollowers( final List<TaskContribution> taskContributions )
43      {
44          _taskContributions = taskContributions;
45      }
46  
47      public List<TaskContribution> getTaskContributions()
48      {
49          return _taskContributions;
50      }
51  
52      @Override
53      public boolean equals( final Object o )
54      {
55          if ( this == o )
56          {
57              return true;
58          }
59          if ( !( o instanceof TaskContribution ) )
60          {
61              return false;
62          }
63          if ( !super.equals( o ) )
64          {
65              return false;
66          }
67  
68          final TaskContribution that = ( TaskContribution ) o;
69  
70          if ( _task != null ? !_task.equals( that._task ) : that._task != null )
71          {
72              return false;
73          }
74          if ( _taskContributions != null ? !_taskContributions.equals( that._taskContributions ) : that._taskContributions != null )
75          {
76              return false;
77          }
78  
79          return true;
80      }
81  
82      @Override
83      public int hashCode()
84      {
85          int result = super.hashCode();
86          result = 31 * result + ( _task != null ? _task.hashCode() : 0 );
87          result = 31 * result + ( _taskContributions != null ? _taskContributions.hashCode() : 0 );
88          return result;
89      }
90  
91      @Override
92      public String toString()
93      {
94          return "TaskContribution{" +
95                  "_task=" + _task +
96                  ", _taskContributions=" + _taskContributions +
97                  "} " + super.toString();
98      }
99  }