FileDocCategorySizeDatePackage
Rotating1.javaAPI DocExample1093Sat Sep 12 03:01:00 BST 1998None

Rotating1

public class Rotating1 extends Object
Rotating a JGL container, copy during rotate.
see
com.objectspace.jgl.algorithms.Rotating
version
3.0.0
author
ObjectSpace, Inc.

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)

    Array array1 = new Array();
    for ( int i = 0; i < 5; i++ )
      array1.add( new Integer( i ) );
    for ( int i = 0; i < array1.size(); i++ )
      {
      Array array2 = new Array( array1 );
      ArrayIterator p = array2.begin();
      p.advance( i );
      Rotating.rotate( array2.begin(), p, array2.end() );
      System.out.println( "Rotate around index " + i + ", " + array1 + " -> " + array2 );
      }

    Deque d = new Deque();
    ArrayIterator q = array1.begin();
    q.advance( 1 );
    Rotating.rotateCopy( array1.begin(), q, array1.end(), new InsertIterator( d ) );
    System.out.println( "Rotate around index 2, " + array1 + " -> " + d );