lib/farecalculator.rb
# Yuck, I don't like this but it's quicker
Yuck, I don't like this but it's quicker
Yuck I don ' t like this but it ' s quicker
def findMinimalZoneDifference(startLocation, endLocation)
      minimalZones = []
      currentMinimum = MAXIMUM_DIFFERENCE
      startLocation.getZones().each do |startZone|
        endLocation.getZones().each do |endZone|
          difference = (endZone - startZone).abs
          if difference < currentMinimum
            currentMinimum = difference
            minimalZones[0] = startZone
            minimalZones[1] = endZone
          end
        end
      end
      minimalZones
    end
def findMinimalZoneDifference ( startLocation , endLocation ) minimalZones = [ ] currentMinimum = MAXIMUM_DIFFERENCE startLocation . getZones ( ) . each do | startZone | endLocation . getZones ( ) . each do | endZone | difference = ( endZone - startZone ) . abs if difference < currentMinimum currentMinimum = difference minimalZones [ 0 ] = startZone minimalZones [ 1 ] = endZone end end end minimalZones end
Yuck, I don't like this but it's quicker
Yuck I don ' t like this but it ' s quicker
startLocation
<not_specific>
endLocation
<not_specific>