From: <sul...@us...> - 2008-09-23 11:11:51
|
Revision: 246 http://gridsim.svn.sourceforge.net/gridsim/?rev=246&view=rev Author: sulistio Date: 2008-09-23 11:11:48 +0000 (Tue, 23 Sep 2008) Log Message: ----------- changes to the code due to improvements and modifications in other classes. Modified Paths: -------------- trunk/source/gridsim/net/fnb/FnbInput.java trunk/source/gridsim/net/fnb/FnbOutput.java Modified: trunk/source/gridsim/net/fnb/FnbInput.java =================================================================== --- trunk/source/gridsim/net/fnb/FnbInput.java 2008-09-23 11:10:43 UTC (rev 245) +++ trunk/source/gridsim/net/fnb/FnbInput.java 2008-09-23 11:11:48 UTC (rev 246) @@ -370,12 +370,12 @@ // Increase the number of pkts already received //srcPktNum.setNumOfPkts(srcPktNum.getNumOfPkts() + 1); - srcPktNum.increaseNumOfArrivedPkts(); + srcPktNum.addNumOfArrivedPkts(); // If this is the last packet of the gridlet, then the gridlet is ok int totalPkt = ((FnbNetPacket) np).getTotalPackets(); - if (srcPktNum.getNumOfPkts() == totalPkt) - srcPktNum.setOk(true); + if (srcPktNum.getNumOfPacket() == totalPkt) + srcPktNum.setStatus(true); @@ -388,7 +388,7 @@ { // This is the last packet in the gridlet, so we have to check // if the previous packets have arrived. - if (srcPktNum.getOk() == true) + if (srcPktNum.getStatus() == true) { // The gridlet has arrived perfect, with no packet lost @@ -453,7 +453,7 @@ { srcPktNum = (source_pktNum) source_PktNum_array.get(i); - if ((srcPktNum.getSource() == src) && (srcPktNum.getGlID() == glID)) + if ((srcPktNum.getSourceID() == src) && (srcPktNum.getGridletID() == glID)) return srcPktNum; } @@ -473,7 +473,7 @@ { srcPktNum = (source_pktNum) source_PktNum_array.get(i); - if (srcPktNum.getSource() == src) + if (srcPktNum.getSourceID() == src) source_PktNum_array.remove(i); } Modified: trunk/source/gridsim/net/fnb/FnbOutput.java =================================================================== --- trunk/source/gridsim/net/fnb/FnbOutput.java 2008-09-23 11:10:43 UTC (rev 245) +++ trunk/source/gridsim/net/fnb/FnbOutput.java 2008-09-23 11:11:48 UTC (rev 246) @@ -57,8 +57,40 @@ private ArrayList packetsGridletsList_; // list of firstLastPacketsGridlet objects // This list contains the first/last packets belonging to each gridlet - private ArrayList filesname_fileMyIDs_; // keep a list of Fnb_FileName_FileMyID objects + private ArrayList filesname_fileMyIDs_; // keep a list of FileName_FileMyID objects + + ////////////////////////// INTERNAL CLASS ///////////////////////// + + private class FileName_FileMyID + { + // Since files don't have an id until they are registered, we need an id for them. + String filename; + int fileMyID; + + FileName_FileMyID(String f, int fid) + { + filename = f; + fileMyID = fid; + + } + + + String getFileName() + { + return filename; + } + + int getFileId() + { + return fileMyID; + } + } + + + ////////////////////////// INTERNAL CLASS ///////////////////////// + + /** * Allocates a new Output object * @param name the name of this object @@ -581,7 +613,7 @@ glID = ((Gridlet) obj).getGridletID(); // Here we will keep the packets belonging to each gridlet - packGl.setFirst(pktID_); // the first packet of this gridlet + packGl.setFirstPacketID(pktID_); // the first packet of this gridlet packGl.setGridletID(glID); conn = new FnbEndToEndPath(destId, super.get_id(), @@ -594,7 +626,7 @@ // Here we will keep the packets belonging to each gridlet - packGl.setFirst(pktID_); // the first packet of this gridlet + packGl.setFirstPacketID(pktID_); // the first packet of this gridlet packGl.setGridletID(glID); conn = new FnbEndToEndPath(destId, super.get_id(), @@ -638,13 +670,9 @@ }*/ glID = checkFilename(fileName); // get a id for the file + packGl.setFirstPacketID(pktID_); // the first packet of this file + packGl.setFileID(glID); // the name of the file - packGl.setFirst(pktID_); // the first packet of this file - packGl.setGridletID(glID); // the name of the file - - packGl.setIsFile(true); - - conn = new FnbEndToEndPath(destId, super.get_id(), netServiceType, numPackets, glID); //GridSimTags.FNB_PKT_CONTAINS_FILE); @@ -687,7 +715,7 @@ if ((obj instanceof Gridlet) || (obj instanceof DataGridlet) || (obj instanceof Object[])) { - packGl.setLast(pktID_); // the last packet of this gridlet + packGl.setLastPacketID(pktID_); // the last packet of this gridlet packetsGridletsList_.add(packGl); // put this firstLastPacketsGridlet entity into the list @@ -707,11 +735,11 @@ * @return the my_id of the file*/ int checkFilename(String fname) { - Fnb_FileName_FileMyID fname_fid; + FileName_FileMyID fname_fid; int last_fileID = 0; for (int i =0; i< filesname_fileMyIDs_.size(); i++) { - fname_fid = (Fnb_FileName_FileMyID) filesname_fileMyIDs_.get(i); + fname_fid = (FileName_FileMyID) filesname_fileMyIDs_.get(i); last_fileID = fname_fid.getFileId(); @@ -721,7 +749,7 @@ } } - fname_fid = new Fnb_FileName_FileMyID(fname, last_fileID + 1); + fname_fid = new FileName_FileMyID(fname, last_fileID + 1); filesname_fileMyIDs_.add(fname_fid); @@ -734,7 +762,7 @@ * @return the name of the file*/ String getFilename(int fileID) { - Fnb_FileName_FileMyID fname_fid; + FileName_FileMyID fname_fid; int last_fileID = 0; /*System.out.println(super.get_name() + ": getFilename(). fileID " + fileID + @@ -743,7 +771,7 @@ for (int i = 0; i < filesname_fileMyIDs_.size(); i++) { - fname_fid = (Fnb_FileName_FileMyID) filesname_fileMyIDs_.get(i); + fname_fid = (FileName_FileMyID) filesname_fileMyIDs_.get(i); last_fileID = fname_fid.getFileId(); @@ -1028,13 +1056,17 @@ firstLastPacketsGridlet flPktGl = (firstLastPacketsGridlet) packetsGridletsList_.get(i); - if ((flPktGl.getFirst() <= pktID) && (flPktGl.getLast() > pktID)) + if ( (flPktGl.getFirstPacketID() <= pktID) && + (flPktGl.getLastPacketID() > pktID) ) { - if (flPktGl.getIsFile()) - msgDrop = new FnbMessageDropFile(flPktGl.getGridletID() , getFilename(flPktGl.getGridletID())); - else - msgDrop = new FnbMessageDropGridlet(flPktGl.getGridletID()); - + if (flPktGl.isFile() == true) { + msgDrop = new FnbMessageDropFile(flPktGl.getID(), + getFilename(flPktGl.getID()) ); + } + else { + msgDrop = new FnbMessageDropGridlet( flPktGl.getID() ); + } + /***** System.out.println(super.get_name() + ": lookForEntity: entiyID: " + flPktGl.getGridletID() + ". isFile " + flPktGl.getIsFile() + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |