FileDocCategorySizeDatePackage
Overview11.javaAPI DocExample1640Sat Sep 12 03:01:00 BST 1998None

Overview11

public class Overview11 extends Object

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)
This example only works with ObjectSpace Voyager(tm). Visit the Voyager homepage for more information.

    try
      {
      // Construct a new Array object on localhost:8000 and build a virtual
      // reference called array to comunicate with it. Add elements as if
      // it were local.
      VArray array = new VArray( "localhost:8000" );
      array.add( "Texas Fight!" );
      array.add( "Bevo" );
      array.add( "Hook 'Em" );

      // persist the remote Array in te Voyager database
      array.saveNow();

      // printing works like you'd expect
      System.out.println( "container=" + array );

      // remote algorithms
      VSorting.sort( array, new LessString(), "localhost:8000" );
      System.out.println( "sorted container=" + array );

      // and iteration as well
      array.setVirtual( true );
      new VArrayIterator(); // make sure the class is loaded
      ForwardIterator iter = array.start();
      array.setVirtual( false );
      while ( iter.hasMoreElements() )
        System.out.println( "element=" + iter.nextElement() );
      }
    catch ( VoyagerException ex )
      {
      System.err.println( "caught: " + ex );
      }

    Voyager.shutdown();