📄 checklist.txt
字号:
Checklist for Building Stable Network Components
------------------------------------------------
When creating new components:
1. Create the constructor EXACTLY as specified in the programmer's
guide.
2. Override these methods (these are the most common, though
some may not be needed, and there are others too):
isConnectable()
neighborAdded()
neighborRemoved()
copy()
getImage()
reset()
start()
action()
compInfo()
3. Consider a create() method used to initialize most component
properties. Call this method in the constructor to make the
constructor clean.
4. For network components, the single most important event to
handle is the SimProvider.EV_RECEIVE event where incoming
network packets/cells are received from a neighbor.
---------------------------------------------------------------------
When creating component level parameters (those not related to
any particular neighbors):
1. Instantiate and initialize component level parameters during
component construction, preferably in a separate create() method.
2. Don't forget to call update() for output-type parameters right
after their creation/initialization. (for good logging and
metering)
3. Don't forget to addParameter() after parameters are created.
4. Update the copy() method to support the copy operation.
(input-type parameters are most likely to be copied, but not
output-type parameters)
5. Update reset() to ensure that the reset operation sets every
parameter (especially output-type parameters) back to the
initial value (exactly as they have just been initialized
during component construction). Input-type parameters should
not be reset in most cases.
6. Again, in reset(), don't forget to call update() for
output-type parameters after resetting their values.
---------------------------------------------------------------------
When creating neighbor-dependent parameters (parameters that exist
because of the existence of a neighbor):
1. Instantiate and initialize these parameters in neighborAdded().
2. Don't forget to call update() for output-type parameters right
after their creation/initialization. (for good logging and
metering)
3. Don't forget to addParameter() after parameters are created.
4. Don't forget to removeParameter() in neighborRemoved() (if they
are created and added in neighborAdded()).
5. These parameters are hard to copy because neighbors are different
for each component, so the copy() method shouldn't copy them.
6. Update reset() to ensure that the reset operation sets every
parameter (especially output-type parameters) back to the
initial value (exactly as they have just been initialized).
Input-type parameters should not be reset in most cases.
7. Again, in reset(), don't forget to call update() for
output-type parameters after resetting their values.
---------------------------------------------------------------------
When creating new SimParameter types:
1. Use an existing type as reference.
2. Create the constructor EXACTLY as specified in the programmer's
guide. But remember that additional parameters for the constructor
are allowed (typically initialization values).
3. Most commonly overridden methods:
globalSetValue()
doMeter() (
getString()
getJComponent()
4. Most commonly added methods:
getValue()
setValue()
5. Remember that in setValue() or globalSetValue(), if a GUI
component needs to be updated, it should be scheduled for the
GUI event-dispatching thread. See programmer's guide for details
and refer SimParamInt for an example.
6. Most complex parameter types will have a button that will
open up a dialog box when invoked. Refer SimParamFTable for
an example that utilizes the SimDialog class.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -