/** * The FundConstants interface is a container for constants * that are shared by all classes. Any class that needs * unqualified access to these names implements the interface */ interface FundConstants { static final int noOfStocks = 3; static final int noOfManagers = 150; static final int testDuration = 20; static final int randomTransfers = 1000; static final int initialBalance = 10000; static final int totalMoneyInUniverse = noOfStocks * initialBalance; } /** * Data class representing a desired stock transfer */ class Transfer implements FundConstants { final public int fundFrom; final public int fundTo; final public int amount; public Transfer() { fundFrom = (int)(Math.random() * noOfStocks); fundTo = (int)(Math.random() * noOfStocks); amount = (int)(Math.random() * 1000); } } /** * Contains the current value of each stock, plus methods to * transfer between stocks and verify that the total value is * correct. */ class Stocks implements FundConstants { static int[] balances = new int[noOfStocks]; static { for (int n=0; n