org.onebusaway.siri.core
Class SiriLibrary

java.lang.Object
  extended by org.onebusaway.siri.core.SiriLibrary

public class SiriLibrary
extends Object

SIRI utility functions

Author:
bdferris

Constructor Summary
SiriLibrary()
           
 
Method Summary
static Siri copy(Siri payload)
           
static
<T> void
copyList(List<T> from, List<T> to)
           
static void copyServiceDelivery(AbstractServiceDeliveryStructure from, AbstractServiceDeliveryStructure to)
           
static AbstractServiceDeliveryStructure deepCopyModuleDelivery(ESiriModuleType moduleType, AbstractServiceDeliveryStructure from)
           
static Map<String,String> getLineAsMap(String line)
           
static
<T extends AbstractServiceDeliveryStructure>
List<T>
getServiceDeliveriesForModule(ServiceDelivery serviceDelivery, ESiriModuleType moduleType)
           
static
<T extends AbstractServiceRequestStructure>
List<T>
getServiceRequestsForModule(ServiceRequest serviceRequest, ESiriModuleType moduleType)
           
static
<T extends AbstractSubscriptionStructure>
List<T>
getSubscriptionRequestsForModule(SubscriptionRequest subscriptionRequest, ESiriModuleType moduleType)
           
static
<T> List<T>
grep(Iterable<T> elements, String propertyPathExpression, Object equalityValue)
           
static boolean isSituationClosed(PtSituationElementStructure situation)
          Determine if the specified situation is closed according to its workflow status.
static boolean isSituationExpired(PtSituationElementStructure situation, Date currentTime)
          Determine if the specified situation is expired, as indicated by the publication windows and validity periods of the situation all ending before the current time.
static boolean isSituationPublishedOrValid(PtSituationElementStructure situation, Date currentTime)
          Determine if the specified situation is active, as indicated by the publication windows and validity periods of the situation and the current time.
static boolean isTimeRangeActive(HalfOpenTimestampRangeStructure range, Date time)
          Returns true if the the specified time range is active at the specified time.
static boolean isTimeRangeActiveOrUpcoming(HalfOpenTimestampRangeStructure range, Date time)
          Returns true if the specified time range is active at the specified time or will become active at some point in the future.
static boolean needsHelp(String[] args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SiriLibrary

public SiriLibrary()
Method Detail

getServiceRequestsForModule

public static <T extends AbstractServiceRequestStructure> List<T> getServiceRequestsForModule(ServiceRequest serviceRequest,
                                                                                              ESiriModuleType moduleType)

getSubscriptionRequestsForModule

public static <T extends AbstractSubscriptionStructure> List<T> getSubscriptionRequestsForModule(SubscriptionRequest subscriptionRequest,
                                                                                                 ESiriModuleType moduleType)

getServiceDeliveriesForModule

public static <T extends AbstractServiceDeliveryStructure> List<T> getServiceDeliveriesForModule(ServiceDelivery serviceDelivery,
                                                                                                 ESiriModuleType moduleType)

grep

public static <T> List<T> grep(Iterable<T> elements,
                               String propertyPathExpression,
                               Object equalityValue)

copy

public static Siri copy(Siri payload)

deepCopyModuleDelivery

public static AbstractServiceDeliveryStructure deepCopyModuleDelivery(ESiriModuleType moduleType,
                                                                      AbstractServiceDeliveryStructure from)

copyServiceDelivery

public static void copyServiceDelivery(AbstractServiceDeliveryStructure from,
                                       AbstractServiceDeliveryStructure to)

copyList

public static <T> void copyList(List<T> from,
                                List<T> to)

isSituationClosed

public static boolean isSituationClosed(PtSituationElementStructure situation)
Determine if the specified situation is closed according to its workflow status.

Parameters:
situation -
Returns:
true if the situation's workflow status is 'CLOSING' or 'CLOSED'

isSituationExpired

public static boolean isSituationExpired(PtSituationElementStructure situation,
                                         Date currentTime)
Determine if the specified situation is expired, as indicated by the publication windows and validity periods of the situation all ending before the current time. If a situation has no publication window or validity periods, it is considered active.

Parameters:
situation -
currentTime -
Returns:
true if the situation has expired before the specified time.

isSituationPublishedOrValid

public static boolean isSituationPublishedOrValid(PtSituationElementStructure situation,
                                                  Date currentTime)
Determine if the specified situation is active, as indicated by the publication windows and validity periods of the situation and the current time. If a situation has no publication window or validity periods, it is considered active.

Parameters:
situation -
currentTime -
Returns:
true if the situation is active at the specified time

isTimeRangeActive

public static boolean isTimeRangeActive(HalfOpenTimestampRangeStructure range,
                                        Date time)
Returns true if the the specified time range is active at the specified time. We do not consider an empty time range to ever be active.

Parameters:
range -
time -
Returns:
true if the specified time falls within the specified time range

isTimeRangeActiveOrUpcoming

public static boolean isTimeRangeActiveOrUpcoming(HalfOpenTimestampRangeStructure range,
                                                  Date time)
Returns true if the specified time range is active at the specified time or will become active at some point in the future. We do not consider an empty time range to ever be active.

Parameters:
range -
time -
Returns:
true if the specified time range is active at the specified time or will become active at some point in the future

getLineAsMap

public static Map<String,String> getLineAsMap(String line)

needsHelp

public static boolean needsHelp(String[] args)


Copyright © 2012 OneBusAway. All Rights Reserved.