|
From: <dir...@us...> - 2010-05-10 09:22:11
|
Revision: 2111
http://shox.svn.sourceforge.net/shox/?rev=2111&view=rev
Author: dirk_held
Date: 2010-05-10 09:22:05 +0000 (Mon, 10 May 2010)
Log Message:
-----------
Add addLink (copied and adapted from the LogLinkLayer-class) to this class.
Modified Paths:
--------------
trunk/src/net/sf/shox/simulator/event/LogLinkPacket.java
Modified: trunk/src/net/sf/shox/simulator/event/LogLinkPacket.java
===================================================================
--- trunk/src/net/sf/shox/simulator/event/LogLinkPacket.java 2009-10-23 13:45:53 UTC (rev 2110)
+++ trunk/src/net/sf/shox/simulator/event/LogLinkPacket.java 2010-05-10 09:22:05 UTC (rev 2111)
@@ -20,6 +20,9 @@
import net.sf.shox.simulator.Address;
import net.sf.shox.simulator.NodeId;
+import net.sf.shox.simulator.node.Link;
+import net.sf.shox.simulator.node.metainf.CastType;
+import net.sf.shox.simulator.node.metainf.DownwardsLLCMetaInfo;
/**
* Super-class of all packets generated by the LogLinkLayer. This is to ensure some
@@ -30,6 +33,23 @@
*/
public class LogLinkPacket extends Packet {
+ /**
+ * Method to add a link to the packet.
+ *
+ * @param link The link to add to this packet.
+ */
+ public void addLink(Link link) {
+ CastType castType = CastType.getCastType(getReceiver());
+ DownwardsLLCMetaInfo mi = null;
+
+ if (castType == CastType.BROADCAST) {
+ mi = new DownwardsLLCMetaInfo(link, castType);
+ } else {
+ mi = new DownwardsLLCMetaInfo(link, castType, getReceiver());
+ }
+
+ getMetaInfos().addMetaInfo(mi);
+ }
/**
* Default constructor of class Packet to create a terminal packet
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|