@Entity
public class ArrivalDeparture
extends java.lang.Object
implements org.hibernate.classic.Lifecycle, java.io.Serializable
Implements Lifecycle so that can have the onLoad() callback be called when reading in data so that can intern() member strings. In order to do this the String members could not be declared as final since they are updated after the constructor is called. By interning the member strings less than half (about 40%) of the RAM to be used. This is very important when reading in large batches of ArrivalDeparture objects!
Modifier and Type | Class and Description |
---|---|
static class |
ArrivalDeparture.ArrivalsOrDepartures |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj)
Because using a composite Id Hibernate wants this member.
|
static java.util.Iterator<ArrivalDeparture> |
getArrivalsDeparturesDbIterator(org.hibernate.Session session,
java.util.Date beginTime,
java.util.Date endTime)
For querying large amount of data.
|
static java.util.List<ArrivalDeparture> |
getArrivalsDeparturesFromDb(java.util.Date beginTime,
java.util.Date endTime,
java.lang.String vehicleId)
Read in arrivals and departures for a vehicle, over a time range.
|
static java.util.List<ArrivalDeparture> |
getArrivalsDeparturesFromDb(java.util.Date beginTime,
java.util.Date endTime,
java.lang.String sqlClause,
int firstResult,
int maxResults,
ArrivalDeparture.ArrivalsOrDepartures arrivalOrDeparture)
Same as other getArrivalsDeparturesFromDb() but uses
-Dtransitime.db.dbName Java property to specify the name of the database.
|
static java.util.List<ArrivalDeparture> |
getArrivalsDeparturesFromDb(java.lang.String projectId,
java.util.Date beginTime,
java.util.Date endTime)
Reads the arrivals/departures for the timespan specified.
|
static java.util.List<ArrivalDeparture> |
getArrivalsDeparturesFromDb(java.lang.String dbName,
java.util.Date beginTime,
java.util.Date endTime,
java.lang.String sqlClause,
int firstResult,
int maxResults,
ArrivalDeparture.ArrivalsOrDepartures arrivalOrDeparture)
Allows batch retrieval of data.
|
java.util.Date |
getAvlTime() |
Block |
getBlock()
Note that the block is a transient element so will not be available if
this object was read from the database.
|
java.lang.String |
getBlockId() |
int |
getConfigRev() |
java.util.Date |
getDate() |
java.lang.String |
getDirectionId() |
java.lang.String |
getRouteId() |
TemporalDifference |
getScheduleAdherence()
Returns the schedule adherence for the stop if there was a schedule
time.
|
java.util.Date |
getScheduledDate()
The schedule time will only be set if the schedule info was available
from the GTFS data and it is the proper type of arrival or departure
stop (there is an arrival schedule time and this is the last stop for
a trip and and this is an arrival time OR there is a departure schedule
time and this is not the last stop for a trip and this is a departure
time.
|
long |
getScheduledTime()
Same as getScheduledDate() but returns long epoch time.
|
java.lang.String |
getServiceId() |
Stop |
getStop()
Returns the Stop object associated with the arrival/departure.
|
java.lang.String |
getStopId() |
int |
getStopPathIndex() |
float |
getStopPathLength() |
long |
getTime() |
java.lang.String |
getTripId() |
int |
getTripIndex() |
java.lang.String |
getVehicleId() |
int |
hashCode()
Because using a composite Id Hibernate wants this member.
|
boolean |
isArrival() |
boolean |
isDeparture()
Can be more clear than using !isArrival()
|
void |
logCreation()
For logging each creation of an ArrivalDeparture to the separate
ArrivalsDepartures.log file.
|
boolean |
onDelete(org.hibernate.Session s)
Implemented due to Lifecycle interface being implemented.
|
void |
onLoad(org.hibernate.Session s,
java.io.Serializable id)
Callback due to implementing Lifecycle interface.
|
boolean |
onSave(org.hibernate.Session s)
Implemented due to Lifecycle interface being implemented.
|
boolean |
onUpdate(org.hibernate.Session s)
Implemented due to Lifecycle interface being implemented.
|
java.lang.String |
toString() |
public void onLoad(org.hibernate.Session s, java.io.Serializable id) throws org.hibernate.CallbackException
onLoad
in interface org.hibernate.classic.Lifecycle
org.hibernate.CallbackException
public boolean onSave(org.hibernate.Session s) throws org.hibernate.CallbackException
onSave
in interface org.hibernate.classic.Lifecycle
org.hibernate.CallbackException
public boolean onUpdate(org.hibernate.Session s) throws org.hibernate.CallbackException
onUpdate
in interface org.hibernate.classic.Lifecycle
org.hibernate.CallbackException
public boolean onDelete(org.hibernate.Session s) throws org.hibernate.CallbackException
onDelete
in interface org.hibernate.classic.Lifecycle
org.hibernate.CallbackException
public void logCreation()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public static java.util.Iterator<ArrivalDeparture> getArrivalsDeparturesDbIterator(org.hibernate.Session session, java.util.Date beginTime, java.util.Date endTime) throws org.hibernate.HibernateException
Note that the session needs to be closed externally once done with the Iterator.
session
- beginTime
- endTime
- org.hibernate.HibernateException
public static java.util.List<ArrivalDeparture> getArrivalsDeparturesFromDb(java.util.Date beginTime, java.util.Date endTime, java.lang.String vehicleId)
projectId
- beginTime
- endTime
- vehicleId
- public static java.util.List<ArrivalDeparture> getArrivalsDeparturesFromDb(java.lang.String projectId, java.util.Date beginTime, java.util.Date endTime)
projectId
- beginTime
- endTime
- public static java.util.List<ArrivalDeparture> getArrivalsDeparturesFromDb(java.lang.String dbName, java.util.Date beginTime, java.util.Date endTime, java.lang.String sqlClause, int firstResult, int maxResults, ArrivalDeparture.ArrivalsOrDepartures arrivalOrDeparture)
dbName
- Name of the database to retrieve data from. If set to null
then will use db name configured by Java property
transitime.db.dbNamebeginTime
- endTime
- sqlClause
- The clause is added to the SQL for retrieving the
arrival/departures. Useful for ordering the results. Can be
null.firstResult
- For when reading in batch of data at a time.maxResults
- For when reading in batch of data at a time. If set to 0 then
will read in all data at once.arrivalOrDeparture
- Enumeration specifying whether to read in just arrivals or
just departures. Set to null to read in both.public static java.util.List<ArrivalDeparture> getArrivalsDeparturesFromDb(java.util.Date beginTime, java.util.Date endTime, java.lang.String sqlClause, int firstResult, int maxResults, ArrivalDeparture.ArrivalsOrDepartures arrivalOrDeparture)
beginTime
- endTime
- sqlClause
- firstResult
- maxResults
- arrivalOrDeparture
- public java.lang.String getVehicleId()
public java.util.Date getDate()
public java.util.Date getAvlTime()
public long getTime()
public java.lang.String getStopId()
public boolean isArrival()
public boolean isDeparture()
public java.lang.String getTripId()
public java.lang.String getBlockId()
public java.lang.String getRouteId()
public java.lang.String getServiceId()
public java.lang.String getDirectionId()
public int getConfigRev()
public int getTripIndex()
public int getStopPathIndex()
public float getStopPathLength()
public Block getBlock()
public java.util.Date getScheduledDate()
public long getScheduledTime()
public TemporalDifference getScheduleAdherence()
public Stop getStop()