Codota Logo
Volume
Code IndexAdd Codota to your IDE (free)

How to use
Volume
in
org.matsim.counts

Best Java code snippets using org.matsim.counts.Volume (Showing top 15 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
ArrayList a =
  • Codota Iconnew ArrayList<String>()
  • Codota Iconnew ArrayList()
  • Codota Iconnew ArrayList<Object>()
  • Smart code suggestions by Codota
}
origin: matsim-org/matsim

@Override
public void startVolume(final Volume volume, final BufferedWriter out) throws IOException {
  out.write("\t\t<volume");
  out.write(" h=\"" + volume.getHourOfDayStartingWithOne() + "\"");
  out.write(" val=\"" + volume.getValue() + "\"");
  out.write(" />\n");
}
origin: matsim-org/matsim

/**
 * Creates and adds a {@link Volume} to the {@link Count}ing station.
 * @param h indicating the hour-of-day. <b><i>Note: the hours for a counting 
 *         station must be from 1-24, and <b><i>not</i></b> from 0-23, 
 *         otherwise the {@link MatsimCountsReader} will throw an error.
 *         </i></b>
 * @param val the total number of vehicles counted during hour <code>h</code>.
 * @return the {@link Count}ing station's {@link Volume}.
 */
public final Volume createVolume(final int h, final double val) {
  if ( h < 1 ) {
    throw new RuntimeException( "counts start at 1, not at 0.  If you have a use case where you need to go below one, "
        + "let us know and we think about it, but so far we had numerous debugging sessions because someone inserted counts at 0.") ;
  }
  // overkill?
  Volume v = new Volume(h,val);
  this.volumes.put(Integer.valueOf(h), v);
  return v;
}
origin: matsim-org/matsim

public final Volume getMaxVolume() {
  Volume v_max = null;
  double max = -1.0;
  for (Volume v : this.volumes.values()) {
    if (v.getValue() > max) { max = v.getValue(); v_max = v; }
  }
  return v_max;
}
origin: matsim-org/matsim

  @Override
  public int compare(final Volume v1, final Volume v2) {
    return Double.compare(v1.getHourOfDayStartingWithOne(), v2.getHourOfDayStartingWithOne());
  }
}
origin: matsim-org/matsim

this.content.append(this.CHR_HT);
countValue = volume.getValue();
double simValue = volumes[hour - 1];
origin: matsim-org/matsim

  startTimeOfBin_s = (volume.getHourOfDayStartingWithOne()-1)*3600 ;
  count = 0 ;
