You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

Target.java 2.3 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. // ---------------------------------------------------------------------
  2. // (c)2000 Apache Software Foundation
  3. //
  4. // ---------------------------------------------------------------------
  5. package org.apache.ant;
  6. import java.util.*;
  7. /**
  8. * In memory container for an Ant target.
  9. */
  10. public class Target {
  11. // -----------------------------------------------------------------
  12. // PRIVATE DATA MEMBERS
  13. // -----------------------------------------------------------------
  14. /**
  15. * String containing the name of the target. This name must be
  16. * unique withing a project.
  17. */
  18. private String name;
  19. /**
  20. * Vector containing the names of the targets that this target
  21. * depends on.
  22. */
  23. private Vector dependsList = new Vector();
  24. /**
  25. * Vector containing the tasks that are part of this target.
  26. */
  27. private Vector tasks = new Vector();
  28. // -----------------------------------------------------------------
  29. // CONSTRUCTORS
  30. // -----------------------------------------------------------------
  31. /**
  32. * Constructs a new Target object with the given name.
  33. */
  34. public Target(String name) {
  35. this.name = name;
  36. }
  37. // -----------------------------------------------------------------
  38. // PUBLIC ACCESSOR METHODS
  39. // -----------------------------------------------------------------
  40. /**
  41. * Adds a dependancy to this task.
  42. */
  43. public void addDependancy(String targetName) {
  44. dependsList.addElement(targetName);
  45. }
  46. /**
  47. *
  48. */
  49. public void addTask(Task task) {
  50. tasks.addElement(task);
  51. }
  52. /**
  53. * Returns a String containing the name of this Target.
  54. */
  55. public String getName() {
  56. return name;
  57. }
  58. /**
  59. *
  60. */
  61. public String toString() {
  62. return "TARGET: " + name;
  63. }
  64. /**
  65. * Returns a Vector of Tasks contained in this Target.
  66. * <p>
  67. * Please use caution when using this method. I am not happy
  68. * about exposing this data as something other than a
  69. * Collection, but don't want to use 1.1 collections. So,
  70. * this method may change in the future. You have been warned.
  71. */
  72. public Vector getTasks() {
  73. return tasks;
  74. }
  75. }