SUMO - Simulation of Urban MObility
GNEDestProbReroute.cpp
Go to the documentation of this file.
1 /****************************************************************************/
8 /****************************************************************************/
9 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
10 // Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors
11 /****************************************************************************/
12 //
13 // This file is part of SUMO.
14 // SUMO is free software; you can redistribute it and/or modify
15 // it under the terms of the GNU General Public License as published by
16 // the Free Software Foundation; either version 3 of the License, or
17 // (at your option) any later version.
18 //
19 /****************************************************************************/
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #ifdef _MSC_VER
25 #include <windows_config.h>
26 #else
27 #include <config.h>
28 #endif
29 
30 #include <utils/common/ToString.h>
31 
32 #include "GNEDestProbReroute.h"
33 #include "GNEEdge.h"
34 
35 
36 // ===========================================================================
37 // member method definitions
38 // ===========================================================================
39 
40 GNEDestProbReroute::GNEDestProbReroute(GNERerouterInterval& rerouterIntervalParent, GNEEdge* newEdgeDestination, double probability):
41  myRerouterIntervalParent(&rerouterIntervalParent),
42  myNewEdgeDestination(newEdgeDestination),
43  myProbability(0),
45  // set probability manually to avoid non valid values
46  setProbability(probability);
47 }
48 
49 
51 }
52 
53 
54 GNEEdge*
56  return myNewEdgeDestination;
57 }
58 
59 
60 void
62  myNewEdgeDestination = edge;
63 }
64 
65 
66 double
68  return myProbability;
69 }
70 
71 
72 bool
74  if (probability >= 0 && probability <= 1) {
75  myProbability = probability;
76  return true;
77  } else {
78  return false;
79  }
80 }
81 
82 
85  return myTag;
86 }
87 
88 
92 }
93 
94 
95 bool
96 GNEDestProbReroute::operator==(const GNEDestProbReroute& destProbReroute) const {
97  if ((myRerouterIntervalParent == destProbReroute.myRerouterIntervalParent) &&
98  (myNewEdgeDestination == destProbReroute.myNewEdgeDestination) &&
99  (myProbability == destProbReroute.myProbability)) {
100  return true;
101  } else {
102  return false;
103  }
104 }
105 
106 
107 /****************************************************************************/
const GNERerouterInterval & getRerouterIntervalParent() const
get rerouter interval parent
SumoXMLTag
Numbers representing SUMO-XML - element names.
SumoXMLTag getTag() const
get tag
double myProbability
probability with which a vehicle will use the given edge as destination
SumoXMLTag myTag
XML Tag of destiny probability reroute.
GNEEdge * myNewEdgeDestination
id of new edge destination
bool setProbability(double probability)
set probability, if new probability is valid
GNERerouterInterval * myRerouterIntervalParent
reference to rerouter interval parent
void setNewDestination(GNEEdge *edge)
set edge destination
GNEDestProbReroute(GNERerouterInterval &rerouterIntervalParent, GNEEdge *newEdgeDestination, double probability)
constructor
probability of destiny of a reroute
~GNEDestProbReroute()
destructor
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:57
double getProbability() const
get probability
GNEEdge * getNewDestination() const
get edge destination
bool operator==(const GNEDestProbReroute &destProbReroute) const
overload operator ==