swarm-support
[Top][All Lists]
Advanced

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

Re: Java execution problem


From: david ROBIN
Subject: Re: Java execution problem
Date: Mon, 6 Dec 1999 00:42:12 -0800 (PST)


--- "Marcus G. Daniels" <address@hidden> a écrit:
> >>>>> "DR" == david ROBIN <address@hidden>
> writes:
> 
> DR> and sometimes it crashes and i got the following
> error: "internal
> DR> error Please check your CLASSPATH and your
> installation.
> DR> Exception throw was of type
> 'java/lang/NullPointerException' NULL
> DR> message"
> 
> I can't reproduce this.  Can you modify the program
> below to make the
> crash happen?
> 
> DR> sketch of code
> 
> Please try to avoid the "sketch".  A little extra
> effort to make a
> test program actually crash means that, in almost
> all cases (and
> especially if you are an SDG member) that you will
> get an immediate
> fix or explanation.
> 
> hi Marcus, thanks for trying to help me.
In fact i have succesfully tested my program with one
Agent, one Client(customer) and one
rapporteur(reporter), and it crashes when i want to
manage a list of client, agent, and reporter so i
thought it was coming from the creation of the list,
that's the reason why i gave you the 'sketch' of code
which is corresponding to the lists creation.
So here i give you the total modelsite.
I put nbPersonne to 5 to make the program frequently
crashes, if i set it to 1, i almost never crashes....
In fact the most strange thing is that it seems to be
link to the random distribution:
when i run my program by "javaswarm StartSim
--varyseed" it doesn't crash at the same simulation
time, or it doesn't crash at all...
David.

                //ModelSite.java


import swarm.Globals;
import swarm.Selector;
import swarm.defobj.Zone;
import swarm.defobj.SymbolImpl;

import swarm.activity.Activity;
import swarm.activity.ActionGroup;
import swarm.activity.ActionGroupImpl;
import swarm.activity.Schedule;
import swarm.activity.ScheduleImpl;
import swarm.activity.ActionForEach;

import swarm.collections.List;
import swarm.collections.ListImpl;

import swarm.objectbase.Swarm;
import swarm.objectbase.SwarmImpl;


public class ModelSite extends SwarmImpl
{

   //public ActionGroup modelActions;
   public Schedule modelSchedule1;
   public Schedule modelSchedule2;
   public List ListeAgent;
   public List ListeClient;
   public List ListeRapporteur;
   public Agent reporter;
   public int nbmaxProfil;
   public int nbPersonne;
   public double PProb;  
   public double DProb;   
   public double RProb;         
   public double AProb; 

   public ModelSite (Zone aZone)
   {
      super(aZone);
      nbmaxProfil=3;
      nbPersonne=5;
      PProb=0.52;
      DProb=0.7;
      RProb=0.6;
      AProb=0.48;
   }

   public List getListeClient()
   {
    return ListeClient;
   }

   public List getListeAgent()
   {
    return ListeAgent;
   }

   public List getListeRapporteur()
   {
    return ListeRapporteur;
   }
   
   public Object buildObjects ()
   {  int i;


      super.buildObjects();

      ListeAgent= new ListImpl (getZone ());
      ListeClient= new ListImpl (getZone ());
      ListeRapporteur= new ListImpl (getZone ());

      for (i=0;i<nbPersonne ;i++)
       {
        int j;
        Agent unAgent;
        Client unClient;
        Rapporteur unRapporteur;

        unAgent=new Agent();
        unClient= new Client();
        unRapporteur=new Rapporteur();

        j =
Globals.env.uniformIntRand.getIntegerWithMin$withMax(0,nbmaxProfil-1);

        ListeAgent.addLast(unAgent);
        ListeClient.addLast(unClient);
        ListeRapporteur.addLast(unRapporteur);

        unAgent.ResetTabnote();
        unClient.setProb  (PProb,DProb,RProb,AProb);
              unClient.setProfil(j);
        unClient.setAgent(unAgent);
        unRapporteur.setAgent(unAgent);
              unRapporteur.setClient(unClient);
       }
       reporter=ListeAgent.removeFirst();
      return this;
   }

    public Object buildActions ()
     {
      super.buildActions();


      modelSchedule1 = new ScheduleImpl (getZone
(),2);
      modelSchedule2 = new ScheduleImpl (getZone
(),2);

      try
      {


        Selector sel =new Selector (Class.forName
("Client"), "VisiterSite",false);
        modelSchedule1.at$createActionForEach$message
(0,ListeClient, sel);
      }
      catch(Exception e)
      {
        System.err.println("Exception Visite: " +
e.getMessage ());
      }





        try
      {
        Selector sel3 =new Selector (Class.forName
("Rapporteur"), "comparer",false);
        modelSchedule2.at$createActionForEach$message
(1,ListeRapporteur, sel3);
      }
      catch(Exception e)
      {
        System.err.println("Exception Rapporteur: " +
e.getMessage ());
      }

      return this;
     }
    public Activity activateIn (Swarm swarmContext)
      {
         super.activateIn (swarmContext);
         modelSchedule1.activateIn (this);
         modelSchedule2.activateIn (this);
         return getActivity ();
      }
} 
> 
                  ==================================
>    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.
> 
> 

__________________________________________________
Do You Yahoo!?
Thousands of Stores.  Millions of Products.  All in one place.
Yahoo! Shopping: http://shopping.yahoo.com

                  ==================================
   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]