MATSIM
CustomDataManager.java
Go to the documentation of this file.
1 /* *********************************************************************** *
2  * project: org.matsim.*
3  * *
4  * *********************************************************************** *
5  * *
6  * copyright : (C) 2012 by the members listed in the COPYING, *
7  * LICENSE and WARRANTY file. *
8  * email : info at matsim dot org *
9  * *
10  * *********************************************************************** *
11  * *
12  * This program is free software; you can redistribute it and/or modify *
13  * it under the terms of the GNU General Public License as published by *
14  * the Free Software Foundation; either version 2 of the License, or *
15  * (at your option) any later version. *
16  * See also COPYING, LICENSE and WARRANTY file *
17  * *
18  * *********************************************************************** */
19 
20 package org.matsim.pt.router;
21 
22 import java.util.HashMap;
23 
26 
34 public class CustomDataManager {
35 
36  private final HashMap<Node, Object> data = new HashMap<Node, Object>();
37  private Node fromNode = null;
38  private Node toNode = null;
39 
40  private Object tmpToNodeData = null;
41 
42  public void setToNodeCustomData(final Object data) {
43  this.tmpToNodeData = data;
44  }
45 
50  public Object getFromNodeCustomData() {
51  return this.data.get(this.fromNode);
52  }
53 
54  public void initForLink(final Link link) {
55  this.fromNode = link.getFromNode();
56  this.toNode = link.getToNode();
57  this.tmpToNodeData = null;
58  }
59 
60  public void storeTmpData() {
61  if (this.tmpToNodeData != null) {
62  this.data.put(this.toNode, this.tmpToNodeData);
63  }
64  }
65 
66  public void reset() {
67  this.data.clear();
68  this.fromNode = null;
69  this.toNode = null;
70  this.tmpToNodeData = null;
71  }
72 
73 }
final HashMap< Node, Object > data