All Downloads are FREE. Search and download functionalities are using the official Maven repository.

edu.kit.ifv.mobitopp.populationsynthesis.FixedDestinations Maven / Gradle / Ivy

Go to download

mobiTopp (http://mobitopp.ifv.kit.edu/) is an agent-based travel demand model developed at the Institute for transport studies at the Karlsruhe Institute of Technology (http://www.ifv.kit.edu/english/index.php). Publications about mobiTopp can be found on the project site (http://mobitopp.ifv.kit.edu/28.php).

The newest version!
package edu.kit.ifv.mobitopp.populationsynthesis;

import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Stream;

import edu.kit.ifv.mobitopp.simulation.ActivityType;
import edu.kit.ifv.mobitopp.simulation.FixedDestination;

public class FixedDestinations {

  private final Map fixedDestinations;

  public FixedDestinations() {
    super();
    fixedDestinations = new LinkedHashMap<>();
  }

  public void add(FixedDestination fixedDestination) {
    this.fixedDestinations.put(fixedDestination.activityType(), fixedDestination);
  }

  public Optional getDestination(ActivityType forActivityType) {
    if (hasDestination(forActivityType)) {
      return Optional.of(fixedDestinations.get(forActivityType));
    }
    return Optional.empty();
  }

  public boolean hasDestination(ActivityType forActivityType) {
    return fixedDestinations.containsKey(forActivityType);
  }

  public Stream stream() {
    return fixedDestinations.values().stream();
  }

  public boolean hasFixedDestination() {
    return hasDestination(ActivityType.WORK) || hasDestination(ActivityType.EDUCATION);
  }

  public Optional getFixedDestination() {
    if (hasDestination(ActivityType.WORK)) {
      return getDestination(ActivityType.WORK);
    } else if (hasDestination(ActivityType.EDUCATION)) {
      return getDestination(ActivityType.EDUCATION);
    }
    return Optional.empty();
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy