Print

Print


Hi there,

I work in epidemiology modelling and I am starting using Mason to implement 
spatial-explicit infection processes.

When using Eclipse (or Netbeans, for that matters) for debugging and I am having 
a problem when trying to dive deep into the classes. I mean,  when following the 
tutorial, implementing the class "StudentsWithUi.java", I'd like to be able to see and 
debug the code for instance of the class Console (and all the others) but Eclipse 
(nor Neatbeans) seems not being able to show those codes in debug mode.. 

I have tried different alternatives to sort out the problem, such as moving the 
needed Mason classes (e.g. sim.display.*, etc) to my current package (Students) 
but that did not seen to work straightforward (a lot of errors are produced).

I also have tried the other way around, that is to move my Student package to 
sim.display, not errors are produced then, but Eclipse is not able to find the correct 
main function.

So my question is -It is possible to see and debug (and follow the code in debug 
mode) the Mason classes beyond the init, setupPortrayals, start, etc up to the 
basic classes such us GUIState, Console, and the likes?

Any hint would be highly appreciated, and thanks in advance

Cheers, 

Carlos

ps. below is the tutorial example "StudentsWithUI" as I have it implemented  as a 
package "Studiantes" in Eclipse.


package Studiantes;

import sim.portrayal.network.*;

public class StudentsWithUI extends GUIState
	{
	public Display2D display;
	public JFrame displayFrame;

	ContinuousPortrayal2D yardPortrayal = new ContinuousPortrayal2D();
	NetworkPortrayal2D buddiesPortrayal = new NetworkPortrayal2D();

	
	public static void main (String[] args)
		{
			StudentsWithUI vid = new StudentsWithUI();
			Console c = new Console(vid);
			c.setVisible(true);
		}

	public StudentsWithUI() { super(new Students(System.currentTimeMillis())); }
	public StudentsWithUI(SimState state) { super(state); }
	public static String getName() { return "Student Schoolyard Cliques"; }

	public void start()

		{


		setupPortrayals();
		}

	public void load(SimState state)

		{
		super.load(state);
		setupPortrayals();
		}

	public void setupPortrayals()
		{
		Students students = (Students) state;

		// tell the portrayals what to portray and how t portray them
		yardPortrayal.setField( students.yard );
		yardPortrayal.setPortrayalForAll(new OvalPortrayal2D());

		buddiesPortrayal.setField( new SpatialNetwork2D( students.yard, 
students.buddies ) );
		buddiesPortrayal.setPortrayalForAll( new SimpleEdgePortrayal2D() );

		// reschedule the displayer
		display.reset();
		display.setBackdrop(Color.white);

		// redraw the display
		display.repaint();
		}
	public void init (Controller c)
		{
			super.init(c);
			display = new Display2D(600,600,this);
			display.setClipping(false);

			displayFrame = display.createFrame();
			displayFrame.setTitle("Schoolyard Display");
			c.registerFrame(displayFrame); 			// so the frame 
appears in the "Display" list
			displayFrame.setVisible(true);
			display.attach (buddiesPortrayal, "Buddies");
			display.attach( yardPortrayal, "Yard" );	

		}

	public void quit()
	{
		super.quit();
		if (displayFrame!=null) displayFrame.dispose();
		displayFrame = null;
		display = null;
	}

	}