<commit_before>"""
Crossing phases for SidewalkPedestrianModel.

For a crossing pedestrian, phases go: -2, -1, 0, 1
For a non-crossing pedestrian that pauses at the crosswalk, phases go: -2, -1, 1
For a non-crossing pedestrian that does not pause at the crosswalk, phases go: -2, 1

Model based on Feliciani et al (2017) - A simulation model for non-signalized pedestrian
crosswalks based on evidence from on field observation.
"""
struct CrossingPhase
    phase::Int # -2, -1, 0, 1
end

const APPROACHING = -2 # Keep walking at constant speed
const APPRAISING = -1 # Decelerate until reach curbside
const CROSSING = 0 # Accelerate until desired speed
const LEAVING = 1 # Keep walking at constant speed

Base.show(io::IO, a::CrossingPhase) = @printf(io, "CrossingPhase(%d)", a.phase)
Base.length(::Type{CrossingPhase}) = 1
Base.convert(::Type{CrossingPhase}, v::Vector{Float64}) = CrossingPhase(convert(Int, v[1]))
function Base.copy!(v::Vector{Float64}, a::CrossingPhase)
    v[1] = a.phase
    v
end

"""
SidewalkPedestrianModel

Walks along the sidewalk until approaching the crosswalk. Waits for the cars to pass, then crosses.
"""
@with_kw mutable struct  <: DriverModel{PedestrianLatLonAccel}
    timestep::Float64
    phase::Int = APPROACHING

    ttc_threshold::Float64 = clamp(rand(Normal(4.0, 2.5)), 1.0, Inf)
    crosswalk::Lane = Lane()
    sw_origin::Lane = Lane()
    sw_dest::Lane = Lane()
    # conflict_lanes::Vector{Lane} = Lane[]

    # Values from Feliciani<commit_msg>Update sidewalk_pedestrian_models.jl<commit_after>"""
    CrossingPhase
Crossing phases for SidewalkPedestrianModel.

For a crossing pedestrian, phases go: -2, -1, 0, 1
For a non-crossing pedestrian that pauses at the crosswalk, phases go: -2, -1, 1
For a non-crossing pedestrian that does not pause at the crosswalk, phases go: -2, 1

Model based on Feliciani et al (2017) - A simulation model for non-signalized pedestrian
crosswalks based on evidence from on field observation.
"""
struct CrossingPhase
    phase::Int # -2, -1, 0, 1
end

const APPROACHING = -2 # Keep walking at constant speed
const APPRAISING = -1 # Decelerate until reach curbside
const CROSSING = 0 # Accelerate until desired speed
const LEAVING = 1 # Keep walking at constant speed

Base.show(io::IO, a::CrossingPhase) = @printf(io, "CrossingPhase(%d)", a.phase)
Base.length(::Type{CrossingPhase}) = 1
Base.convert(::Type{CrossingPhase}, v::Vector{Float64}) = CrossingPhase(convert(Int, v[1]))
function Base.copy!(v::Vector{Float64}, a::CrossingPhase)
    v[1] = a.phase
    v
end

"""
    SidewalkPedestrianModel

Walks along the sidewalk until approaching the crosswalk. Waits for the cars to pass, then crosses.
"""
@with_kw mutable struct  <: DriverModel{PedestrianLatLonAccel}
    timestep::Float64
    phase::Int = APPROACHING

    ttc_threshold::Float64 = clamp(rand(Normal(4.0, 2.5)), 1.0, Inf)
    crosswalk::Lane = Lane()
    sw_origin::Lane = Lane()
    sw_dest::Lane = Lane()
    # conflict_lanes::Vector{Lane} = Lane[]

    # Values from Feliciani
{'fraction_non_alphanumeric': 0.11478663579225934, 'fraction_numerical': 0.02514058881905392, 'mean_word_length': 4.5793357933579335, 'pattern_counts': {'":': 0, '<': 5, '<?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': '1207405', 'n_tokens_mistral': 1051, 'n_tokens_neox': 981, 'n_words': 323}