simulator_lib
Class SimulatorUtils

java.lang.Object
  extended by simulator_lib.SimulatorUtils

public class SimulatorUtils
extends java.lang.Object

The SimulatorUtils class assists the TraceSimulator driver. Its work most pertains to the queuing and commitment of transactions (actually transferring files and deciding feedbacks).


Constructor Summary
SimulatorUtils()
           
 
Method Summary
private  void commitFBack(Network nw, Transaction trans)
          Commit feedback upon transaction completion.
private  void commitFile(Network nw, Transaction trans)
          Transfer a file between two users.
 void commitRemaining(Network nw, int cycle, TrustAlg ALG)
          Commit all remaining transactions in a Network delay queue.
 void simTrans(Network nw, int cyc, Transaction trans, SimulatorMalicious mal, TrustAlg ALG)
          Simulate a transaction on a network.
private  Transaction transactionCommit(Network nw, int cycle, TrustAlg ALG)
          If ready (complete), commit the Transaction atop the delay queue.
private  void transactionQueue(Network nw, int cycle, Transaction trans, SimulatorMalicious mal, TrustAlg ALG)
          Begin a transaction between parties, queuing it for later commitment.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimulatorUtils

public SimulatorUtils()
Method Detail

simTrans

public void simTrans(Network nw,
                     int cyc,
                     Transaction trans,
                     SimulatorMalicious mal,
                     TrustAlg ALG)
Simulate a transaction on a network.

Parameters:
nw - Network in which the transaction should be simulated
cyc - The current cycle
trans - The Transaction to be simulated
mal - Object coordinating malicious user activity
ALG - Trust algorithm instance managing Network 'nw'

commitRemaining

public void commitRemaining(Network nw,
                            int cycle,
                            TrustAlg ALG)
Commit all remaining transactions in a Network delay queue.

Parameters:
nw - The Network with outstanding (queued) transactions
cycle - Cycle from which to begin commitments
ALG - Trust algorithm instance managing Network 'nw'

transactionCommit

private Transaction transactionCommit(Network nw,
                                      int cycle,
                                      TrustAlg ALG)
If ready (complete), commit the Transaction atop the delay queue.

Parameters:
nw - Network whose queued Transaction will commit (if ready)
cycle - The current cycle
ALG - Trust algorithm instance managing Network 'nw'
Returns:
The committed transaction, or NULL if none was committed

commitFile

private void commitFile(Network nw,
                        Transaction trans)
Transfer a file between two users.

Parameters:
nw - Network in which the transfer should take place
trans - Transaction detailing parties/parameters of transfer

commitFBack

private void commitFBack(Network nw,
                         Transaction trans)
Commit feedback upon transaction completion.

Parameters:
nw - Network in which feedback should be made
trans - Transaction detailing parties/parameters of feedback

transactionQueue

private void transactionQueue(Network nw,
                              int cycle,
                              Transaction trans,
                              SimulatorMalicious mal,
                              TrustAlg ALG)
Begin a transaction between parties, queuing it for later commitment.

Parameters:
nw - Network in which the transaction will take place
cycle - The current cycle
trans - Transaction detailing parties/parameters of transaction
mal - Object coordinating malicious user activity
ALG - Trust algorithm instance managing Network 'nw'