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

Public Member Functions

 ReplanningEvent (final double time, final Id< Person > personId, final String replannerType)
 
Map< String, String > getAttributes ()
 
String getReplannerType ()
 
String getEventType ()
 
Id< PersongetPersonId ()
 
final double getTime ()
 
void setTime (double time)
 
String toString ()
 
boolean equals (Object obj)
 
int hashCode ()
 
void writeAsXML (StringBuilder out)
 

Static Public Attributes

static final String EVENT_TYPE = "replanning"
 
static final String ATTRIBUTE_REPLANNERTYPE = "replanner"
 
static final String ATTRIBUTE_PERSON = "person"
 
static final String ATTRIBUTE_TIME = "time"
 
static final String ATTRIBUTE_TYPE = "type"
 
static final String ATTRIBUTE_X = "x"
 
static final String ATTRIBUTE_Y = "y"
 

Protected Member Functions

final void writeXMLStart (StringBuilder out)
 
final void writeXMLEnd (StringBuilder out)
 

Private Attributes

final Id< PersonpersonId
 
final String replannerType
 

Detailed Description

Author
cdobler

Definition at line 32 of file ReplanningEvent.java.

Constructor & Destructor Documentation

◆ ReplanningEvent()

org.matsim.withinday.events.ReplanningEvent.ReplanningEvent ( final double  time,
final Id< Person personId,
final String  replannerType 
)

Member Function Documentation

◆ getAttributes()

Map<String, String> org.matsim.withinday.events.ReplanningEvent.getAttributes ( )

Definition at line 50 of file ReplanningEvent.java.

50  {
51  Map<String, String> attr = super.getAttributes();
52 
53  attr.put(ATTRIBUTE_PERSON, this.personId.toString());
54  attr.put(ATTRIBUTE_REPLANNERTYPE, this.replannerType);
55 
56  return attr;
57  }

◆ getReplannerType()

String org.matsim.withinday.events.ReplanningEvent.getReplannerType ( )

Definition at line 59 of file ReplanningEvent.java.

References org.matsim.withinday.events.ReplanningEvent.replannerType.

59  {
60  return this.replannerType;
61  }

◆ getEventType()

String org.matsim.withinday.events.ReplanningEvent.getEventType ( )

Definition at line 64 of file ReplanningEvent.java.

References org.matsim.withinday.events.ReplanningEvent.EVENT_TYPE.

64  {
65  return EVENT_TYPE;
66  }

◆ getPersonId()

Id<Person> org.matsim.withinday.events.ReplanningEvent.getPersonId ( )

◆ getTime()

final double org.matsim.api.core.v01.events.Event.getTime ( )
inherited

◆ setTime()

void org.matsim.api.core.v01.events.Event.setTime ( double  time)
inherited

Definition at line 78 of file Event.java.

References org.matsim.api.core.v01.events.Event.time.

78  {
79  this.time = time;
80  }

◆ toString()

String org.matsim.api.core.v01.events.Event.toString ( )
inherited

Definition at line 82 of file Event.java.

References org.matsim.api.core.v01.events.Event.getAttributes().

Referenced by org.matsim.api.core.v01.events.TransitDriverStartsEvent.getAttributes(), and org.matsim.api.core.v01.events.TransitDriverStartsEvent.writeAsXML().

82  {
83  Map<String,String> attr = this.getAttributes() ;
84  StringBuilder eventXML = new StringBuilder("\t<event ");
85  for (Map.Entry<String, String> entry : attr.entrySet()) {
86  eventXML.append(entry.getKey());
87  eventXML.append("=\"");
88  eventXML.append(entry.getValue());
89  eventXML.append("\" ");
90  }
91  eventXML.append(" />");
92  return eventXML.toString();
93  }
Map< String, String > getAttributes()
Definition: Event.java:44
Here is the call graph for this function:

◆ equals()

boolean org.matsim.api.core.v01.events.Event.equals ( Object  obj)
inherited

Definition at line 96 of file Event.java.

References org.matsim.api.core.v01.events.Event.Event(), org.matsim.api.core.v01.events.Event.getAttributes(), org.matsim.api.core.v01.events.Event.getEventType(), and org.matsim.api.core.v01.events.Event.time.

96  {
97  if (!(obj instanceof Event)) {
98  return false;
99  } else {
100  Event other = (Event) obj;
101  return time == other.time &&
102  getEventType().equals(other.getEventType()) &&
103  getAttributes().equals(other.getAttributes());
104  }
105  }
Map< String, String > getAttributes()
Definition: Event.java:44
Here is the call graph for this function:

◆ hashCode()

int org.matsim.api.core.v01.events.Event.hashCode ( )
inherited

Definition at line 108 of file Event.java.

References org.matsim.api.core.v01.events.Event.getAttributes().

108  {
109  return getAttributes().hashCode(); // Two equal events must at least have the same attributes, so they will get the same hashCode like this.
110  }
Map< String, String > getAttributes()
Definition: Event.java:44
Here is the call graph for this function:

◆ writeXMLStart()

final void org.matsim.api.core.v01.events.Event.writeXMLStart ( StringBuilder  out)
protectedinherited

Write the start of the xml representation and some common attributes. This method should be called first by writeAsXML(StringBuilder).

Definition at line 116 of file Event.java.

References org.matsim.api.core.v01.BasicLocation.getCoord(), org.matsim.api.core.v01.events.Event.getEventType(), org.matsim.api.core.v01.events.HasFacilityId.getFacilityId(), org.matsim.api.core.v01.events.HasLinkId.getLinkId(), org.matsim.api.core.v01.events.HasPersonId.getPersonId(), and org.matsim.api.core.v01.events.HasVehicleId.getVehicleId().

