public PetriNet(List<IBlock> blockList) {
		
		System.out.println("Creating Analog Computer Petri Net:");
		blocks = blockList;
		//
		// Number of transitions is the number of blocks:
		//
		numTransitions = blocks.size();
		System.out.println("Number of transitions: " + numTransitions);
    
		//
		// Count number of places:
		//
		int input = 0;
    
		for(int i = 0; i < blocks.size(); i++) {
			input = blocks.get(i).getNumInputs();
			// Sources have value of -1 for number of inputs
			if(input == -1) input = 1;
			numPlaces += input;        
		}       
		System.out.println("Number of places: " + numPlaces);
    
		//
		// Create the vector and matrices:
		//
		markingsVector = new int[numPlaces];
		
		dMinusMatrix = new int[numTransitions][numPlaces];
		dPlusMatrix = new int[numTransitions][numPlaces];
		    
		//
		// Setup a map for index lookup:
		//
		Map<IBlock, Integer> indexLookup = new HashMap<IBlock, Integer>();
		for(int i = 0; i < blocks.size(); i++) {
			indexLookup.put(blocks.get(i), i);
		}
    
		//System.out.println("Filling in PT matrix...");
		//
		// Loop thru each block
		//
		//System.out.println("Looping through " + blocks.size() + " blocks.");
		int placeNum = 0;
		for(int i = 0; i < blocks.size(); i++) {			
			IBlock bloc = blocks.get(i);
			int transition = indexLookup.get(bloc);
			// Handle source blocks
			if(bloc.getNumInputs() == -1) {
				dMinusMatrix[transition][placeNum] = 1;
				markingsVector[placeNum] = 1;
				placeNum++;
				continue;
			}
			
			List<IBlock> in = bloc.getInputList();
			for(int j = 0; j < in.size(); j++) {
				dMinusMatrix[transition][placeNum] = 1;
				int posOne = indexLookup.get(in.get(j));
				dPlusMatrix[posOne][placeNum] = 1;
				if(in.get(j).hasState()) markingsVector[placeNum] = 1;
				placeNum++;
			}        
		}
		
		dMatrix = addMatrices(dPlusMatrix, negateMatrix(copyMatrix(dMinusMatrix)));
	}