home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 1998 October A
/
Pcwk10a98.iso
/
Inprise
/
TRIAL
/
JBUILDER
/
JSAMPLES.Z
/
Functions1.java
< prev
next >
Wrap
Text File
|
1998-05-08
|
659b
|
22 lines
// Copyright(c) 1996,1997 ObjectSpace, Inc.
import com.objectspace.jgl.*;
import com.objectspace.jgl.algorithms.*;
import com.objectspace.jgl.predicates.*;
public class Functions1
{
public static void main( String[] args )
{
Array array = new Array();
array.add( new Integer( 3 ) );
array.add( new Integer( -2 ) );
array.add( new Integer( 3 ) );
array.add( new Integer( -5 ) );
array.add( new Integer( -4 ) );
UnaryPredicate predicate = new PositiveNumber();
int n = Counting.countIf( array, predicate );
System.out.println( "Number of positive Integers in " + array + " = " + n );
}
}