[Javanetsim-cvs] javaNetSim/core FalseRandom.java, NONE, 1.1 EthernetLink.java, 1.7, 1.8
Status: Beta
Brought to you by:
darkkey
From: Alexander B. <da...@us...> - 2006-09-02 12:35:04
|
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++]; } } |