long lastEndTime = Long.MIN_VALUE; for (TimeRange activePeriod : alert.getActivePeriodList()) { final long realStart = activePeriod.hasStart() ? activePeriod.getStart() : 0; final long start = activePeriod.hasStart() ? realStart - earlyStart : 0; if (realStart > 0 && realStart < bestStartTime) { bestStartTime = realStart; final long end = activePeriod.hasEnd() ? activePeriod.getEnd() : Long.MAX_VALUE; if (end > lastEndTime) { lastEndTime = end;
/** * <code>repeated .transit_realtime.TimeRange active_period = 1;</code> * * <pre> * Time when the alert should be shown to the user. If missing, the * alert will be shown as long as it appears in the feed. * If multiple ranges are given, the alert will be shown during all of them. * </pre> */ public com.google.transit.realtime.GtfsRealtime.TimeRange.Builder addActivePeriodBuilder( int index) { return getActivePeriodFieldBuilder().addBuilder( index, com.google.transit.realtime.GtfsRealtime.TimeRange.getDefaultInstance()); } /**
public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeUInt64Size(1, start_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeUInt64Size(2, end_); } size += extensionsSerializedSize(); size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; }
com.google.transit.realtime.GtfsRealtime.TimeRange.Builder timeRange = com.google.transit.realtime.GtfsRealtime.TimeRange.newBuilder(); if (range.getFromValue() != null) timeRange.setStart(range.getFromValue());
if (!getActivePeriod(i).isInitialized()) { memoizedIsInitialized = 0; return false;
public final boolean isInitialized() { for (int i = 0; i < getActivePeriodCount(); i++) { if (!getActivePeriod(i).isInitialized()) {
for (GtfsRealtime.TimeRange range : alert.getActivePeriodList()) { ServiceAlerts.TimeRange.Builder rangeBuilder = ServiceAlerts.TimeRange.newBuilder(); if (range.hasStart()) rangeBuilder.setStart(range.getStart()); if (range.hasEnd()) rangeBuilder.setEnd(range.getEnd()); b.addActiveWindow(rangeBuilder);
/** * <code>optional .transit_realtime.TimeRange replacement_period = 2;</code> * * <pre> * The start time is omitted, the end time is currently now + 30 minutes for * all routes of the A division * </pre> */ public Builder mergeReplacementPeriod(com.google.transit.realtime.GtfsRealtime.TimeRange value) { if (replacementPeriodBuilder_ == null) { if (((bitField0_ & 0x00000002) == 0x00000002) && replacementPeriod_ != com.google.transit.realtime.GtfsRealtime.TimeRange.getDefaultInstance()) { replacementPeriod_ = com.google.transit.realtime.GtfsRealtime.TimeRange.newBuilder(replacementPeriod_).mergeFrom(value).buildPartial(); } else { replacementPeriod_ = value; } onChanged(); } else { replacementPeriodBuilder_.mergeFrom(value); } bitField0_ |= 0x00000002; return this; } /**
/** * Validate Alert time ranges - E001 * * @param entity entity that has alerts to check * @param errors list to which any errors can be added */ private void checkAlertE001(GtfsRealtime.FeedEntity entity, List<OccurrenceModel> errors) { GtfsRealtime.Alert alert = entity.getAlert(); List<GtfsRealtime.TimeRange> activePeriods = alert.getActivePeriodList(); if (activePeriods != null) { for (GtfsRealtime.TimeRange range : activePeriods) { if (range.hasStart()) { if (!isPosix(range.getStart())) { RuleUtils.addOccurrence(E001, "alert in entity " + entity.getId() + " active_period.start " + range.getStart(), errors, _log); } } if (range.hasEnd()) { if (!isPosix(range.getEnd())) { RuleUtils.addOccurrence(E001, "alert in entity " + entity.getId() + " active_period.end " + range.getEnd(), errors, _log); } } } } } }
/** * <code>optional .transit_realtime.TimeRange replacement_period = 2;</code> * * <pre> * The start time is omitted, the end time is currently now + 30 minutes for * all routes of the A division * </pre> */ public Builder clearReplacementPeriod() { if (replacementPeriodBuilder_ == null) { replacementPeriod_ = com.google.transit.realtime.GtfsRealtime.TimeRange.getDefaultInstance(); onChanged(); } else { replacementPeriodBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000002); return this; } /**
public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeUInt64Size(1, start_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeUInt64Size(2, end_); } size += extensionsSerializedSize(); size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; }
public com.google.transit.realtime.GtfsRealtime.TimeRange buildPartial() { com.google.transit.realtime.GtfsRealtime.TimeRange result = new com.google.transit.realtime.GtfsRealtime.TimeRange(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.start_ = start_; if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } result.end_ = end_; result.bitField0_ = to_bitField0_; onBuilt(); return result; }
public Builder toBuilder() { return newBuilder(this); }
/** * <code>repeated .transit_realtime.TimeRange active_period = 1;</code> * * <pre> * Time when the alert should be shown to the user. If missing, the * alert will be shown as long as it appears in the feed. * If multiple ranges are given, the alert will be shown during all of them. * </pre> */ public com.google.transit.realtime.GtfsRealtime.TimeRange.Builder addActivePeriodBuilder( int index) { return getActivePeriodFieldBuilder().addBuilder( index, com.google.transit.realtime.GtfsRealtime.TimeRange.getDefaultInstance()); } /**
/** * <code>repeated .transit_realtime.TimeRange active_period = 1;</code> * * <pre> * Time when the alert should be shown to the user. If missing, the * alert will be shown as long as it appears in the feed. * If multiple ranges are given, the alert will be shown during all of them. * </pre> */ public com.google.transit.realtime.GtfsRealtime.TimeRange.Builder addActivePeriodBuilder() { return getActivePeriodFieldBuilder().addBuilder( com.google.transit.realtime.GtfsRealtime.TimeRange.getDefaultInstance()); } /**
public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(com.google.transit.realtime.GtfsRealtime.TimeRange prototype) {
public com.google.transit.realtime.GtfsRealtime.TimeRange getDefaultInstanceForType() { return com.google.transit.realtime.GtfsRealtime.TimeRange.getDefaultInstance(); }
public static Builder newBuilder(com.google.transit.realtime.GtfsRealtime.TimeRange prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); }
public com.google.transit.realtime.GtfsRealtime.TimeRange build() { com.google.transit.realtime.GtfsRealtime.TimeRange result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; }
public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (hasReplacementPeriod()) { if (!getReplacementPeriod().isInitialized()) { memoizedIsInitialized = 0; return false; } } memoizedIsInitialized = 1; return true; }