MATSIM
Public Member Functions | Static Private Attributes | List of all members
org.matsim.households.HouseholdIncomeComparator Class Reference
Inheritance diagram for org.matsim.households.HouseholdIncomeComparator:
Inheritance graph
[legend]

Public Member Functions

int compare (Household o1, Household o2)
 

Static Private Attributes

static final long serialVersionUID = 1L
 

Detailed Description

Simple comparator for households to compare them by income

Author
dgrether

Definition at line 31 of file HouseholdIncomeComparator.java.

Member Function Documentation

◆ compare()

int org.matsim.households.HouseholdIncomeComparator.compare ( Household  o1,
Household  o2 
)

Definition at line 36 of file HouseholdIncomeComparator.java.

References org.matsim.households.Income.getIncome(), org.matsim.households.Household.getIncome(), and org.matsim.households.Income.getIncomePeriod().

36  {
37  if (o1.getIncome().getIncomePeriod() != o2.getIncome().getIncomePeriod()){
38  throw new IllegalArgumentException("Can only compare Households with incomes in "
39  + " same income period");
40  }
41  if (o1.getIncome().getIncome() < o2.getIncome().getIncome()){
42  return -1;
43  }
44  else if (o1.getIncome().getIncome() > o2.getIncome().getIncome()){
45  return 1;
46  }
47  return 0;
48  }
Here is the call graph for this function:

Member Data Documentation

◆ serialVersionUID

final long org.matsim.households.HouseholdIncomeComparator.serialVersionUID = 1L
staticprivate

Definition at line 33 of file HouseholdIncomeComparator.java.


The documentation for this class was generated from the following file: