4 import java.io.Serializable;
5 import java.util.ArrayList;
9 * Class representing an application task
10 * @author Sébastien Miquée
13 public class GTask implements Serializable
15 private static final long serialVersionUID = 1L;
20 private ArrayList<GTask> dependencies ;
25 * Default constructor.
31 dependencies = new ArrayList<GTask>() ;
38 * @param _n Task number
40 public GTask( int _n )
44 dependencies = new ArrayList<GTask>() ;
50 * Add a dependency to the task.
51 * @param _t Dependency task
53 public void addDependance( GTask _t )
57 if( ! _t.equals( this ) && ! dependencies.contains( _t ) )
59 dependencies.add( _t ) ;
68 * Return the task's number in a string.
69 * @return A String containing the task's number
71 public String toString()
78 * Add a dependencies list to the task.
79 * @param at The dependencies list
81 public void addDependance( ArrayList<GTask> at )
85 for( int i = 0 ; i < at.size() ; i++ )
87 this.addDependance( at.get( i ) ) ;
94 * Define the task's computing weight.
95 * @param _p The computing weight
97 public void setWeight( int _p )
104 * Return the task's weight.
105 * @return The task's weight
107 public int getWeight()
114 * Return the task's dependencies list.
115 * @return The dependencies list
117 public ArrayList<GTask> getDependencies()
119 return dependencies ;
124 * Return the task's number.
125 * @return The task's number
134 * Return the amount of dependencies of the task.
135 * @return The amount of dependencies
137 public int getNbDep()
144 * Return the task's dependencies list in a text form.
145 * @return The String containing the dependencies list
147 public String printDep()
151 for( int i = 0 ; i < nb_dep ; i++ )
153 s = s + dependencies.get( i ).getNum() ;
154 if( i != nb_dep - 1 )
166 /** La programmation est un art, respectons ceux qui la pratiquent !! **/