swarm-support
[Top][All Lists]
Advanced

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

Problems with java.


From: Arend Ligtenberg
Subject: Problems with java.
Date: Mon, 18 Oct 1999 16:12:37 +0100

Currently I'am evaluating the last version of SWARM using Java.
I'am running into  problems. I'am not such an artist with Java or Objective C 
so that may be the explanation but anyway here it comes:

I did some work with objective C and SWARM.

Currently i'am starting to use JAVA. And running into problems.

I like to test the system it building the GOL using the pre-boiled class 
ConwayLife2d.

I'am running into types of errors i don't know how to handle:
the error program accused me:
 of not proper initialising the CA
 or I get an null pointer exeption.

huh??. 

Would anybody out there be so kind to scan the included part of the code and 
tell me what i did wrong


Thanks 

Arend Ligtenberg


-----------------------------------------------------
the code (sorry for the mess)

// ModelSwarm.class                                     
//GOL in SWARM

import swarm.Globals;
import swarm.Selector;
import swarm.defobj.SymbolImpl;
import swarm.defobj.Zone;
import swarm.objectbase.Swarm;
import swarm.objectbase.SwarmImpl;
import swarm.activity.Schedule;
import swarm.activity.ScheduleImpl;
import swarm.space.ConwayLife2d;
import swarm.space.ConwayLife2dImpl;
import swarm.activity.Activity;
import swarm.activity.ActionGroup;
import swarm.activity.ActionGroupImpl;
//import swarm.objectbase.VarProbe;
//import swarm.objectbase.MessageProbe;
//import swarm.objectbase.EmptyProbeMapImpl;


public class ModelSwarm extends SwarmImpl{
  public int worldXSize, worldYSize;
  public ConwayLife2d golenv;
  public ActionGroup modelActions;                      
  public Schedule modelSchedule;

  public ConwayLife2d getGolEnv (){
    return golenv;
  }


  //creator
  public ModelSwarm (Zone aZone) {
    super (aZone);
    System.out.print ( "ModelSwarm: Initialising\n" );
    worldXSize = 100;
    worldYSize = 100;
  }

  public Object buildObjects (){
    super.buildObjects();
    System.out.print ( "ModelSwarm: building Objects\n" );
    golenv = new ConwayLife2dImpl (getZone(), worldXSize, worldYSize);
    return this;
  }

  public Object buildActions (){
    System.out.print ( "ModelSwarm: building Actions\n" );
   
    modelActions = new ActionGroupImpl (getZone ());
    try {
    modelActions.createActionTo$message(golenv, new Selector (golenv.getClass 
(), "steprule", false));
    } catch (Exception e){
      System.err.println ("Exception stepRule: " + e.getMessage ());
    }
    try{
    modelActions.createActionTo$message(golenv, new Selector (golenv.getClass 
(), "updateLattice" , false));
    } catch (Exception e){
      System.err.println ("Exception updateLattice: " + e.getMessage ());
    }

    modelSchedule = new ScheduleImpl (getZone (), 1);
    modelSchedule.at$createAction (0, modelActions); 
    return this;
  }

  public Activity activateIn (Swarm swarmContext) {
    super.activateIn(this);
    modelSchedule.activateIn(this);
    return getActivity ();
  }

}






Arend Ligtenberg
Wageningen University and Research Centre
Centre for Geo-information
Laboratory Geo-Information Science and Remote Sensing
Po Box 339
6700 AH Wageningen
tel: ++31 317 474640
www.gis.wau.nl/girs


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