home *** CD-ROM | disk | FTP | other *** search
/ ActiveX Programming Unleashed CD / AXU.iso / jgl_1_1 / jgl_1_1.exe / examples / Permuting1.java < prev    next >
Encoding:
Java Source  |  1996-09-10  |  847 b   |  36 lines

  1. // Copyright(c) 1996 ObjectSpace, Inc.
  2.  
  3. import jgl.*;
  4.  
  5. /**
  6.  * Creating permutations of an JGL container and a native array of Objects. 
  7.  * <p>
  8.  * @see jgl.Permuting
  9.  * @version 1.1
  10.  * @author ObjectSpace, Inc.
  11.  */
  12.  
  13. public class Permuting1
  14.   {
  15.   public static void main( String[] args )
  16.     {
  17.     Array array = new Array();
  18.     array.add( new Integer( 0 ) );
  19.     array.add( new Integer( 2 ) );
  20.     array.add( new Integer( 5 ) );
  21.     do
  22.       {
  23.       System.out.println( "array = " + array );
  24.       }
  25.     while( Permuting.nextPermutation( array, new LessInteger() ) );
  26.  
  27.     String[] strings = { "gnu", "emu", "dog" };
  28.     ObjectArray strArray = new ObjectArray( strings );
  29.     do
  30.       {
  31.       System.out.println( strArray );
  32.       }
  33.     while( Permuting.prevPermutation( strArray, new LessString() ) );
  34.     }
  35.   }
  36.