Tabnine Logo
ActivityOptionImpl
Code IndexAdd Tabnine to your IDE (free)

How to use
ActivityOptionImpl
in
org.matsim.facilities

Best Java code snippets using org.matsim.facilities.ActivityOptionImpl (Showing top 12 results out of 315)

origin: matsim-org/matsim

@Override
public ActivityOption createActivityOption(String type) {
  return new ActivityOptionImpl(type);
}
origin: matsim-org/matsim

public void setOpeningTimes(Collection<OpeningTime> times) {
  this.clearOpeningTimes();
  for (OpeningTime t : times) {
    this.addOpeningTime(t);
  }
}
origin: matsim-org/matsim

public void startCapacity(final ActivityOptionImpl activity, final BufferedWriter out) throws IOException {
  if (activity.getCapacity() != Integer.MAX_VALUE) {
    out.write("\t\t\t<capacity");
    out.write(" value=\"" + activity.getCapacity() + "\"");
    out.write(" />\n");
  }
}
origin: matsim-org/matsim

fac1.addActivityOption(new ActivityOptionImpl("home"));
facilities.addActivityFacility(fac1);
ActivityOptionImpl shopOption = new ActivityOptionImpl("shop");
shopOption.addOpeningTime(new OpeningTimeImpl(8*3600, 20*3600));
fac2.addActivityOption(shopOption);
facilities.addActivityFacility(fac2);
origin: matsim-org/matsim

private final void combine(ActivityFacility f,ActivityFacilityImpl f2) {
  System.out.println("      Combining f_id=" + f.getId() + " into f2_id=" + f2.getId());
  Iterator<? extends ActivityOption> a_it = f.getActivityOptions().values().iterator();
  while (a_it.hasNext()) {
    ActivityOptionImpl a = (ActivityOptionImpl) a_it.next();
    if (f2.getActivityOptions().get(a.getType()) == null) {
      ActivityOptionImpl a2 = f2.createAndAddActivityOption(a.getType());
      a2.setCapacity(a.getCapacity());
    }
    else {
      ActivityOptionImpl a2 = (ActivityOptionImpl) f2.getActivityOptions().get(a.getType());
      double cap2 = a2.getCapacity();
      double cap = a.getCapacity();
      if ((cap < Integer.MAX_VALUE) && (cap2 < Integer.MAX_VALUE)) { a2.setCapacity(cap + cap2); }
      else { a2.setCapacity(Integer.MAX_VALUE); }
    }
    SortedSet<OpeningTime> ts = a.getOpeningTimes();
    Iterator<OpeningTime> o_it = ts.iterator();
    while (o_it.hasNext()) {
      OpeningTime o = o_it.next();
      f2.getActivityOptions().get(a.getType()).addOpeningTime(o);
    }
  }
  if (Integer.parseInt(f2.getId().toString()) > Integer.parseInt(f.getId().toString())) {
    System.out.println("      => assigning f_id="+f.getId()+" to f2.");
    throw new RuntimeException("Can't set ids anymore.");
  }
}

origin: matsim-org/matsim

