Skip to content

Commit

Permalink
Use final names for matsim packages
Browse files Browse the repository at this point in the history
- Replaces temporary names
  • Loading branch information
vladamatena committed Apr 10, 2015
1 parent 8232bfb commit a9e6567
Show file tree
Hide file tree
Showing 42 changed files with 92 additions and 94 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cz.cuni.mff.d3s.jdeeco.matsim.old.roadtrains;
package cz.cuni.mff.d3s.jdeeco.matsim.dataaccess;

public interface Actuator<T> {
public void set(T value);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cz.cuni.mff.d3s.jdeeco.matsim.old.roadtrains;
package cz.cuni.mff.d3s.jdeeco.matsim.dataaccess;

import java.util.Map;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package cz.cuni.mff.d3s.jdeeco.matsim.dataaccess;

public enum ActuatorType {
ROUTE,
SPEED;
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cz.cuni.mff.d3s.jdeeco.matsim.old.roadtrains;
package cz.cuni.mff.d3s.jdeeco.matsim.dataaccess;

import java.util.HashMap;
import java.util.LinkedList;
Expand All @@ -8,37 +8,34 @@
import org.matsim.api.core.v01.Id;
import org.matsim.core.basic.v01.IdImpl;

import cz.cuni.mff.d3s.jdeeco.matsim.old.simulation.MATSimDataProvider;
import cz.cuni.mff.d3s.jdeeco.matsim.old.simulation.MATSimDataReceiver;
import cz.cuni.mff.d3s.jdeeco.matsim.old.simulation.MATSimInput;
import cz.cuni.mff.d3s.jdeeco.matsim.old.simulation.MATSimOutput;


public class MATSimDataProviderReceiver implements MATSimDataReceiver,
MATSimDataProvider {
import cz.cuni.mff.d3s.jdeeco.matsim.simulation.MATSimDataProvider;
import cz.cuni.mff.d3s.jdeeco.matsim.simulation.MATSimDataReceiver;
import cz.cuni.mff.d3s.jdeeco.matsim.simulation.MATSimInput;
import cz.cuni.mff.d3s.jdeeco.matsim.simulation.MATSimOutput;

public class MATSimDataProviderReceiver implements MATSimDataReceiver, MATSimDataProvider {
// This is coming from MATSim (i.e. its output) = sensors
protected final Map<Id, MATSimOutput> outputs;

// This is going to MATSim (i.e. its input) = actuators
protected final Map<Id, MATSimInput> inputs;

protected final Map<Id, List<Id>> parked;

public MATSimDataProviderReceiver(List<String> linksToDisable) {
this.outputs = new HashMap<Id, MATSimOutput>();
this.inputs = new HashMap<Id, MATSimInput>();
this.parked = new HashMap<Id, List<Id>>();

List<Id> parkedVehicles;
Id parkedVehicle = new IdImpl(-1);
for (String linkToDisable: linksToDisable) {
for (String linkToDisable : linksToDisable) {
parkedVehicles = new LinkedList<Id>();
parkedVehicles.add(parkedVehicle);
parked.put(new IdImpl(linkToDisable), parkedVehicles);
}
}

// Here we return next links ids for MATSim agents
public Map<Id, MATSimInput> getMATSimData() {
Map<Id, MATSimInput> result = new HashMap<Id, MATSimInput>();
Expand All @@ -59,13 +56,13 @@ public ActuatorProvider getActuatorProvider(final Id ownerId) {
return new ActuatorProvider() {

private final Map<ActuatorType, Actuator<?>> actuators = new HashMap<ActuatorType, Actuator<?>>();

public <T> Actuator<T> createActuator(ActuatorType type) {
Actuator<T> actuator = (Actuator<T>) getActuatorInternal(ownerId, type, this);
actuators.put(type, actuator);
return actuator;
}

public Map<ActuatorType, Actuator<?>> getActuators() {
return actuators;
}
Expand All @@ -76,7 +73,7 @@ public SensorProvider getSensorProvider(final Id ownerId) {
return new SensorProvider() {

private final Map<SensorType, Sensor<?>> sensors = new HashMap<SensorType, Sensor<?>>();

public <T> Sensor<T> createSensor(SensorType type) {
Sensor<T> sensor = (Sensor<T>) getSensorInternal(ownerId, type);
sensors.put(type, sensor);
Expand All @@ -89,8 +86,7 @@ public Map<SensorType, Sensor<?>> getSensors() {
};
}

private Sensor<?> getSensorInternal(final Id requesterId,
SensorType sensorType) {
private Sensor<?> getSensorInternal(final Id requesterId, SensorType sensorType) {
if (sensorType == SensorType.CURRENT_LINK) {
return new Sensor<Id>() {

Expand Down Expand Up @@ -141,8 +137,8 @@ public Integer read() {
return null;
}

private Actuator<?> getActuatorInternal(final Id requesterId,
ActuatorType actuatorType, final ActuatorProvider provider) {
private Actuator<?> getActuatorInternal(final Id requesterId, ActuatorType actuatorType,
final ActuatorProvider provider) {
final MATSimInput mData;
if (inputs.containsKey(requesterId)) {
mData = inputs.get(requesterId);
Expand All @@ -168,6 +164,7 @@ public void set(List<Id> value) {
}
}
}

public ActuatorType getActuatorType() {
return ActuatorType.ROUTE;
}
Expand All @@ -188,5 +185,4 @@ public ActuatorType getActuatorType() {
}
return null;
}

}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cz.cuni.mff.d3s.jdeeco.matsim.old.roadtrains;
package cz.cuni.mff.d3s.jdeeco.matsim.dataaccess;

public interface Sensor<T> {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cz.cuni.mff.d3s.jdeeco.matsim.old.roadtrains;
package cz.cuni.mff.d3s.jdeeco.matsim.dataaccess;

import java.util.Map;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cz.cuni.mff.d3s.jdeeco.matsim.old.roadtrains;
package cz.cuni.mff.d3s.jdeeco.matsim.dataaccess;

public enum SensorType {
CURRENT_LINK, IS_PARKED, ROUTE, CURRENT_LINK_FREE_PLACES
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/**
* Classes responsible for sensors and actuators provided by MATSim
*
* Ported sources from jDEECo 2
*/
package cz.cuni.mff.d3s.jdeeco.matsim.dataaccess;

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cz.cuni.mff.d3s.jdeeco.matsim;
package cz.cuni.mff.d3s.jdeeco.matsim.plugin;

import java.io.File;
import java.io.FileWriter;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cz.cuni.mff.d3s.jdeeco.matsim;
package cz.cuni.mff.d3s.jdeeco.matsim.plugin;

import java.io.File;
import java.io.IOException;
Expand Down Expand Up @@ -29,20 +29,20 @@
import cz.cuni.mff.d3s.deeco.timer.CurrentTimeProvider;
import cz.cuni.mff.d3s.deeco.timer.SimulationTimer;
import cz.cuni.mff.d3s.deeco.timer.TimerEventListener;
import cz.cuni.mff.d3s.jdeeco.matsim.old.roadtrains.MATSimDataProviderReceiver;
import cz.cuni.mff.d3s.jdeeco.matsim.old.simulation.AdditionAwareAgentSource;
import cz.cuni.mff.d3s.jdeeco.matsim.old.simulation.DefaultMATSimExtractor;
import cz.cuni.mff.d3s.jdeeco.matsim.old.simulation.DefaultMATSimUpdater;
import cz.cuni.mff.d3s.jdeeco.matsim.old.simulation.JDEECoAgent;
import cz.cuni.mff.d3s.jdeeco.matsim.old.simulation.JDEECoAgentSource;
import cz.cuni.mff.d3s.jdeeco.matsim.old.simulation.JDEECoMobsimFactory;
import cz.cuni.mff.d3s.jdeeco.matsim.old.simulation.JDEECoWithinDayMobsimListener;
import cz.cuni.mff.d3s.jdeeco.matsim.old.simulation.MATSimDataProvider;
import cz.cuni.mff.d3s.jdeeco.matsim.old.simulation.MATSimDataReceiver;
import cz.cuni.mff.d3s.jdeeco.matsim.old.simulation.MATSimExtractor;
import cz.cuni.mff.d3s.jdeeco.matsim.old.simulation.MATSimPreloadingControler;
import cz.cuni.mff.d3s.jdeeco.matsim.old.simulation.MATSimRouter;
import cz.cuni.mff.d3s.jdeeco.matsim.old.simulation.MATSimSimulationStepListener;
import cz.cuni.mff.d3s.jdeeco.matsim.dataaccess.MATSimDataProviderReceiver;
import cz.cuni.mff.d3s.jdeeco.matsim.simulation.AdditionAwareAgentSource;
import cz.cuni.mff.d3s.jdeeco.matsim.simulation.DefaultMATSimExtractor;
import cz.cuni.mff.d3s.jdeeco.matsim.simulation.DefaultMATSimUpdater;
import cz.cuni.mff.d3s.jdeeco.matsim.simulation.JDEECoAgent;
import cz.cuni.mff.d3s.jdeeco.matsim.simulation.JDEECoAgentSource;
import cz.cuni.mff.d3s.jdeeco.matsim.simulation.JDEECoMobsimFactory;
import cz.cuni.mff.d3s.jdeeco.matsim.simulation.JDEECoWithinDayMobsimListener;
import cz.cuni.mff.d3s.jdeeco.matsim.simulation.MATSimDataProvider;
import cz.cuni.mff.d3s.jdeeco.matsim.simulation.MATSimDataReceiver;
import cz.cuni.mff.d3s.jdeeco.matsim.simulation.MATSimExtractor;
import cz.cuni.mff.d3s.jdeeco.matsim.simulation.MATSimPreloadingControler;
import cz.cuni.mff.d3s.jdeeco.matsim.simulation.MATSimRouter;
import cz.cuni.mff.d3s.jdeeco.matsim.simulation.MATSimSimulationStepListener;

/**
* Plug-in providing MATSim simulation
Expand Down Expand Up @@ -275,7 +275,7 @@ private long secondsToMilliseconds(double seconds) {
return (long) (seconds * 1000);
}

private void addHost(String id, cz.cuni.mff.d3s.jdeeco.matsim.MATSimSimulation.Host host) {
private void addHost(String id, cz.cuni.mff.d3s.jdeeco.matsim.plugin.MATSimSimulation.Host host) {
hosts.put(id, host);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cz.cuni.mff.d3s.jdeeco.matsim;
package cz.cuni.mff.d3s.jdeeco.matsim.plugin;

import java.util.Arrays;
import java.util.List;
Expand All @@ -9,8 +9,8 @@

import cz.cuni.mff.d3s.deeco.runtime.DEECoContainer;
import cz.cuni.mff.d3s.deeco.runtime.DEECoPlugin;
import cz.cuni.mff.d3s.jdeeco.matsim.old.roadtrains.ActuatorProvider;
import cz.cuni.mff.d3s.jdeeco.matsim.old.roadtrains.SensorProvider;
import cz.cuni.mff.d3s.jdeeco.matsim.dataaccess.ActuatorProvider;
import cz.cuni.mff.d3s.jdeeco.matsim.dataaccess.SensorProvider;

/**
* jDEECo plug-in that provides MATSim vehicle agent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
* @author Vladimir Matena <matena@d3s.mff.cuni.cz>
*
*/
package cz.cuni.mff.d3s.jdeeco.matsim;
package cz.cuni.mff.d3s.jdeeco.matsim.plugin;
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cz.cuni.mff.d3s.jdeeco.matsim.old.simulation;
package cz.cuni.mff.d3s.jdeeco.matsim.simulation;

import org.matsim.core.mobsim.framework.AgentSource;
import org.matsim.core.mobsim.qsim.QSim;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cz.cuni.mff.d3s.jdeeco.matsim.old.simulation;
package cz.cuni.mff.d3s.jdeeco.matsim.simulation;

public interface CallbackProvider {
public void callAt(long absoluteTime, String hostId);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cz.cuni.mff.d3s.jdeeco.matsim.old.simulation;
package cz.cuni.mff.d3s.jdeeco.matsim.simulation;

import cz.cuni.mff.d3s.deeco.network.AbstractHost;
import cz.cuni.mff.d3s.deeco.network.DataReceiver;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cz.cuni.mff.d3s.jdeeco.matsim.old.simulation;
package cz.cuni.mff.d3s.jdeeco.matsim.simulation;

import java.util.Collection;
import java.util.HashMap;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cz.cuni.mff.d3s.jdeeco.matsim.old.simulation;
package cz.cuni.mff.d3s.jdeeco.matsim.simulation;

import java.util.Collection;
import java.util.Map;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cz.cuni.mff.d3s.jdeeco.matsim.old.simulation;
package cz.cuni.mff.d3s.jdeeco.matsim.simulation;

import java.util.LinkedList;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cz.cuni.mff.d3s.jdeeco.matsim.old.simulation;
package cz.cuni.mff.d3s.jdeeco.matsim.simulation;

import java.util.Collection;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cz.cuni.mff.d3s.jdeeco.matsim.old.simulation;
package cz.cuni.mff.d3s.jdeeco.matsim.simulation;

import java.util.Collection;
import java.util.LinkedList;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cz.cuni.mff.d3s.jdeeco.matsim.old.simulation;
package cz.cuni.mff.d3s.jdeeco.matsim.simulation;

import java.util.Collection;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cz.cuni.mff.d3s.jdeeco.matsim.old.simulation;
package cz.cuni.mff.d3s.jdeeco.matsim.simulation;

import java.util.Collection;
import java.util.LinkedList;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cz.cuni.mff.d3s.jdeeco.matsim.old.simulation;
package cz.cuni.mff.d3s.jdeeco.matsim.simulation;

import java.util.Map;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cz.cuni.mff.d3s.jdeeco.matsim.old.simulation;
package cz.cuni.mff.d3s.jdeeco.matsim.simulation;


/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cz.cuni.mff.d3s.jdeeco.matsim.old.simulation;
package cz.cuni.mff.d3s.jdeeco.matsim.simulation;

import java.util.Collection;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cz.cuni.mff.d3s.jdeeco.matsim.old.simulation;
package cz.cuni.mff.d3s.jdeeco.matsim.simulation;

import java.util.LinkedList;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cz.cuni.mff.d3s.jdeeco.matsim.old.simulation;
package cz.cuni.mff.d3s.jdeeco.matsim.simulation;

import org.matsim.api.core.v01.Coord;
import org.matsim.api.core.v01.network.Network;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cz.cuni.mff.d3s.jdeeco.matsim.old.simulation;
package cz.cuni.mff.d3s.jdeeco.matsim.simulation;

import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cz.cuni.mff.d3s.jdeeco.matsim.old.simulation;
package cz.cuni.mff.d3s.jdeeco.matsim.simulation;

import java.util.Collection;
import java.util.HashMap;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cz.cuni.mff.d3s.jdeeco.matsim.old.simulation;
package cz.cuni.mff.d3s.jdeeco.matsim.simulation;

import org.matsim.core.controler.Controler;
import org.matsim.core.scenario.ScenarioImpl;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cz.cuni.mff.d3s.jdeeco.matsim.old.simulation;
package cz.cuni.mff.d3s.jdeeco.matsim.simulation;

import java.util.Collection;
import java.util.LinkedList;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cz.cuni.mff.d3s.jdeeco.matsim.old.simulation;
package cz.cuni.mff.d3s.jdeeco.matsim.simulation;

import org.matsim.core.mobsim.framework.Mobsim;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cz.cuni.mff.d3s.jdeeco.matsim.old.simulation;
package cz.cuni.mff.d3s.jdeeco.matsim.simulation;

import java.util.Collection;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cz.cuni.mff.d3s.jdeeco.matsim.old.simulation;
package cz.cuni.mff.d3s.jdeeco.matsim.simulation;

import cz.cuni.mff.d3s.deeco.timer.CurrentTimeProvider;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
*
*/
package cz.cuni.mff.d3s.jdeeco.matsim.old.simulation;
package cz.cuni.mff.d3s.jdeeco.matsim.simulation;


/**
Expand Down
Loading

0 comments on commit a9e6567

Please sign in to comment.