Nodenet Problem Set Javadocs

nodenet
Interface NodeNetElement

All Superinterfaces:
java.lang.Runnable
All Known Implementing Classes:
Channel, Node

public interface NodeNetElement
extends java.lang.Runnable

NodeNetElement is an interface implemented by any and all Nodes and channels. It defines the basic methods any element must have.

Version:
$Id: NodeNetElement.java,v 1.5 2004/01/14 21:43:17 gus Exp $
Author:
Todd C. Parnell, tparnell@ai.mit.edu, Patrick G. Heck, gus.heck@olin.edu

Method Summary
 void configure()
          Display a configuratin dialog to the user and record changes made to the configuration via this dialog.
 boolean contains(int x, int y)
          Determine if this element contains the specified point.
 boolean contains(java.awt.Point p)
          Determine if this element contains the specified point.
 void destroy()
          Permanantly release all resources held by this element, and allow it's thread to run to completion.
 java.lang.String getName()
          Get the name of this instance.
 boolean isDestroyed()
          Test to see if this element has been destroyed.
 boolean isEnabled()
          Determine if this element is enabled.
 boolean isSelected()
          Determine the selection stae of this element.
 void notifyOfDestruction(NodeNetElement nne)
          Indicate that another element referenced by this object is being destroyed, and references to the specified element should be dropped.
 void paint(java.awt.Graphics g)
          Paint ourself to a graphics context.
 void setEnabled(boolean b)
          Set the enabled property.
 void setName(java.lang.String name)
          Set the name of this instance.
 void setSelected(boolean b)
          Notify this object that it should render itself as selected or unselected.
 void start()
          begin exhibiting the behavior of this element This method is called when a simulation is started.
 void stop()
          Stop exhibiting the behavior of this element.
 
Methods inherited from interface java.lang.Runnable
run
 

Method Detail

paint

public void paint(java.awt.Graphics g)
Paint ourself to a graphics context.

Parameters:
g - The graphics context on which to render ourself

setSelected

public void setSelected(boolean b)
Notify this object that it should render itself as selected or unselected.

Parameters:
b - the new selection state

isSelected

public boolean isSelected()
Determine the selection stae of this element.

Returns:
the current selection state

setEnabled

public void setEnabled(boolean b)
Set the enabled property. This property determines whether or not the element participates in the simulation. Elements that are disabled should never have any behavior beyond the fact that they exist. Enabled elements interact with other elements by generating, absorbing or transmitting packets.

Parameters:
b - the new state of the enabled property

isEnabled

public boolean isEnabled()
Determine if this element is enabled.

Returns:
the current state of the enabled property.
See Also:
setEnabled(boolean)

contains

public boolean contains(java.awt.Point p)
Determine if this element contains the specified point.

Parameters:
p - the point to test
Returns:
true if the point is contained, false otherwise.

contains

public boolean contains(int x,
                        int y)
Determine if this element contains the specified point.

Parameters:
x - the x coordinate of the point to test
y - the y coordinate of the point to test
Returns:
true if the point is contained, false otherwise.

configure

public void configure()
Display a configuratin dialog to the user and record changes made to the configuration via this dialog.


setName

public void setName(java.lang.String name)
Set the name of this instance. Names may or may not be unique, and may or may not play a role in the functionality of the class.

Parameters:
name - The name to use for this element.

getName

public java.lang.String getName()
Get the name of this instance.

Returns:
then name of this element
See Also:
setName(String)

start

public void start()
begin exhibiting the behavior of this element This method is called when a simulation is started.


stop

public void stop()
Stop exhibiting the behavior of this element. This method is called on all NodeNetElements withing a simulation pannel when a simulation is stopped.


destroy

public void destroy()
Permanantly release all resources held by this element, and allow it's thread to run to completion. This must be called to make an element eligable for garbage collection


isDestroyed

public boolean isDestroyed()
Test to see if this element has been destroyed.

Returns:
true if the object is destroyed false otherwise.

notifyOfDestruction

public void notifyOfDestruction(NodeNetElement nne)
Indicate that another element referenced by this object is being destroyed, and references to the specified element should be dropped.

Parameters:
nne - the element that is being destroyed

Nodenet Problem Set Javadocs