Documentation

AddStop.java

Adds stop into permanent database
Requires entry of agency code, stop ID, name, latitude, longitude coordinates
Looped for infinite entry of stops

AgencyMap.java

Generates agency maps
Agency maps public as of May 2024
Loops through indiviudal agencies, outputs KML files (maps/map-agency.kml)

Calculator.java

The main calculator behind this whole project.
The most hodgepodge hackjob of a program.

agency()
Asks for agency to search / input
Checks against list of current agencies to check if valid
Loops if invalid agency is entered
If valid, passes to edi()

edi()
Bulk of the calculator

Asks for line choice
If searching for existing line, will pull up that line
There are special cases below
Line choice -00, exits calculator
Line choice set, pulls line from old set, applicable agencies only, and asks for set name

Line choice custom
Enter new line into database
Loads stop listing from agency (stops/list/agency.txt)
Two separate ArrayLists, stops2 for EDI file, custom for ending display, stops2 has more data
Asks for line code, name, and branch name, if applicable, Main if not
Loop to ask for stop IDs along route

Special stop IDs:
Stop ID -1, custom stop, asks for code, name, latitude, longitude
Stop ID -2, removes previous stop
Stop ID -3, adds stop from other agency, asks for agency code, stop ID
Stop ID -0, ends line
Stop ID segment, adds segment of existing line, reverse to add in reverse (see below for further documenation)

Passes each stop added to rollingEDI() (see further documenation below)
Prompt to save custom line, if yes, stops2 saves to agency EDI file (files/agency-edi.txt) and EDI list file (edis/agency.txt)
Prompt to export custom line, if yes, displays all stop IDs in order, along with agency and route codes

Line choice segment
Calculates EDI for segment of existing line
Loads in EDI file (files/agency-edi.txt)
Prompts for line code, starting stop, ending stop numbers (not codes)
Invalid if segment length is 0

Line choice reverse
Reverses line of segment (see above documenation)
Does the exact same thing and then reverses line

Other line choice
Checks if valid line code
Prints details of that line

All searches go through rollingEDI() (see documenation below)
Haversine formula loop for whole line
There's a hackjob for old bug of EDI less than 1
Displays distance in miles, EDI, and average stop spacing in miles

rollingEDI()
The comment is correct, this was created at 1 in the morning as one of Ben's crazy ideas
Calculates distance and EDI cumulatively along line as being entered
Also shown as part of full line display
Runs line up to certain amount of stops through haversine formula

calcIndex()
Clone of rollingEDI() to only return EDI value

saveIndex()
Clone to directly calculate index value for ImportIndex.java (see documenation below)
Adds new line to EDI file (files/agency-edi.txt) and EDI list file (edis/agency.txt)

FullMap.java

Same as AgencyMap.java (see documenation above) but creates map of all agencies
Loops through each agency to produce one file (maps/map-all.kml)

HasIndex.java

Searches database for routes with certain EDI value
Asks for value
value range, asks for low and high ends, searches for all within that range

ImportIndex.java

Internal use program
Takes file exported from outside GTFS reader and imports all files into EDI
Pushes to Calculator.saveIndex()
Asks for agency code and import code

PopulationData.java

Largely for internal use, no plans to make public as of March 2024
Connects EDI data to US Census to find population served
Only supports agencies within the US
Constructor for data pushed from StopInfo.java (see documenation below)
Choice between population served by stop or line
Checks if valid agency within the US (zz- used internally for other purposes)
Asks for agency and radius between 0.125 and 1.0 miles

Choice stop
Loads in agency stop file (stops/list/agency.txt)
Asks for stop

Choice line
Loads in EDI values (edis/agency.txt)
Loads in EDI file (files/agency-edi.txt)
Asks for line
Can also search for segment of line

Choice bulk
Loads in EDI values (edis/agency.txt)
Loads in EDI file (files/agency-edi.txt)
Loops through all lines in agency

Finds all points within selected radius of all stops on line chosen, or single stop

population()
Finds points in increments of 0.125 miles and 45 degrees
Runs all coordinates through US Census geocoder to find state, county, tract, block
Checks for duplicates
Adds all population totals by block
Finds population served per mile
Looped for infinite searches

RouteList.java

Generates route listing page (routes.html)
Completely automatic
Loops through each agency EDI list file (edis/agency.txt)
Finds agencies with sets of old routes (sets/agency.txt and edis/sets/agency-set.txt)
Counts total number of routes
Format for display on the website
Displays route count in command line, both by agency and total

Segment.java

Gets EDI of all segments from particular stop on route
Too niche for web adaptation as of March 2024
Asks for agency, line, and starting stop
Same segment algorithm as Calculator.java
Looped for infinite searches

Stats.java

Creates command line stats interface for each agency, as well as database as a whole
Constructor to bypass prompts when Update.java is run
Prompts for agency code, code global will search entire database
Sets are included in global search
Gets data from EDI list file (edis/agency.txt)
Lists mean and median length and EDI
Lists total amount of routes and distance
Lists 25th, 75th, and 90th percentile EDIs
Lists spread of EDIs in range categories

StatsList.java

Website adaptation of Stats.java (see documenation above)
EDI miles, spreads, and percentiles are not listed

Stop.java

Class for Stop objects, used in EDI as well as other projects
Variables for ID, name, code, coordinates, order on line
Shouldn't really be messed with

StopInfo.java

Provides infomation about a stop, name, code, location
Not planned for public release as of March 2024
Asks for agency code
Loads stop file (stops/list/agency.txt)
Pushes stop to PopulationData.java (see documenation above)

StopList.java

Generates stop listing pages on website (stops.html and stops/agency.html)
Automatically loops through all agencies
Loads stop files (stops/list/agency.txt)
Counts total number of stops
Format for display on the website
Displays stop count in command line, both by agency and total

StopSearch.java

Searches database for stop containing string
No plans to make website adaptation as of March 2024
Can search global database or specific agency
Asks for agency code
Displays all matches, along with agency and stop codes
Looped for infinite searches

Update.java

Runs most update files to update website listings
RouteList, FullMap, AgencyMap, StatsList all to update website
Stats with global search for ending display of current database stats
StopList not ran anymore due to less frequent updates
Prints out local time and time zone of computer running program, added to website homepage (index.html)