home *** CD-ROM | disk | FTP | other *** search
/ BUG 15 / BUGCD1998_06.ISO / aplic / jbuilder / jsamples.z / Permuting1.java < prev    next >
Encoding:
Java Source  |  1997-07-30  |  882 b   |  36 lines

  1. // Copyright(c) 1996,1997 ObjectSpace, Inc.
  2.  
  3. import COM.objectspace.jgl.*;
  4.  
  5. /**
  6.  * Creating permutations of an JGL container and a native array of Objects.
  7.  *
  8.  * @see COM.objectspace.jgl.Permuting
  9.  * @version 2.0.2
  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 LessNumber() ) );
  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.