Codota Logo
Household.getId
Code IndexAdd Codota to your IDE (free)

How to use
getId
method
in
org.matsim.households.Household

Best Java code snippets using org.matsim.households.Household.getId (Showing top 6 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
BufferedReader b =
  • Codota IconInputStream in;new BufferedReader(new InputStreamReader(in))
  • Codota IconReader in;new BufferedReader(in)
  • Codota IconFile file;new BufferedReader(new FileReader(file))
  • Smart code suggestions by Codota
}
origin: matsim-org/matsim

/**
 * Adds the household to the container. If streaming is set, the household
 * is added, the algorithms are run on the household, and it is subsequently
 * removed. If not, the household is added incrementally to the container.
 * @param household
 * @throws IllegalArgumentException if the container already includes the 
 *         {@link Id} of the household being added.
 */
public final void addHousehold(final Household household){
  /* Validate that a household with the same Id does not exist yet. */
  if(this.getHouseholds().containsKey(household.getId())){
    throw new IllegalArgumentException("Household with Id " + household.getId() + 
        " already exisits.");
  }
  this.households.put(household.getId(), household);
}

origin: matsim-org/matsim

public void runAlgorithms(Household h){
  for(HouseholdAlgorithm algorithm : this.householdAlgorithms){
    log.info("Running algorithm " + algorithm.getClass().getName() + " on household " + h.getId());
    algorithm.run(h);
  }        
}

origin: matsim-org/matsim

public HouseholdBasedVehicleRessources(
    final Households hhs) {
  this.households = hhs;
  for (Household hh : hhs.getHouseholds().values()) {
    final Id hhId = hh.getId();
    for (Id agentId : hh.getMemberIds()) {
      agent2hh.put( agentId , hhId );
    }
  }
}
origin: matsim-org/matsim

/*package*/ void writeHousehold(Household h) throws UncheckedIOException {
  this.atts.clear();
  atts.add(createTuple(HouseholdsSchemaV10Names.ID, h.getId().toString()));
  this.writeStartTag(HouseholdsSchemaV10Names.HOUSEHOLD, atts);
  if ((h.getMemberIds() != null) && !h.getMemberIds().isEmpty()){
    this.writeMembers(h.getMemberIds());
  }
  if ((h.getVehicleIds() != null) && !h.getVehicleIds().isEmpty()) {
    this.writeStartTag(HouseholdsSchemaV10Names.VEHICLES, null);
    for (Id<Vehicle> id : h.getVehicleIds()){
      atts.clear();
      atts.add(createTuple(HouseholdsSchemaV10Names.REFID, id.toString()));
      this.writeStartTag(HouseholdsSchemaV10Names.VEHICLEDEFINITIONID, atts, true);
    }
    this.writeEndTag(HouseholdsSchemaV10Names.VEHICLES);
  }
  if (h.getIncome() != null){
    this.writeIncome(h.getIncome());
  }
  AttributesXmlWriterDelegate attributesWriter = new AttributesXmlWriterDelegate();
  attributesWriter.putAttributeConverters(this.attributeConverters);
  try {
    this.writer.write(NL);
  } catch (IOException e) {
    e.printStackTrace();
  }
  attributesWriter.writeAttributes( "\t\t" , this.writer , h.getAttributes() );
  this.writeEndTag(HouseholdsSchemaV10Names.HOUSEHOLD);
}
origin: matsim-org/matsim

/**
 * Test that households with the same {@link Id} are not accepted.
 */
public void testAddHousehold_DuplicateId(){
  HouseholdsImpl hhs = new HouseholdsImpl();
  Household hh1 = new HouseholdImpl(Id.create("1", Household.class));
  Household hh2 = new HouseholdImpl(Id.create("1", Household.class));
  
  assertEquals("Shouldn't have a household.", 0, hhs.getHouseholds().size());
  hhs.addHousehold(hh1);
  assertEquals("Didn't add the household.", 1, hhs.getHouseholds().size());
  assertEquals("Should have added the household.", hh1, hhs.getHouseholds().get(hh1.getId()));
  try{
    hhs.addHousehold(hh2);
    fail("Should not have accepted household with similar Id.");
  } catch (IllegalArgumentException e){
  }
}

origin: matsim-org/matsim

Household hh = households.getHouseholds().get(id23);
assertNotNull(hh);
assertEquals(id23, hh.getId());
assertEquals(3, hh.getMemberIds().size());
List<Id<Person>> hhmemberIds = new ArrayList<>();
assertEquals(id24, hh.getId());
assertEquals(2, hh.getMemberIds().size());
assertEquals(pid44, hh.getMemberIds().get(0));
assertEquals(id25, hh.getId());
assertEquals(0, hh.getMemberIds().size());
org.matsim.householdsHouseholdgetId

Popular methods of Household

  • getMemberIds
  • getVehicleIds
  • getAttributes
  • getIncome
    This returns an Income, not a number. The Income type contains a method `getIncomePeriod()'.
  • setIncome

Popular in Java

  • Updating database using SQL prepared statement
  • getSystemService (Context)
  • getContentResolver (Context)
  • onCreateOptionsMenu (Activity)
  • InputStreamReader (java.io)
    An InputStreamReader is a bridge from byte streams to character streams: It reads bytes and decodes
  • Date (java.util)
    A specific moment in time, with millisecond precision. Values typically come from System#currentTime
  • TreeMap (java.util)
    A Red-Black tree based NavigableMap implementation. The map is sorted according to the Comparable of
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • ImageIO (javax.imageio)
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
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