edu.ucsb.ccs.jaqual
Class Elements

java.lang.Object
  |
  +--edu.ucsb.ccs.jaqual.Elements

public class Elements
extends java.lang.Object

Quantifier to find a subset of a collection that matches certain criteria. For example, in the collection {1, 2, 3, 4, 5}, one might wish to extract the integers that are greater than zero. We can code this as:

Example:

   Vector positiveEls = Elements.in(myCollection).suchThat(new InRange(0, Integer.MAX_VALUE));
 

Version:
$Id: Elements.java,v 1.5 2002/07/14 07:37:59 parkera Exp $
Author:
Parker Abercrombie

Constructor Summary
Elements(java.util.Collection c)
          Create a new elements quantifier.
Elements(java.lang.Object[] array)
          Create a new Elements quantifier for an array.
 
Method Summary
static Elements in(java.util.Collection c)
          Create a new elements quantifier.
 java.util.Vector suchThat(Assertion a)
          Find the subset of the collection that meets a given assertion.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Elements

public Elements(java.util.Collection c)
Create a new elements quantifier.

Parameters:
c - the collection of object to which quantifier applies.

Elements

public Elements(java.lang.Object[] array)
Create a new Elements quantifier for an array.

Parameters:
array - the array of objects to which quantifier applies.
Method Detail

in

public static Elements in(java.util.Collection c)
Create a new elements quantifier.

Parameters:
c - the collection of object to which quantifier applies.

suchThat

public java.util.Vector suchThat(Assertion a)
Find the subset of the collection that meets a given assertion.

Parameters:
a - the test to apply to objects in the collection.
Returns:
the elements that meet `a'.