<commit_before>package gosubway

import (
	"sort"
	"strings"
	"time"

	_ "github.com/jprobinson/gtfs/nyct_subway_proto"
	"github.com/jprobinson/gtfs/transit_realtime"
)

type FeedMessage struct {
	transit_realtime.FeedMessage
}

type Alert struct {
	transit_realtime.Alert
}

type StopTimeUpdate struct {
	transit_realtime.TripUpdate_StopTimeUpdate
}

type FeedType int

const (
	NumberedFeed FeedType = 1
	BlueFeed     FeedType = 26
	YellowFeed   FeedType = 16
	OrangeFeed   FeedType = 21
	LFeed        FeedType = 2
)

// Trains will accept a stopId plus a train line (found here: http://web.mta.info/developers/data/nyct/subway/google_transit.zip)
// and returns a list of updates from northbound and southbound trains
func (f *FeedMessage) Trains(stopId, line string) (alerts []*Alert, northbound, southbound []*StopTimeUpdate) {
	for _, ent := range f.Entity {
		if ent.TripUpdate != nil {
			for _, upd := range ent.TripUpdate.StopTimeUpdate {
				if strings.HasPrefix(*upd.StopId, stopId) &&
					line == *ent.TripUpdate.Trip.RouteId {
					if strings.HasSuffix(*upd.StopId, "N") {
						northbound = append(northbound, &StopTimeUpdate{*upd})
					} else if strings.HasSuffix(*upd.StopId, "S") {
						southbound = append(southbound, &StopTimeUpdate{*upd})
					}
				}
			}
			if ent.Alert != nil {
				alerts = append(alerts, &Alert{*ent.Alert})
			}
		}<commit_msg>adding lines<commit_after>package gosubway

import (
	"sort"
	"strings"
	"time"

	_ "github.com/jprobinson/gtfs/nyct_subway_proto"
	"github.com/jprobinson/gtfs/transit_realtime"
)

type FeedMessage struct {
	transit_realtime.FeedMessage
}

type Alert struct {
	transit_realtime.Alert
}

type StopTimeUpdate struct {
	transit_realtime.TripUpdate_StopTimeUpdate
}

type FeedType int

const (
	NumberedFeed FeedType = 1
	BlueFeed     FeedType = 26
	YellowFeed   FeedType = 16
	OrangeFeed   FeedType = 21
	LFeed        FeedType = 2
	GFeed        FeedType = 31
	BrownFeed    FeedType = 36
)

// Trains will accept a stopId plus a train line (found here: http://web.mta.info/developers/data/nyct/subway/google_transit.zip)
// and returns a list of updates from northbound and southbound trains
func (f *FeedMessage) Trains(stopId, line string) (alerts []*Alert, northbound, southbound []*StopTimeUpdate) {
	for _, ent := range f.Entity {
		if ent.TripUpdate != nil {
			for _, upd := range ent.TripUpdate.StopTimeUpdate {
				if strings.HasPrefix(*upd.StopId, stopId) &&
					line == *ent.TripUpdate.Trip.RouteId {
					if strings.HasSuffix(*upd.StopId, "N") {
						northbound = append(northbound, &StopTimeUpdate{*upd})
					} else if strings.HasSuffix(*upd.StopId, "S") {
						southbound = append(southbound, &StopTimeUpdate{*upd})
					}
				}
			}
			if ent.Alert != nil {
				alerts = append(alerts, &Alert{*ent.Alert})
			}
		}
{'fraction_non_alphanumeric': 0.11273635390652872, 'fraction_numerical': 0.007135212272565109, 'mean_word_length': 3.704697986577181, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3243460', 'n_tokens_mistral': 1135, 'n_tokens_neox': 992, 'n_words': 223}