|
Nodenet Problem Set Javadocs | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object nodenet.Channel
A Channel object is a NodeNetElement that connects two Nodes. A
channel implements both the InputChannel
and
OutputChannel
interfaces. Channels have an assocated
capacity and latency. The capacity of a channel indicates how many
packets may be present before a ChannelFullException
is thrown. The latency of a channel is a measure of how long (in
ms) a packet takes to travel from the input to the output.
Field Summary | |
static int |
MAX_CAPACITY
the maximum allowable capacity |
static int |
MAX_LATENCY
the maximum allowable latency |
Constructor Summary | |
Channel(Node start,
Node end)
Creates a new Channel with the given start and end nodes. |
|
Channel(Node start,
Node end,
boolean enabled,
int latency,
int capacity)
Build a channel that is fully configured. |
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()
Destroy the Channel. |
boolean |
equals(java.lang.Object o)
Determines if two Channels are equal. |
protected void |
finalize()
|
int |
getCapacity()
|
int |
getLatency()
|
java.lang.String |
getName()
Get the name of this instance. |
boolean |
isDestroyed()
Test to see if this element has been destroyed. |
boolean |
isEditable()
|
boolean |
isEnabled()
Determine if this element is enabled. |
boolean |
isSelected()
Determine the selection stae of this element. |
void |
notifyOfDestruction(NodeNetElement nne)
Notify this that a NodeNetElement has been destroyed. |
void |
paint(java.awt.Graphics g)
Paint ourself to a graphics context. |
java.lang.Object |
readObject()
Read an object from the channel. |
void |
reset()
Custom de-serialization. |
void |
run()
|
void |
setCapacity(int cap)
|
void |
setEnabled(boolean b)
Set the enabled property. |
void |
setLatency(int lat)
|
void |
setName(java.lang.String n)
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. |
java.lang.String |
templateXML()
|
void |
writeObject(java.lang.Object o)
Insert an object into the channel. |
Methods inherited from class java.lang.Object |
clone, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int MAX_LATENCY
public static final int MAX_CAPACITY
Constructor Detail |
public Channel(Node start, Node end) throws SameNodeException
equals
), throws SameNodeException.
public Channel(Node start, Node end, boolean enabled, int latency, int capacity) throws SameNodeException
Method Detail |
public void writeObject(java.lang.Object o) throws ChannelFullException, ChannelDisabledException
writeObject
in interface OutputChannel
o
- The object to be inserted.
ChannelFullException
- if the number of objects in the
channel already equals or exceeds the capacity.
ChannelDisabledException
- if the channel is currently
disabledpublic java.lang.Object readObject() throws ChannelEmptyException, ChannelDisabledException
readObject
in interface InputChannel
ChannelEmptyException
- if no objects are present in the
channel or the oldest object has not propigated through the
channel yet (due to a non-zero latency).
ChannelDisabledException
- if the channel is diabledpublic int getCapacity()
public void setCapacity(int cap)
public int getLatency()
public void setLatency(int lat)
public void setSelected(boolean b)
NodeNetElement
setSelected
in interface NodeNetElement
b
- the new selection statepublic boolean isSelected()
NodeNetElement
isSelected
in interface NodeNetElement
public void setEnabled(boolean b)
NodeNetElement
setEnabled
in interface NodeNetElement
b
- the new state of the enabled propertypublic boolean isEnabled()
NodeNetElement
isEnabled
in interface NodeNetElement
NodeNetElement.setEnabled(boolean)
public boolean contains(int x, int y)
NodeNetElement
contains
in interface NodeNetElement
x
- the x coordinate of the point to testy
- the y coordinate of the point to test
public boolean contains(java.awt.Point p)
NodeNetElement
contains
in interface NodeNetElement
p
- the point to test
public void setName(java.lang.String n)
NodeNetElement
setName
in interface NodeNetElement
n
- The name to use for this element.public java.lang.String getName()
NodeNetElement
getName
in interface NodeNetElement
NodeNetElement.setName(String)
public void destroy()
destroy()
should be called
whenever a Channel will no longer be used. When destroyed,
Channels notify all connected Nodes of the impending destruction.
Note: Channel.finalize()
automatically calls
destroy()
.
destroy
in interface NodeNetElement
public boolean isDestroyed()
NodeNetElement
isDestroyed
in interface NodeNetElement
public void notifyOfDestruction(NodeNetElement nne)
notifyOfDestruction
in interface NodeNetElement
nne
- the element that is being destroyedpublic boolean isEditable()
public void configure()
NodeNetElement
configure
in interface NodeNetElement
public void paint(java.awt.Graphics g)
NodeNetElement
paint
in interface NodeNetElement
g
- The graphics context on which to render ourselfpublic void start()
NodeNetElement
start
in interface NodeNetElement
public void stop()
NodeNetElement
stop
in interface NodeNetElement
public void run()
run
in interface java.lang.Runnable
public boolean equals(java.lang.Object o)
public java.lang.String templateXML()
protected void finalize() throws java.io.IOException
java.io.IOException
public void reset()
reset
in interface Resettable
|
Nodenet Problem Set Javadocs | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |