@Immutable
@Entity
public class AvlReport
extends java.lang.Object
implements java.io.Serializable
Serializable since Hibernate requires such.
Modifier and Type | Class and Description |
---|---|
static class |
AvlReport.AssignmentType |
Constructor and Description |
---|
AvlReport(AvlReport toCopy,
java.util.Date newTime)
Makes a copy of the AvlReport but uses the new time passed in.
|
AvlReport(AvlReport toCopy,
java.lang.String assignmentId,
AvlReport.AssignmentType assignmentType)
Makes a copy of the AvlReport but uses the new assignment info passed in.
|
AvlReport(IpcAvl ipcAvl)
For converting a RMI IpcAvl object to a regular AvlReport.
|
AvlReport(java.lang.String vehicleId,
long time,
double lat,
double lon,
float speed,
float heading,
java.lang.String source)
Constructor for an AvlReport object that is not yet being processed.
|
AvlReport(java.lang.String vehicleId,
long time,
double lat,
double lon,
float speed,
float heading,
java.lang.String source,
java.lang.String leadVehicleId,
java.lang.String driverId,
java.lang.String licensePlate,
java.lang.Integer passengerCount,
float passengerFullness)
Constructor for an AvlReport object that is not yet being processed.
|
AvlReport(java.lang.String vehicleId,
long time,
double lat,
double lon,
java.lang.String source) |
AvlReport(java.lang.String vehicleId,
long time,
Location location,
float speed,
float heading,
java.lang.String source)
Constructor for an AvlReport object that is not yet being processed.
|
AvlReport(java.lang.String vehicleId,
long time,
Location location,
java.lang.String source)
For when speed and heading are not valid.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
java.lang.String |
getAssignmentId()
Returns the assignment ID if it is set.
|
AvlReport.AssignmentType |
getAssignmentType() |
static java.util.List<AvlReport> |
getAvlReportsFromDb(java.util.Date beginTime,
java.util.Date endTime,
java.lang.String vehicleId,
java.lang.String clause)
Gets list of AvlReports from database for the time span specified.
|
java.util.Date |
getDate() |
java.lang.String |
getDriverId() |
java.lang.String |
getField1Name() |
java.lang.String |
getField1Value() |
float |
getHeading()
Heading of vehicles in degrees.
|
double |
getLat() |
long |
getLatency()
Returns how many msec elapsed between the GPS fix was generated
to the time it was finally processed.
|
java.lang.String |
getLeadVehicleId()
Returns the ID of the leading vehicle if this is an AVL report for a
non-lead vehicle in a multi-car consist.
|
java.lang.String |
getLicensePlate() |
Location |
getLocation() |
double |
getLon() |
int |
getPassengerCount()
Returns the passenger count, as obtained from AVL feed.
|
float |
getPassengerFullness()
Fraction indicating how full a vehicle is.
|
java.lang.String |
getSource()
The source of the AVL report
|
float |
getSpeed() |
long |
getTime() |
long |
getTimeProcessed() |
java.lang.String |
getVehicleId() |
int |
hashCode() |
boolean |
hasValidAssignment()
Returns whether assignment information was set in the AVL data and that
assignment is valid.
|
boolean |
ignoreBecauseInConsist()
If this is a vehicle in a multi-car consist and it is not the lead
vehicle then shouldn't generate redundant arrival/departure times,
predictions etc.
|
boolean |
isBlockIdAssignmentType()
Returns true if AVL report indicates that assignment is a block
assignment type such as AssignmentType.BLOCK_ID or
AssignmentType.BLOCK_FOR_SCHED_BASED_PREDS.
|
boolean |
isForSchedBasedPreds()
Returns true if the AVL report is configured to indicate that it was
created to generate schedule based predictions.
|
boolean |
isHeadingValid()
For some AVL systems heading is not available and therefore cannot be used.
|
boolean |
isPassengerCountValid()
Returns whether the passenger count is valid.
|
boolean |
isPassengerFullnessValid()
Returns whether the passenger fullness is valid.
|
boolean |
isRouteIdAssignmentType() |
boolean |
isSpeedValid()
For some AVL systems speed is not available and therefore cannot be used.
|
boolean |
isTripIdAssignmentType() |
boolean |
isTripShortNameAssignmentType() |
static boolean |
matchesUnpredictableAssignment(java.lang.String assignment)
Returns true if the assignment specified matches the regular expression
for unpredictable assignments.
|
void |
setAssignment(java.lang.String assignmentId,
AvlReport.AssignmentType assignmentType)
Stores the assignment information as part of this AvlReport.
|
void |
setField1(java.lang.String name,
java.lang.String value)
For containing additional info as part of AVL feed that is
specific to a particular feed or a new element.
|
void |
setTimeProcessed()
Updates the object to record the current time as the time that
the data was actually processed.
|
java.lang.String |
toString() |
java.lang.String |
validateData()
Makes sure that the members of this class all have reasonable
values.
|
public AvlReport(java.lang.String vehicleId, long time, double lat, double lon, float speed, float heading, java.lang.String source)
vehicleId
- ID of the vehicletime
- Epoch time in msec of GPS report (not when processed)lat
- Latitude in decimal degreeslon
- Longitude in decimal degreesspeed
- Speed of vehicle in m/s. Should be set to Float.NaN if speed
not availableheading
- Heading of vehicle in degrees clockwise from north. Should be
set to Float.NaN if speed not availablesource
- Text describing the source of the reportpublic AvlReport(java.lang.String vehicleId, long time, Location location, float speed, float heading, java.lang.String source)
vehicleId
- ID of the vehicletime
- Epoch time in msec of GPS report (not when processed)location
- speed
- Speed of vehicle in m/s. Should be set to Float.NaN if speed
not availableheading
- Heading of vehicle in degrees clockwise from north. Should be
set to Float.NaN if speed not availablesource
- Text describing the source of the report. Can only be
SOURCE_LENGTH (10) characters longpublic AvlReport(java.lang.String vehicleId, long time, double lat, double lon, java.lang.String source)
vehicleId
- ID of the vehicletime
- Epoch time in msec of GPS report (not when processed)
For when speed and heading are not valid. They are set to Float.NaN .
Since not yet being processed timeProcessed is set to null.vehicleId
- time
- lat
- Latitude in decimal degreeslon
- Longitude in decimal degreessource
- Text describing the source of the report. Can only be
SOURCE_LENGTH (10) characters longpublic AvlReport(java.lang.String vehicleId, long time, Location location, java.lang.String source)
vehicleId
- time
- location
- source
- Text describing the source of the report. Can only be
SOURCE_LENGTH (10) characters longpublic AvlReport(java.lang.String vehicleId, long time, double lat, double lon, float speed, float heading, java.lang.String source, java.lang.String leadVehicleId, java.lang.String driverId, java.lang.String licensePlate, java.lang.Integer passengerCount, float passengerFullness)
vehicleId
- time
- lat
- lon
- speed
- Speed of vehicle in m/s. Should be set to Float.NaN if speed
not availableheading
- Heading of vehicle in degrees clockwise from north. Should be
set to Float.NaN if speed not availablesource
- Text describing the source of the report. Can only be
SOURCE_LENGTH (10) characters longleadVehicleId
- Optional value. Set to null if not available.driverId
- Optional value. Set to null if not available.licensePlate
- Optional value. Set to null if not available.passengerCount
- Optional value. Set to the number of passengers on vehicles.
Set to null if not available.passengerFullness
- Optional Value. Fractional fullness of vehicle. 0.0=empty,
1.0=full. Set to Float.NaN if data not available.public AvlReport(IpcAvl ipcAvl)
ipcAvl
- public AvlReport(AvlReport toCopy, java.util.Date newTime)
toCopy
- The AvlReport to copy (except for the AVL time)newTime
- The AVL time to usepublic AvlReport(AvlReport toCopy, java.lang.String assignmentId, AvlReport.AssignmentType assignmentType)
toCopy
- The AvlReport to copy (except for the AVL time)assignmentId
- The assignment to useassignmentType
- How the assignment was donepublic java.lang.String validateData()
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 getVehicleId()
public long getTime()
public java.util.Date getDate()
public long getTimeProcessed()
public Location getLocation()
public double getLat()
public double getLon()
public float getSpeed()
public float getHeading()
public java.lang.String getSource()
public long getLatency()
public boolean isSpeedValid()
public boolean isHeadingValid()
public java.lang.String getAssignmentId()
public AvlReport.AssignmentType getAssignmentType()
public boolean isBlockIdAssignmentType()
public boolean isTripIdAssignmentType()
public boolean isTripShortNameAssignmentType()
public boolean isRouteIdAssignmentType()
public static boolean matchesUnpredictableAssignment(java.lang.String assignment)
assignment
- public boolean hasValidAssignment()
public void setAssignment(java.lang.String assignmentId, AvlReport.AssignmentType assignmentType)
assignmentId
- assignmentType
- public java.lang.String getLeadVehicleId()
public void setField1(java.lang.String name, java.lang.String value)
name
- value
- public boolean ignoreBecauseInConsist()
public java.lang.String getDriverId()
public java.lang.String getLicensePlate()
public int getPassengerCount()
public boolean isPassengerCountValid()
public float getPassengerFullness()
public boolean isPassengerFullnessValid()
public void setTimeProcessed()
public java.lang.String getField1Name()
public java.lang.String getField1Value()
public boolean isForSchedBasedPreds()
public java.lang.String toString()
toString
in class java.lang.Object
public static java.util.List<AvlReport> getAvlReportsFromDb(java.util.Date beginTime, java.util.Date endTime, java.lang.String vehicleId, java.lang.String clause)
beginTime
- endTime
- vehicleId
- Optional. If not null then will only return results for that
vehicleclause
- Optional. If not null then the clause, such as "ORDER BY time"
will be added to the hql statement.