1. /*
  2. * Copyright 2002-2004 The Apache Software Foundation
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. *
  16. */
  17. package org.apache.tools.ant.types.selectors;
  18. import java.util.Enumeration;
  19. import org.apache.tools.ant.Project;
  20. import org.apache.tools.ant.types.selectors.modifiedselector.ModifiedSelector;
  21. /**
  22. * This is the interface for selectors that can contain other selectors.
  23. *
  24. * @since 1.5
  25. */
  26. public interface SelectorContainer {
  27. /**
  28. * Indicates whether there are any selectors here.
  29. *
  30. * @return whether any selectors are in this container
  31. */
  32. boolean hasSelectors();
  33. /**
  34. * Gives the count of the number of selectors in this container
  35. *
  36. * @return the number of selectors in this container
  37. */
  38. int selectorCount();
  39. /**
  40. * Returns the set of selectors as an array.
  41. * @param p the current project
  42. * @return an array of selectors in this container
  43. */
  44. FileSelector[] getSelectors(Project p);
  45. /**
  46. * Returns an enumerator for accessing the set of selectors.
  47. *
  48. * @return an enumerator that goes through each of the selectors
  49. */
  50. Enumeration selectorElements();
  51. /**
  52. * Add a new selector into this container.
  53. *
  54. * @param selector the new selector to add
  55. */
  56. void appendSelector(FileSelector selector);
  57. /* Methods below all add specific selectors */
  58. /**
  59. * add a "Select" selector entry on the selector list
  60. * @param selector the selector to add
  61. */
  62. void addSelector(SelectSelector selector);
  63. /**
  64. * add an "And" selector entry on the selector list
  65. * @param selector the selector to add
  66. */
  67. void addAnd(AndSelector selector);
  68. /**
  69. * add an "Or" selector entry on the selector list
  70. * @param selector the selector to add
  71. */
  72. void addOr(OrSelector selector);
  73. /**
  74. * add a "Not" selector entry on the selector list
  75. * @param selector the selector to add
  76. */
  77. void addNot(NotSelector selector);
  78. /**
  79. * add a "None" selector entry on the selector list
  80. * @param selector the selector to add
  81. */
  82. void addNone(NoneSelector selector);
  83. /**
  84. * add a majority selector entry on the selector list
  85. * @param selector the selector to add
  86. */
  87. void addMajority(MajoritySelector selector);
  88. /**
  89. * add a selector date entry on the selector list
  90. * @param selector the selector to add
  91. */
  92. void addDate(DateSelector selector);
  93. /**
  94. * add a selector size entry on the selector list
  95. * @param selector the selector to add
  96. */
  97. void addSize(SizeSelector selector);
  98. /**
  99. * add a selector filename entry on the selector list
  100. * @param selector the selector to add
  101. */
  102. void addFilename(FilenameSelector selector);
  103. /**
  104. * add an extended selector entry on the selector list
  105. * @param selector the selector to add
  106. */
  107. void addCustom(ExtendSelector selector);
  108. /**
  109. * add a contains selector entry on the selector list
  110. * @param selector the selector to add
  111. */
  112. void addContains(ContainsSelector selector);
  113. /**
  114. * add a present selector entry on the selector list
  115. * @param selector the selector to add
  116. */
  117. void addPresent(PresentSelector selector);
  118. /**
  119. * add a depth selector entry on the selector list
  120. * @param selector the selector to add
  121. */
  122. void addDepth(DepthSelector selector);
  123. /**
  124. * add a depends selector entry on the selector list
  125. * @param selector the selector to add
  126. */
  127. void addDepend(DependSelector selector);
  128. /**
  129. * add a regular expression selector entry on the selector list
  130. * @param selector the selector to add
  131. */
  132. void addContainsRegexp(ContainsRegexpSelector selector);
  133. /**
  134. * add the type selector
  135. * @param selector the selector to add
  136. * @since ant 1.6
  137. */
  138. void addType(TypeSelector selector);
  139. /**
  140. * add the different selector
  141. * @param selector the selector to add
  142. * @since ant 1.6
  143. */
  144. void addDifferent(DifferentSelector selector);
  145. /**
  146. * add the modified selector
  147. * @param selector the selector to add
  148. * @since ant 1.6
  149. */
  150. void addModified(ModifiedSelector selector);
  151. /**
  152. * add an arbitary selector
  153. * @param selector the selector to add
  154. * @since Ant 1.6
  155. */
  156. void add(FileSelector selector);
  157. }