MATSIM
AgentCounter.java
Go to the documentation of this file.
1 /* *********************************************************************** *
2  * project: org.matsim.*
3  * AgentCounter
4  * *
5  * *********************************************************************** *
6  * *
7  * copyright : (C) 2010 by the members listed in the COPYING, *
8  * LICENSE and WARRANTY file. *
9  * email : info at matsim dot org *
10  * *
11  * *********************************************************************** *
12  * *
13  * This program is free software; you can redistribute it and/or modify *
14  * it under the terms of the GNU General Public License as published by *
15  * the Free Software Foundation; either version 2 of the License, or *
16  * (at your option) any later version. *
17  * See also COPYING, LICENSE and WARRANTY file *
18  * *
19  * *********************************************************************** */
20 package org.matsim.core.mobsim.qsim;
21 
22 import java.util.concurrent.atomic.AtomicInteger;
23 
24 
32 class AgentCounter implements org.matsim.core.mobsim.qsim.interfaces.AgentCounter {
33 
37  private final AtomicInteger living = new AtomicInteger(0);
38 
42  private final AtomicInteger lost = new AtomicInteger(0);
43 
44  @Override
45  public final int getLiving() {return living.get(); }
46 
47  @Override
48  public final boolean isLiving() {return living.get() > 0; }
49 
50  @Override
51  public final int getLost() {return lost.get(); }
52 
53  @Override
54  public final void incLost() {lost.incrementAndGet(); }
55 
56  final void incLiving() {living.incrementAndGet();}
57 
58  @Override
59  public final void decLiving() {living.decrementAndGet();}
60 
61 }