Documentation ¶
Overview ¶
Package parking :: builder.go
Package parking :: parking.go
Package parking :: regulation.go
Package parking :: spot.go
Index ¶
Constants ¶
const ( // COMPACTPERCENT specifies percentage of compact spots COMPACTPERCENT = 20.0 // CARPOOLPERCENT specifies percentage of carpool spots CARPOOLPERCENT = 7.5 // DEFAULTCAPACITY specifies minimum total capacity for a parking garage DEFAULTCAPACITY = 100 // DEFAULTHANDICAPPERCENT sepcifies percentage of handicap spots DEFAULTHANDICAPPERCENT = 5.0 // DEFAULTGROUNDLEVELS specifies minimum number of ground levels DEFAULTGROUNDLEVELS = 0 // DEFAULTLEVELS specifies minimum number of parking garage levels DEFAULTLEVELS = 1 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder struct
func NewBuilder ¶
func NewBuilder(capacity, levels, groundLevels int, regulation IParkingRegulation) *Builder
NewBuilder returns a parking builder
type CityRegulation ¶
type CityRegulation struct {
// contains filtered or unexported fields
}
CityRegulation implements IParkingRegulation
func GetCityRegulation ¶
func GetCityRegulation(capacity, levels, groundLevels int) CityRegulation
GetCityRegulation returns a city regulation
func (*CityRegulation) GetCarpoolCapacity ¶
func (r *CityRegulation) GetCarpoolCapacity() int
GetCarpoolCapacity returns carpool capacity per the regulation
func (*CityRegulation) GetCompactCapacity ¶
func (r *CityRegulation) GetCompactCapacity() int
GetCompactCapacity returns compact capacity per the regulation
func (*CityRegulation) GetHandicapCapacity ¶
func (r *CityRegulation) GetHandicapCapacity() int
GetHandicapCapacity returns handicap capacity per the regulation
func (*CityRegulation) SetCapacities ¶
func (r *CityRegulation) SetCapacities(capacity, levels, groundLevels int) (int, int, int)
SetCapacities returns capacity, levels, and groundLevels
type IParkingRegulation ¶
type IParkingRegulation interface { SetCapacities(int, int, int) (int, int, int) GetCarpoolCapacity() int GetCompactCapacity() int GetHandicapCapacity() int }
IParkingRegulation interface
type Parking ¶
type Parking struct {
// contains filtered or unexported fields
}
Parking struct
func New ¶
func New(capacity, levels, groundLevels int, regulation IParkingRegulation) *Parking
New create a Parking instance with capacity, levels, and groundLevels
func (*Parking) FindAvailableSpot ¶
FindAvailableSpot returns the first best available to the entryLevel per specific handicap, carpool, or compact property of the vehical note: the caculation for the best spot assumes for the walking distance to
the entry level, instead of driving distance to the spot, since the the parking does not specify which level is the garage entry; otherwise, the best/first available spot would be different.
func (*Parking) SprintLevel ¶
SprintLevel returns a parking map for specific level
type Spot ¶
type Spot struct {
// contains filtered or unexported fields
}
Spot struct
func (*Spot) CompareDistance ¶
CompareDistance compares distances to entry