private List<BlockInstance> getBlockInstances(AgencyAndId blockId,
long serviceDate, long time) {
if (serviceDate != 0) {
BlockInstance blockInstance = _blockCalendarService.getBlockInstance(
blockId, serviceDate);
if (blockInstance == null)
return Collections.emptyList();
BlockConfigurationEntry blockConfig = blockInstance.getBlock();
if (blockConfig.getFrequencies() == null)
return Arrays.asList(blockInstance);
List<BlockInstance> instances = new ArrayList<BlockInstance>();
for (FrequencyEntry frequency : blockConfig.getFrequencies())
instances.add(new BlockInstance(blockConfig,
blockInstance.getServiceDate(), frequency));
return instances;
} else {
List<BlockInstance> instances = _blockCalendarService.getActiveBlocks(
blockId, time, time);