while (a_it.hasNext()) {
  ActivityOptionImpl a = (ActivityOptionImpl) a_it.next();
  if (a.getType().equals("home")) {
    a.setCapacity(this.nof_persons/home_cnt);
    a.addOpeningTime(new OpeningTimeImpl(TIME_0000, TIME_2400));
  else if (a.getType().equals("work")) {
    a.setCapacity(this.nof_persons/work_cnt);
    a.addOpeningTime(new OpeningTimeImpl(TIME_0800, TIME_1800));
  else if (a.getType().equals("education")) {
    a.setCapacity(this.nof_persons/educ_cnt);
    a.addOpeningTime(new OpeningTimeImpl(TIME_0800, TIME_1200));
    a.addOpeningTime(new OpeningTimeImpl(TIME_1300, TIME_1700));
  else if (a.getType().equals("shop")) {
    a.setCapacity(this.nof_persons/shop_cnt);
    a.addOpeningTime(new OpeningTimeImpl(TIME_0830, TIME_1200));
    a.addOpeningTime(new OpeningTimeImpl(TIME_1330, TIME_2000));
    a.addOpeningTime(new OpeningTimeImpl(TIME_0900, TIME_1700));
  else if (a.getType().equals("leisure")) {
    a.setCapacity(this.nof_persons/leis_cnt);
    a.addOpeningTime(new OpeningTimeImpl(TIME_1700, TIME_2400));
    a.addOpeningTime(new OpeningTimeImpl(TIME_2000, TIME_2400));
origin: matsim-org/matsim

ActivityOptionImpl a = (ActivityOptionImpl) a_it.next();
act_cnt++;
if (a.getCapacity() != Integer.MAX_VALUE) {
  if (a.getType().equals("home")) {
    caps[0] += a.getCapacity();
  else if (a.getType().equals("work")) {
    caps[1] += a.getCapacity();
  else if (a.getType().equals("education")) {
    caps[2] += a.getCapacity();
  else if (a.getType().equals("shop")) {
    caps[3] += a.getCapacity();
  else if (a.getType().equals("leisure")) {
    caps[4] += a.getCapacity();
                       " do not know type = " + a.getType());
origin: matsim-org/matsim

@Override
public final String toString() {
  return "[type=" + this.type + "]" +
      "[capacity=" + this.capacity + "]" +
      "[nof_opentimes=" + this.getOpeningTimes().size() + "]";
}
origin: matsim-org/matsim

public void startActivity(final ActivityOptionImpl activity, final BufferedWriter out) throws IOException {
  out.write("\t\t<activity");
  out.write(" type=\"" + activity.getType() + "\"");
  out.write(">\n");
}
origin: matsim-org/matsim

fac1.addActivityOption(new ActivityOptionImpl("home"));
fac1.getAttributes().putAttribute("size_m2", 100);
facilities.addActivityFacility(fac1);
ActivityOptionImpl shopOption = new ActivityOptionImpl("shop");
shopOption.addOpeningTime(new OpeningTimeImpl(8*3600, 20*3600));
fac2.addActivityOption(shopOption);
fac2.getAttributes().putAttribute("size_m2", 500);
origin: matsim-org/matsim

public final ActivityOptionImpl createAndAddActivityOption(final String type) {
  String type2 = type.intern();
  ActivityOptionImpl a = new ActivityOptionImpl(type2);
  addActivityOption(a);
  return a;
}
origin: matsim-org/matsim

public static void combineDifferentActivityOptionTypes(final Scenario scenario, String combinedType, final List<String> activityOptionsToBeIncluded) {
  ActivityOption markerOption = new ActivityOptionImpl(combinedType); 
  
  // Memorize all facilities that have certain activity options in a activity facilities container
  final ActivityFacilities consideredFacilities = FacilitiesUtils.createActivityFacilities();
  for (ActivityFacility facility : scenario.getActivityFacilities().getFacilities().values()) {
    for (ActivityOption option : facility.getActivityOptions().values()) {
      if (activityOptionsToBeIncluded.contains(option.getType())) {
        // if (!option.getType().equals(FacilityTypes.HOME) && !option.getType().equals(FacilityTypes.WORK) && !option.getType().equals("minor")) {
        if (!consideredFacilities.getFacilities().containsKey(facility.getId())) {
          consideredFacilities.addActivityFacility(facility);
        }
      }
    }
  }
  
  // Add  marker option to facilities to be considered
  for (ActivityFacility facility : consideredFacilities.getFacilities().values()) {
    facility.addActivityOption(markerOption);
  }
}

org.matsim.facilitiesActivityOptionImpl

Most used methods

  • <init>
  • addOpeningTime
  • clearOpeningTimes
  • getCapacity
  • getOpeningTimes
  • getType
  • setCapacity

Popular in Java

  • Making http requests using okhttp
  • getApplicationContext (Context)
  • startActivity (Activity)
  • getContentResolver (Context)
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • PhpStorm for WordPress
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now