Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/simonpoole/conditionalrestrictionparser
Simplistic parser for OSM conditional restriction tags
https://github.com/simonpoole/conditionalrestrictionparser
openstreetmap
Last synced: 6 days ago
JSON representation
Simplistic parser for OSM conditional restriction tags
- Host: GitHub
- URL: https://github.com/simonpoole/conditionalrestrictionparser
- Owner: simonpoole
- License: mit
- Created: 2016-07-03T07:59:31.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-12-06T10:45:16.000Z (about 1 year ago)
- Last Synced: 2024-04-19T22:25:33.327Z (8 months ago)
- Topics: openstreetmap
- Language: Java
- Size: 280 KB
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[![build status](https://github.com/simonpoole/ConditionalRestrictionParser/actions/workflows/javalib.yml/badge.svg)](https://github.com/simonpoole/ConditionalRestrictionParser/actions) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=ConditionalRestrictionParser&metric=alert_status)](https://sonarcloud.io/dashboard?id=ConditionalRestrictionParser) [![Coverage](https://sonarcloud.io/api/project_badges/measure?project=ConditionalRestrictionParser&metric=coverage)](https://sonarcloud.io/dashboard?id=ConditionalRestrictionParser) [![sonarcloud bugs](https://sonarcloud.io/api/project_badges/measure?project=ConditionalRestrictionParser&metric=bugs)](https://sonarcloud.io/component_measures?id=ConditionalRestrictionParser&metric=bugs) [![sonarcould maintainability](https://sonarcloud.io/api/project_badges/measure?project=ConditionalRestrictionParser&metric=sqale_rating)](https://sonarcloud.io/component_measures?id=ConditionalRestrictionParser&metric=Maintainability) [![sonarcloud security](https://sonarcloud.io/api/project_badges/measure?project=ConditionalRestrictionParser&metric=security_rating)](https://sonarcloud.io/component_measures?id=ConditionalRestrictionParser&metric=Security) [![sonarcloud reliability](https://sonarcloud.io/api/project_badges/measure?project=ConditionalRestrictionParser&metric=reliability_rating)](https://sonarcloud.io/component_measures?id=ConditionalRestrictionParser&metric=Reliability)
# ConditionalRestrictionParserThis is a very simplistic parser for string values according to the OSM conditional restriction "specification" see http://wiki.openstreetmap.org/wiki/Conditional_restrictions
As there is no grammar provided and a lot of the specification is extremely hand wavy, this is simply a best guess. If a condition can be parsed as a string according to the opening hours specification the corresponding flag in the Condition object will be set, if it is a numeric comparison expression both terms and the operation will be returned.
Running a valid (not so clear what that is, see above) conditional restriction through the parser and producing a string from the results will result in some normalization:
* nested parentheses are removed and expanded to encompasses all conditions in one restriction
* "and" is capitalized## Usage
try
{
ConditionalRestrictionParser parser = new ConditionalRestrictionParser(new ByteArrayInputStream(line.getBytes()));
List list = parser.restrictions();
...
} catch ...## Including in your project
You can either download the jar from github or add the following to your build.gradle
...
repositories {
...
mavenCentral()
...
}
...
dependencies {
...
compile 'ch.poole:ConditionalRestrictionParser:0.3.4'
...
}