home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1998 October A / Pcwk10a98.iso / Inprise / TRIAL / JBUILDER / JSAMPLES.Z / Functions7.java < prev    next >
Text File  |  1998-05-08  |  714b  |  28 lines

  1. // Copyright(c) 1996,1997 ObjectSpace, Inc.
  2. import com.objectspace.jgl.*;
  3. import com.objectspace.jgl.algorithms.*;
  4. import com.objectspace.jgl.functions.*;
  5. import com.objectspace.jgl.predicates.*;
  6.  
  7. public class Functions7
  8.   {
  9.   public static void main( String[] args )
  10.     {
  11.     Array array = new Array();
  12.     array.add( "ape" );
  13.     array.add( "giraffe" );
  14.     array.add( "lizard" );
  15.  
  16.     BinaryPredicate comparator = new BinaryComposePredicate
  17.       ( 
  18.       new GreaterNumber(), 
  19.       new LengthString(), 
  20.       new LengthString() 
  21.       );
  22.     System.out.println( "before = " + array );
  23.  
  24.     Sorting.sort( array, comparator );
  25.     System.out.println( "after = " + array );
  26.     }
  27.   }
  28.