-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Michal Kit
committed
Sep 3, 2014
1 parent
00f162a
commit 117a688
Showing
13 changed files
with
169 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
jdeeco-simulation/src/cz/cuni/mff/d3s/deeco/simulation/matsim/DefaultMATSimExtractor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package cz.cuni.mff.d3s.deeco.simulation.matsim; | ||
|
||
import java.util.Collection; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
import org.matsim.api.core.v01.Id; | ||
import org.matsim.core.mobsim.framework.Mobsim; | ||
|
||
public class DefaultMATSimExtractor implements MATSimExtractor { | ||
|
||
@Override | ||
public Object extractFromMATSim(Collection<JDEECoAgent> agents, | ||
Mobsim mobsim) { | ||
Map<Id, MATSimOutput> map = new HashMap<Id, MATSimOutput>(); | ||
MATSimOutput matSimOutput; | ||
for (JDEECoAgent agent : agents) { | ||
matSimOutput = new MATSimOutput(agent.getCurrentLinkId(), | ||
agent.getState()); | ||
map.put(agent.getId(), matSimOutput); | ||
} | ||
return map; | ||
} | ||
|
||
} |
21 changes: 21 additions & 0 deletions
21
jdeeco-simulation/src/cz/cuni/mff/d3s/deeco/simulation/matsim/DefaultMATSimUpdater.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package cz.cuni.mff.d3s.deeco.simulation.matsim; | ||
|
||
import java.util.Collection; | ||
import java.util.Map; | ||
|
||
public class DefaultMATSimUpdater implements MATSimUpdater { | ||
|
||
@SuppressWarnings("unchecked") | ||
@Override | ||
public void updateJDEECoAgents(Object input, Collection<JDEECoAgent> agents) { | ||
if (input != null && input instanceof Map<?, ?>) { | ||
Map<String, MATSimInput> map = (Map<String, MATSimInput>) input; | ||
for (JDEECoAgent agent: agents) { | ||
if (map.containsKey(agent.getId())) { | ||
agent.setRoute(((MATSimInput) map.get(agent.getId())).route); | ||
} | ||
} | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
jdeeco-simulation/src/cz/cuni/mff/d3s/deeco/simulation/matsim/MATSimExtractor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package cz.cuni.mff.d3s.deeco.simulation.matsim; | ||
|
||
import java.util.Collection; | ||
|
||
import org.matsim.core.mobsim.framework.Mobsim; | ||
|
||
public interface MATSimExtractor { | ||
public Object extractFromMATSim(Collection<JDEECoAgent> agents, Mobsim mobsim); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.