Lines Matching refs:constraint

59    * Returns a constraint that verifies that the element is not null. If the
70 * constraint. Any operations that add new elements to the collection will
71 * call the provided constraint. However, this method does not verify that
72 * existing elements satisfy the constraint.
77 * @param constraint the constraint that validates added elements
81 Collection<E> collection, Constraint<? super E> constraint) {
82 return new ConstrainedCollection<E>(collection, constraint);
88 private final Constraint<? super E> constraint;
91 Collection<E> delegate, Constraint<? super E> constraint) {
93 this.constraint = checkNotNull(constraint);
99 constraint.checkElement(element);
103 return delegate.addAll(checkElements(elements, constraint));
109 * constraint. Any operations that add new elements to the set will call the
110 * provided constraint. However, this method does not verify that existing
111 * elements satisfy the constraint.
116 * @param constraint the constraint that validates added elements
120 Set<E> set, Constraint<? super E> constraint) {
121 return new ConstrainedSet<E>(set, constraint);
127 private final Constraint<? super E> constraint;
129 public ConstrainedSet(Set<E> delegate, Constraint<? super E> constraint) {
131 this.constraint = checkNotNull(constraint);
137 constraint.checkElement(element);
141 return delegate.addAll(checkElements(elements, constraint));
147 * constraint. Any operations that add new elements to the sorted set will
148 * call the provided constraint. However, this method does not verify that
149 * existing elements satisfy the constraint.
154 * @param constraint the constraint that validates added elements
158 SortedSet<E> sortedSet, Constraint<? super E> constraint) {
159 return new ConstrainedSortedSet<E>(sortedSet, constraint);
165 final Constraint<? super E> constraint;
168 SortedSet<E> delegate, Constraint<? super E> constraint) {
170 this.constraint = checkNotNull(constraint);
176 return constrainedSortedSet(delegate.headSet(toElement), constraint);
180 delegate.subSet(fromElement, toElement), constraint);
183 return constrainedSortedSet(delegate.tailSet(fromElement), constraint);
186 constraint.checkElement(element);
190 return delegate.addAll(checkElements(elements, constraint));
196 * constraint. Any operations that add new elements to the list will call the
197 * provided constraint. However, this method does not verify that existing
198 * elements satisfy the constraint.
204 * @param constraint the constraint that validates added elements
208 List<E> list, Constraint<? super E> constraint) {
210 ? new ConstrainedRandomAccessList<E>(list, constraint)
211 : new ConstrainedList<E>(list, constraint);
218 final Constraint<? super E> constraint;
220 ConstrainedList(List<E> delegate, Constraint<? super E> constraint) {
222 this.constraint = checkNotNull(constraint);
229 constraint.checkElement(element);
233 constraint.checkElement(element);
237 return delegate.addAll(checkElements(elements, constraint));
241 return delegate.addAll(index, checkElements(elements, constraint));
244 return constrainedListIterator(delegate.listIterator(), constraint);
247 return constrainedListIterator(delegate.listIterator(index), constraint);
250 constraint.checkElement(element);
255 delegate.subList(fromIndex, toIndex), constraint);
263 List<E> delegate, Constraint<? super E> constraint) {
264 super(delegate, constraint);
270 * specified constraint. Any operations that would add new elements to the
271 * underlying list will be verified by the constraint.
274 * @param constraint the constraint for elements in the list
278 ListIterator<E> listIterator, Constraint<? super E> constraint) {
279 return new ConstrainedListIterator<E>(listIterator, constraint);
285 private final Constraint<? super E> constraint;
288 ListIterator<E> delegate, Constraint<? super E> constraint) {
290 this.constraint = constraint;
297 constraint.checkElement(element);
301 constraint.checkElement(element);
307 Collection<E> collection, Constraint<E> constraint) {
309 return constrainedSortedSet((SortedSet<E>) collection, constraint);
311 return constrainedSet((Set<E>) collection, constraint);
313 return constrainedList((List<E>) collection, constraint);
315 return constrainedCollection(collection, constraint);
321 * constraint. Any operations that add new elements to the multiset will call
322 * the provided constraint. However, this method does not verify that
323 * existing elements satisfy the constraint.
328 * @param constraint the constraint that validates added elements
332 Multiset<E> multiset, Constraint<? super E> constraint) {
333 return new ConstrainedMultiset<E>(multiset, constraint);
339 private final Constraint<? super E> constraint;
342 Multiset<E> delegate, Constraint<? super E> constraint) {
344 this.constraint = checkNotNull(constraint);
353 return delegate.addAll(checkElements(elements, constraint));
356 constraint.checkElement(element);
360 constraint.checkElement(element);
364 constraint.checkElement(element);
375 Collection<E> elements, Constraint<? super E> constraint) {
378 constraint.checkElement(element);