diff options
| author | Ruben Beltran del Rio <git@r.bdr.sh> | 2025-07-09 08:43:04 +0200 |
|---|---|---|
| committer | Ruben Beltran del Rio <git@r.bdr.sh> | 2025-07-09 08:43:04 +0200 |
| commit | 1e89ea22d551cebfd6c0c0451000c3283ddb2d2e (patch) | |
| tree | 77afac88484877fbea5fecd1ddda85741584c6c5 /Map/Business/MapParser/Strategies/InertiaParserStrategy.swift | |
| parent | 1ec7f2c6deb64f5b13b32fae2bf74ae2d8aaaabb (diff) | |
Get rid of old map parser
Diffstat (limited to 'Map/Business/MapParser/Strategies/InertiaParserStrategy.swift')
| -rw-r--r-- | Map/Business/MapParser/Strategies/InertiaParserStrategy.swift | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/Map/Business/MapParser/Strategies/InertiaParserStrategy.swift b/Map/Business/MapParser/Strategies/InertiaParserStrategy.swift deleted file mode 100644 index d5d515e..0000000 --- a/Map/Business/MapParser/Strategies/InertiaParserStrategy.swift +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (C) 2024 Rubén Beltrán del Río - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see https://map.tranquil.systems. -import Foundation - -struct InertiaParserStrategy: MapParserStrategy { - private let regex = MapParsingPatterns.inertia - - func canHandle(line: String) -> Bool { - let range = NSRange(location: 0, length: line.utf16.count) - let matches = regex.matches(in: String(line), options: [], range: range) - return matches.count > 0 && matches[0].numberOfRanges == 3 - } - - func handle(index: Int, line: String, vertices: [String: Vertex]) -> (Any.Type, Any) { - let range = NSRange(location: 0, length: line.utf16.count) - let matches = regex.matches(in: String(line), options: [], range: range) - - let match = matches[0] - let vertexA = String(line[Range(match.range(at: 2), in: line)!]) - - if let vertex = vertices[vertexA] { - let inertia = Inertia(id: index, position: vertex.position) - return (Inertia.self, inertia) - } - - return (NSObject.self, NSObject()) // No matching object - } -} |