Accumulate 1.0

Discussion in 'Java' started by Roedy Green, Jul 17, 2004.

  1. Roedy Green

    Roedy Green Guest

    Accumulate Version 1.0

    Accumulate amounts by category

    Class library used to accumulate values by category.
    It might be useful for example in a billing program
    to accumulate hours by various categories.

    It could be used to count how many times various words
    occurred in a document.

    All you need to is say:

    buckets.accumulate( "somecategory", someamount );

    And Accumulate looks after creating the buckets to
    accumulate new categories for you.

    e.g.

    Accumulate buckets = new Accumulate( 20 );
    buckets.accumulate( "ugli fruit", 3 );
    buckets.accumulate( "peaches", 10 );
    buckets.accumulate( "strawberries", 15 );
    buckets.accumulate( "peaches", 14 );
    String[] categories = buckets.categories();

    // prints:
    // peaches:24
    // strawberries:15
    // ugli fruit:3
    for ( int i=0; i<categories.length; i++ )
    {
    System.out.println( categories
    + ":"
    + buckets.total( categories ));
    }

    Freeware copyright 2004 Canadian Mind Products.
    May be used freely for any purpose but military.
    All Java source code is included.
    download from http://mindprod.com/products.html#ACCUMULATE


    --
    Canadian Mind Products, Roedy Green.
    Coaching, problem solving, economical contract programming.
    See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
     
    Roedy Green, Jul 17, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Brian K. Michalk

    64 bit add and accumulate with MMX

    Brian K. Michalk, Sep 20, 2003, in forum: Perl
    Replies:
    6
    Views:
    663
    Terje Mathisen
    Sep 20, 2003
  2. accumulate() usage

    , Feb 2, 2006, in forum: C++
    Replies:
    1
    Views:
    360
    Neelesh Bodas
    Feb 2, 2006
  3. cesco
    Replies:
    5
    Views:
    475
    Maxim Yegorushkin
    Feb 13, 2006
  4. Replies:
    1
    Views:
    1,757
  5. Henrique A. Menarin

    Boost algorithm ll::accumulate question

    Henrique A. Menarin, Jan 28, 2007, in forum: C++
    Replies:
    7
    Views:
    983
    Roland Pibinger
    Jan 29, 2007
Loading...

Share This Page