count += volume.getValue() ;
if ( ! ( (timeBinIndex%multiple) == (multiple-1) ) ) {
  log.warn( " NOT adding measurement: timeBinIndex: " + timeBinIndex + "; multiple: " + multiple ) ;
  int endTimeOfBin_s   = volume.getHourOfDayStartingWithOne()*3600 - 1 ;
  if ( !( cadytsConfig.getStartTime() <= startTimeOfBin_s && endTimeOfBin_s <= cadytsConfig.getEndTime()) ) {
    log.warn( " NOT adding measurement: cadytsConfigStartTime: " + cadytsConfig.getStartTime() + "; startTimeOfBin_s: " + startTimeOfBin_s +
origin: matsim-org/matsim

for (Volume volume : entry.getValue().getVolumes().values()){
  sum += volume.getValue() ;
origin: matsim-org/matsim

public void testCreateVolume() {
  Count count = new Count(Id.create(0, Link.class), "1");
  Volume volume = count.createVolume(1, 100.0);
  assertTrue("Creation and initialization of volume failed", volume.getHourOfDayStartingWithOne()==1);
  assertTrue("Creation and initialization of volume failed", volume.getValue()==100.0);
}
origin: matsim-org/matsim

/**
 * Creates the List with the counts vs sim values stored in the
 * countAttribute Attribute of this class.
 */
private void compare() {
  for (Count<Link> count : this.counts.getCounts().values()) {
    if (!distanceFilter.isInRange(count)) {
      continue;
    }
    double[] volumes = this.volumesPerLinkPerHour.getVolumesForStop(Id.create(count.getId(), TransitStopFacility.class));
    if (volumes == null || volumes.length == 0) {
      log.warn("No volumes for count location: " + count.getId().toString());
      continue;
    }
    for (int hour = 1; hour <= 24; hour++) {
      Volume volume = count.getVolume(hour);
      if (volume != null) {
        double countValue = volume.getValue();
        double simValue=volumes[hour-1];
        simValue *= this.countsScaleFactor;
        this.result.add(new CountSimComparisonImpl(count.getId(), count.getCsLabel(), hour, countValue, simValue));
      }
    }
  }
}
origin: matsim-org/matsim

while (vol_it.hasNext()) {
  Volume v = vol_it.next();
  Assert.assertTrue(v.getHourOfDayStartingWithOne()>0);
  Assert.assertTrue(v.getValue()>=0.0);
origin: matsim-org/matsim

  public void testGetVolumes() {
    Count count = new Count(Id.create(0, Link.class), "1");
    count.createVolume(1, 100.0);

    Iterator<Volume> vol_it = count.getVolumes().values().iterator();
    while (vol_it.hasNext()) {
      Volume v = vol_it.next();
      assertTrue("Getting volumes failed", v.getValue() == 100.0);
    }

  }
}
origin: matsim-org/matsim

Volume v = count.getVolume(i + 1);
if (v != null) {
  writer.write(v.getValue() + TAB);
} else {
  writer.write("n/a" + TAB);
origin: matsim-org/matsim

public void testGetVolume() {
  Count count = new Count(Id.create(0, Link.class), "1");
  count.createVolume(1, 100.0);
  assertTrue("Getting volume failed", count.getVolume(1).getValue() == 100.0);
}
origin: matsim-org/matsim

  public void testSEVolume() {
    AttributeFactory attributeFactory = new AttributeFactory();
    final Counts counts = new Counts();
    CountsReaderMatsimV1 reader = new CountsReaderMatsimV1(counts);
    reader.startTag("counts", attributeFactory.createCountsAttributes(), null);
    reader.startTag("count", attributeFactory.createCountAttributes(), null);
    reader.startTag("volume", attributeFactory.createVolumeAttributes(), null);

    assertEquals("Volume attribute setting failed", 100.0, counts.getCount(Id.create(1, Link.class)).getVolume(1).getValue(), EPSILON);
  }
}
origin: matsim-org/matsim

  public void testSEElementVolume() throws SAXException {
    AttributeFactory attributeFactory = new AttributeFactory();
    final Counts counts = new Counts();
    MatsimCountsReader reader = new MatsimCountsReader(counts);
    reader.setDoctype("counts_v1.xsd");

    reader.startElement("", "counts", "counts", attributeFactory.createCountsAttributes());
    reader.startElement("", "count", "count", attributeFactory.createCountAttributes());
    reader.startElement("", "volume", "volume", attributeFactory.createVolumeAttributes());

    assertEquals("Volume attribute setting failed", 100.0, counts.getCount(Id.create(1, Link.class)).getVolume(1).getValue(), EPSILON);

    reader.endElement("", "volume", "volume");
    reader.endElement("", "count", "count");
    reader.endElement("", "counts", "counts");
  }
}
org.matsim.countsVolume

Most used methods

  • getHourOfDayStartingWithOne
  • getValue
  • <init>

Popular in Java

  • Start an intent from android
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • setRequestProperty (URLConnection)
    Sets the general request property. If a property with the key already exists, overwrite its value wi
  • scheduleAtFixedRate (Timer)
    Schedules the specified task for repeated fixed-rate execution, beginning after the specified delay.
  • FileWriter (java.io)
    Convenience class for writing character files. The constructors of this class assume that the defaul
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • Comparator (java.util)
    A Comparator is used to compare two objects to determine their ordering with respect to each other.
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • ConcurrentHashMap (java.util.concurrent)
    A hash table supporting full concurrency of retrievals and adjustable expected concurrency for updat
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now