Update of /cvsroot/javanetsim/javaNetSim/core
In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv11496/core
Modified Files:
EthernetLink.java
Added Files:
FalseRandom.java
Log Message:
Index: EthernetLink.java
===================================================================
RCS file: /cvsroot/javanetsim/javaNetSim/core/EthernetLink.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** EthernetLink.java 2 Mar 2006 13:37:04 -0000 1.7
--- EthernetLink.java 2 Sep 2006 12:35:00 -0000 1.8
***************
*** 30,33 ****
--- 30,34 ----
package core;
import java.util.*;
+ import core.FalseRandom;
/**
* EthernetLink extends Link. It sets two Interface links to a pc.
***************
*** 85,91 ****
if (!temp.getSourceName().equals(inSourceName))
{
! if( ((sievingCoefficient)/100)>Math.random())
temp.receivePacket(inPacket);
else throw new LowLinkException("Packet lost due to physical link problems!");
}
}
--- 86,100 ----
if (!temp.getSourceName().equals(inSourceName))
{
! /*if( ((sievingCoefficient)/100)>Math.random())
temp.receivePacket(inPacket);
else throw new LowLinkException("Packet lost due to physical link problems!");
+ */
+ int cat = FalseRandom.Kotochigov();
+
+ System.out.println("Cat runs across the blackboard and generates... " + cat + "!");
+
+ if(cat==1)
+ temp.receivePacket(inPacket);
+ else throw new LowLinkException("Packet lost due to physical link problems!");
}
}
--- NEW FILE: FalseRandom.java ---
package core;
public class FalseRandom{
public static int count = 0;
public static int Kotochigov(){
int sequence[] = {1, 1, 0, 0, 0, 0, 0, 0};
if(count >= sequence.length) count = 0;
return sequence[count++];
}
}
|