MATSIM
AgentSelectorFactory.java
Go to the documentation of this file.
1 /* *********************************************************************** *
2  * project: org.matsim.*
3  * IdentifierFactory.java
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 
21 package org.matsim.withinday.replanning.identifiers.interfaces;
22 
23 import java.util.Collections;
24 import java.util.LinkedHashSet;
25 import java.util.Set;
26 
27 public abstract class AgentSelectorFactory {
28 
29  private final Set<AgentFilterFactory> agentFilterFactories = new LinkedHashSet<AgentFilterFactory>();
30 
31  public abstract AgentSelector createIdentifier();
32 
33  protected final void addAgentFiltersToIdentifier(AgentSelector identifier) {
34  for (AgentFilterFactory agentFilterFactory : agentFilterFactories) {
35  identifier.addAgentFilter(agentFilterFactory.createAgentFilter());
36  }
37  }
38 
39  public final void addAgentFilterFactory(AgentFilterFactory agentFilterFactory) {
40  this.agentFilterFactories.add(agentFilterFactory);
41  }
42 
43  public final boolean removeAgentFilterFactory(AgentFilterFactory agentFilterFactory) {
44  return this.agentFilterFactories.remove(agentFilterFactory);
45  }
46 
47  public final Set<AgentFilterFactory> getAgentFilterFactories() {
48  return Collections.unmodifiableSet(agentFilterFactories);
49  }
50 }
final boolean removeAgentFilterFactory(AgentFilterFactory agentFilterFactory)