@Override
	public boolean hasNext() throws CancelledException {

		if (nextSub != null) {
			return true;
		}

		if (!subList.isEmpty()) {
			nextSub = subList.removeFirst();
			return true;
		}

		// Iterate over each Model-M subroutine
		if (modelMIter.hasNext()) {

			CodeBlock modelMSub = modelMIter.next();
			Address[] entPts = modelMSub.getStartAddresses();

			// Check all Model-O subroutines contained within the Model-M subroutine
			for (int i = 0; i < entPts.length; i++) {

				CodeBlock sub = model.getCodeBlockAt(entPts[i], monitor);
				if (sub == null)
					continue;   // should only happen with screwy code

				if (monitor.isCancelled())
					return false;

				if (addrSet != null) {

					// Keep sub only if it overlaps address set
					if (!sub.intersects(addrSet)) {
						continue;
					}
				}
				subList.add(sub);
			}

			// Check for available subroutine which may have been added to list
			if (!subList.isEmpty()) {
				nextSub = subList.removeFirst();
				return true;
			}
		}
		return false;
	}
@see ghidra.program.model.block.CodeBlockIterator#hasNext()
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/block/SingleEntSubIterator.java