Referenced by org.matsim.api.core.v01.events.VehicleAbortsEvent.writeAsXML(), org.matsim.api.core.v01.events.PersonEntersVehicleEvent.writeAsXML(), org.matsim.api.core.v01.events.PersonLeavesVehicleEvent.writeAsXML(), org.matsim.api.core.v01.events.PersonStuckAndContinueEvent.writeAsXML(), org.matsim.api.core.v01.events.PersonArrivalEvent.writeAsXML(), org.matsim.api.core.v01.events.LinkEnterEvent.writeAsXML(), org.matsim.api.core.v01.events.LinkLeaveEvent.writeAsXML(), org.matsim.api.core.v01.events.PersonScoreEvent.writeAsXML(), org.matsim.api.core.v01.events.PersonDepartureEvent.writeAsXML(), org.matsim.api.core.v01.events.PersonStuckEvent.writeAsXML(), org.matsim.api.core.v01.events.TransitDriverStartsEvent.writeAsXML(), org.matsim.api.core.v01.events.ActivityEndEvent.writeAsXML(), org.matsim.api.core.v01.events.ActivityStartEvent.writeAsXML(), and org.matsim.api.core.v01.events.PersonMoneyEvent.writeAsXML().

116  {
117  out.append("\t<event time=\"").append(time).append("\" type=\"");
118  writeEncodedAttributeValue(out, getEventType()).append("\" ");
119 
120  if (this instanceof HasPersonId hasPersonId && hasPersonId.getPersonId() != null) {
121  out.append("person=\"");
122  writeEncodedAttributeValue(out, hasPersonId.getPersonId().toString()).append("\" ");
123  }
124 
125  if (this instanceof HasFacilityId hasFacilityId && hasFacilityId.getFacilityId() != null) {
126  out.append("facility=\"");
127  writeEncodedAttributeValue(out, hasFacilityId.getFacilityId().toString()).append("\" ");
128  }
129 
130  if (this instanceof HasLinkId hasLinkId && hasLinkId.getLinkId() != null) {
131  out.append("link=\"");
132  writeEncodedAttributeValue(out, hasLinkId.getLinkId().toString()).append("\" ");
133  }
134 
135  if (this instanceof BasicLocation basicLocation && basicLocation.getCoord() != null) {
136  if (basicLocation.getCoord() != null) {
137  out.append("x=\"").append(basicLocation.getCoord().getX()).append("\" ");
138  out.append("y=\"").append(basicLocation.getCoord().getY()).append("\" ");
139  }
140  }
141 
142  if (this instanceof HasVehicleId hasVehicleId && hasVehicleId.getVehicleId() != null) {
143  out.append("vehicle=\"");
144  writeEncodedAttributeValue(out, hasVehicleId.getVehicleId().toString()).append("\" ");
145  }
146  }
Here is the call graph for this function:

◆ writeXMLEnd()

final void org.matsim.api.core.v01.events.Event.writeXMLEnd ( StringBuilder  out)
protectedinherited

◆ writeAsXML()

void org.matsim.api.core.v01.events.Event.writeAsXML ( StringBuilder  out)
inherited

Write a xml representation of this event to the given writer. The implementation must write the whole xml element <event ... />. Starting with and adding a newline at the end.

The provided default implementation writes the whole element based on getAttributes(). This is slow and should be overridden. The overriding implementation must not call the super method.

Definition at line 162 of file Event.java.

References org.matsim.core.utils.io.XmlUtils.encodeAttributeValue(), and org.matsim.api.core.v01.events.Event.getAttributes().

162  {
163  out.append("\t<event ");
164  Map<String, String> attr = getAttributes();
165  for (Map.Entry<String, String> entry : attr.entrySet()) {
166  out.append(entry.getKey());
167  out.append("=\"");
168  out.append(XmlUtils.encodeAttributeValue(entry.getValue()));
169  out.append("\" ");
170  }
171  out.append(" />\n");
172  }
Map< String, String > getAttributes()
Definition: Event.java:44
Here is the call graph for this function:

Member Data Documentation

◆ EVENT_TYPE

final String org.matsim.withinday.events.ReplanningEvent.EVENT_TYPE = "replanning"
static

◆ ATTRIBUTE_REPLANNERTYPE

final String org.matsim.withinday.events.ReplanningEvent.ATTRIBUTE_REPLANNERTYPE = "replanner"
static

Definition at line 35 of file ReplanningEvent.java.

◆ ATTRIBUTE_PERSON

final String org.matsim.withinday.events.ReplanningEvent.ATTRIBUTE_PERSON = "person"
static

Definition at line 37 of file ReplanningEvent.java.

◆ personId

final Id<Person> org.matsim.withinday.events.ReplanningEvent.personId
private

◆ replannerType

final String org.matsim.withinday.events.ReplanningEvent.replannerType
private

◆ ATTRIBUTE_TIME

final String org.matsim.api.core.v01.events.Event.ATTRIBUTE_TIME = "time"
staticinherited

◆ ATTRIBUTE_TYPE

final String org.matsim.api.core.v01.events.Event.ATTRIBUTE_TYPE = "type"
staticinherited

Definition at line 34 of file Event.java.

◆ ATTRIBUTE_X

final String org.matsim.api.core.v01.events.Event.ATTRIBUTE_X = "x"
staticinherited

◆ ATTRIBUTE_Y

final String org.matsim.api.core.v01.events.Event.ATTRIBUTE_Y = "y"
staticinherited

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