Simulator/src/simulation/simulation/Simulator.java
/**
	 * Perform a step in the simulation.
	 * 
	 * @return The time it took to perform the step.
	 */
Perform a step in the simulation.

@return The time it took to perform the step.
Perform a step in the simulation . @return The time it took to perform the step .
public long step() {
		long startTime = System.currentTimeMillis();
		List<? extends Agent> agents = agentGenerator.generateAgent(numberOfSteps, timeStep, false);
		if (agents != null) {
			for (Agent a : agents)
				add(a);
		}
		for (DirectlyUpdatable d : map.getMapComponents(DirectlyUpdatable.class))
			d.update(timeStep);
		List<Agent> toBeRemoved = new ArrayList<>();
		for (Agent a : map.getMapComponents(Agent.class)) {
			if (a.wantsToBeDestoryed())
				toBeRemoved.add(a);
		}
		analytics.update(timeStep);
		numberOfSteps++;
		map.updateTime(timeStep);
		if (!logger.equals(Logger.NO_LOGGER))
			logger.update(numberOfSteps * timeStep, false);
		removeAll(toBeRemoved);
		if (gui != null)
			gui.update();
		return System.currentTimeMillis() - startTime;
	}
public long step ( ) { long startTime = System . currentTimeMillis ( ) ; List < ? extends Agent > agents = agentGenerator . generateAgent ( numberOfSteps , timeStep , false ) ; if ( agents != null ) { for ( Agent a : agents ) add ( a ) ; } for ( DirectlyUpdatable d : map . getMapComponents ( DirectlyUpdatable . class ) ) d . update ( timeStep ) ; List < Agent > toBeRemoved = new ArrayList < > ( ) ; for ( Agent a : map . getMapComponents ( Agent . class ) ) { if ( a . wantsToBeDestoryed ( ) ) toBeRemoved . add ( a ) ; } analytics . update ( timeStep ) ; numberOfSteps ++ ; map . updateTime ( timeStep ) ; if ( ! logger . equals ( Logger . NO_LOGGER ) ) logger . update ( numberOfSteps * timeStep , false ) ; removeAll ( toBeRemoved ) ; if ( gui != null ) gui . update ( ) ; return System . currentTimeMillis ( ) - startTime ; }
Perform a step in the simulation.
Perform a step in the simulation .
// keep track of the time the step takes // add agents // update all directly updatable items // actual functionality // update the simulation step // update the log // remove agents that want to leave // GUI update if necessary // return the time the step took