swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Nselect/uniformDoubleRand is the source of my java program slowdown


From: Marcus G. Daniels
Subject: Re: Nselect/uniformDoubleRand is the source of my java program slowdown
Date: 22 Feb 2001 09:51:30 -0800
User-agent: Gnus/5.070084 (Pterodactyl Gnus v0.84) Emacs/20.4

>>>>> "PJ" == Paul E Johnson <address@hidden> writes:

PJ> I think the problem is that NSelect's select$from$into is not
PJ> declared in Swarm as a static method. If I try to use it, the
PJ> compiler says:

PJ> Recruiter.java:516: non-static method
PJ> select$from$into(int,java.lang.Object,java.lang.Object) cannot be
PJ> referenced from a static context NSelect.select$from$into( number,

static methods complicate use of Java interfaces, so we don't use them.
Here's how that method can be used..

import swarm.Globals;
import swarm.simtools.NSelectImpl;
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;

public class TestNSelect {
  static void main (String args[]) {
    Globals.env.initSwarm ("TestNSelect", "address@hidden", "0.0", args);

    List aList = new LinkedList ();
    List bList = new LinkedList ();

    for (int i = 0; i < 100; i++)
      aList.add (new Integer (i));

    new NSelectImpl ().select$from$into (5, aList, bList);
    
    ListIterator index = bList.listIterator ();
    while (index.hasNext ()) {
      System.out.println (index.next ());
    }
  }
}

                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]