FileDocCategorySizeDatePackage
Counting2.javaAPI DocExample851Sat Sep 12 03:01:00 BST 1998None

Counting2

public class Counting2 extends Object
Sum the values of a range using a binary function.
see
com.objectspace.jgl.algorithms.Counting
version
3.0.0
author
ObjectSpace, Inc.

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

    Array array = new Array();
    array.add( new Long( 5 ) );
    array.add( new Long( 4 ) );
    array.add( new Long( 3 ) );
    array.add( new Long( 2 ) );
    array.add( new Long( 1 ) );

    Number prod = new Long( 1 );
    prod = Counting.accumulate
      (
      array.start(),
      array.finish(),
      prod,
      new TimesNumber( prod.getClass() )
      );

    System.out.println( "Product = " + prod );