java to vba

Discussion in 'Java' started by PST, May 9, 2007.

  1. PST

    PST Guest

    hello

    Is what somebody can translate this code into vba

    thank you

    declare partial_results as structure of
    min = array of numbers[ 4 ]; //min[0] is match in six numbers,
    min[1] is match in five numbers, etc
    max = array of numbers[ 4 ];
    comboCount as number;
    end declare

    function main
    declare final_results as list;

    for each c=1,2,3,4,5,6 to 44,45,46,47,48,49 do
    results = new partial_results;
    for each d=(tickets being tested) do
    match = how_many_numbers_match( c, d );
    increment( results, match );
    end for
    similar = find_similar_results( final_results, results );
    if similar is NULL then
    add results to final_results;
    else
    add( results, similar );
    end if
    end for

    //now the final_results list contains all data for the coverage report
    //the following applies to each item in this list:
    //"comboCount tested combinations produce min[0] to max[0] of
    jackpot hits,
    //and min[1] to max[1] of 'match 5' hits and min[2] to max[2] of
    'match 4' hits
    //and min[3] to max[3] of 'match 3' hits
    end function

    function increment( res as partial_results, match as number )
    index_to_increment = 4 - (match-2); //reverse the match index to
    have highest match at index '0'
    min[ index_to_increment ] = min[ index_to_increment ] + 1;
    max[ index_to_increment ] = max[ index_to_increment ] + 1;
    comboCount = comboCount+1;
    end function

    function add( res1 as partial_results, res2 as partial_results )
    res2.comboCount = res2.comboCount + res1.comboCount;
    for i=0 to 3 do
    if res1.min[ i ] < res2.min[ i ] then
    res2.min[ i ] = res1.min[ i ];
    end if
    if res1.max[ i ] > res2.max[ i ] then
    res2.max[ i ] = res1.max[ i ];
    end if
    end for
    end function

    function find_similar_results( list, results )
    for each r=partial_results from the list do
    for i=0 to 3 do
    if results.max[ i ] > 0 then
    if results.max = r.max[ i ] then
    return r;
    else
    break;
    end if
    else if r.max[ i ] > 0 then
    break;
    end if
    end for
    end for
    return NULL;
    end function
     
    PST, May 9, 2007
    #1
    1. Advertising

  2. PST

    Wojtek Guest

    PST wrote :
    > hello
    >
    > Is what somebody can translate this code into vba


    Homework alert!

    --
    Wojtek :)
     
    Wojtek, May 9, 2007
    #2
    1. Advertising

  3. PST

    Lew Guest

    Wojtek wrote:
    > PST wrote :
    >> hello
    >>
    >> Is what somebody can translate this code into vba

    >
    > Homework alert!


    And nothing to do with Java, either.

    --
    Lew
     
    Lew, May 10, 2007
    #3
    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. Iulian Dan Repolschi

    pass VBA class module to c# objects

    Iulian Dan Repolschi, May 20, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    5,877
    Eric Marvets
    May 22, 2004
  2. Nelson Smith

    Calling VBA Script...

    Nelson Smith, Mar 2, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    391
    Chris Jackson
    Mar 2, 2004
  3. Mauro

    ERROR: Call to Interop.VBA.dll

    Mauro, Mar 3, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    2,253
    Mauro
    Mar 4, 2004
  4. Oleg  Konovalov

    Java calling C# or VBA (MS Office API) ?

    Oleg Konovalov, Jun 2, 2004, in forum: Java
    Replies:
    6
    Views:
    1,411
    Andrew Thompson
    Jun 4, 2004
  5. Ghislain

    Using JAVA inside VBA

    Ghislain, May 11, 2013, in forum: Java
    Replies:
    7
    Views:
    732
    Ghislain
    May 13, 2013
Loading...

Share This Page