Skip to content

Commit

Permalink
Realease 1.2.0 (#22)
Browse files Browse the repository at this point in the history
* fix Readme.md

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

* Update coverage badge

* Refactor degreesToDirection.

* Add getHeight() to return cloud height in feet

The noun "height" has been deliberately chosen since METARs report
cloud as height AGL rather than altitude AMSL.

* Allow cloud height to be set in feet

* Standardise cloud height internally

The noun should be height instead of altitude since cloud is reported as
AGL rather than AMSL. The calculations have also been swapped over so
the height is stored as it is reported in feet - the approximate
conversion to meters is still available via the setAltitude and
getAltitude methods for backwards compatibility.

* Change cloud parser to use setHeight

* Deprecate the cloud *Altitude methods

Since cloud is reported as height AGL, then the noun "altitude" is
incorrect and misleading.

* Update README.md

* Added Eclipse plugin ObjectAid for uml class diagram.

This plugin generates the class diagram from the java code and then
exports a picture of the diagram. For an unknown reason when exporting
the diagram, arrows on the relation disappear.

* hotfix/fixReadme: Fix version of pom

* Fix bug VariableWindParse: Update pom version.

Update pom version to 1.1.

* Fix regex of wind.

The regex used a \d in order to match the direction. But when the
direction wasn't in degrees but VRB the regex wasn't matched and the
windPart was not parsed. Changing \d to \w fix the problem.

* Change type of directionDegrees.

Change type from int to integer.
This change allows to have a null value for directionDegrees when the
direction is Variable.

* fix checkstyle

* fix checkstyle

* Updated pom version.

* Updated pom.

Added information on continuous integration and issue management.

* updated model

* Fix checkstyle in enum package.

* Fix checkstyle in facade.

* Fix checkstyle in builder and exception package.

* fix checkstyle in model package.

* Renamed WeatherCode to AbstractWeatherCode

* fix checkstyle in enums.

* fix checkstyles in facade.

* Fix checkstyles in utils package.

* Fix checkstyle in parser package

* updated model

* Added checkstyle file.

Added configuration file for codeclimate.

* Update minimum coverage

* update codeclimate.yml

* Fix spelling

* Added class abstractWeatherContainer.

It is a class containing:
- Wind
- Visibility
- list of clouds
- list of weather conditions
- vertical visibility

* Updated model.jpg

* Fix format

* Made AbstractWeatherContainer parent of AbstractWeatherCode

* added test for addWeatherCondition and addTest

* Feature/metar trends (#18)

* Added messages for trends.

* Added classes related to time in metar trends.

* Added hierarchy classes for trends.

AbstractTrend: the abstract super class. Contains wind, clouds,
weatherConditions and visibility.

AbstractMetarTrend: Subclass of AbstractTrend. Abstract class for metar
trends. Contains attributes for the time of the trend.

BECMGMetarTrend: Subclass of AbstractMetarTrend. Represents the BECMG
part.

TEMPOMetarTrend: Subclass of AbstractMetarTrend. Represents the Tempo part.

* Pull up constants FM, TEMPO and BECMG

* Added stringToTime method in converter.

* fix test when locale is not english

* Added Trends to metar.

* Updated parse method of metar in order to parse trends.

Added tests.

Refactor trend times (AT, FM, TL) inside a List instead of 3 attributes.

* Created new model for trends and updated readme.

* Updated pom.

* fix checkstyle

* update model

* Fix code climate issue.

* fix code climate issues

* Made AbstractTrend a subclass of AbstractWeatherContainer

* Update pom for release.
  • Loading branch information
mivek authored May 13, 2018
1 parent e34502f commit bed5ad4
Show file tree
Hide file tree
Showing 69 changed files with 2,207 additions and 1,114 deletions.
44 changes: 44 additions & 0 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
version: "2" # required to adjust maintainability checks
checks:
argument-count:
config:
threshold: 4
complex-logic:
config:
threshold: 4
file-lines:
config:
threshold: 1000
method-complexity:
config:
threshold: 20
method-count:
config:
threshold: 20
method-lines:
config:
threshold: 50
nested-control-flow:
config:
threshold: 4
return-statements:
config:
threshold: 4
similar-code:
config:
threshold: # language-specific defaults. an override will affect all languages.
identical-code:
config:
threshold: # language-specific defaults. an override will affect all languag

plugins:
checkstyle:
enabled: true
config:
file: "checkstyle.xml"
pmd:
enabled: true
sonar-java:
enabled: true
config:
sonar.java.source: 8
11 changes: 6 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
env:
global:
- CC_TEST_REPORTER_ID=80f941339411bc7abca6636030897e70dad49f2693f1bcc14ab9fda1b86bf63d
language: java

before_script:
Expand All @@ -9,6 +6,10 @@ before_script:
- ./cc-test-reporter before-build

script:
- mvn
- mvn install

after_script:
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
# Upload code coverage to code climate - with workaround for jacoco
- cp target/site/jacoco/jacoco.xml src/main/java/jacoco.xml
- cd src/main/java/
- ../../../cc-test-reporter after-build -t jacoco --exit-code $TRAVIS_TEST_RESULT
215 changes: 116 additions & 99 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,99 +1,116 @@
[![Build Status](https://travis-ci.org/mivek/MetarParser.svg?branch=master)](https://travis-ci.org/mivek/MetarParser)
[![Maintainability](https://api.codeclimate.com/v1/badges/bfd4e09cccf432218d40/maintainability)](https://codeclimate.com/github/mivek/MetarParser/maintainability)
[![codecov](https://codecov.io/gh/mivek/MetarParser/branch/master/graph/badge.svg)](https://codecov.io/gh/mivek/MetarParser)
# MetarParser


This java lib provides a Metar decoder.

Use the MetarFacade class and its method decode to decode a metar.
Use the MetarFacade class and its method retrieveFromAirport to get the metar of an airport. This metod take the icao code as parameter.
The trends of the metar are not parsed.

## Model
![class diagram](model.jpg)
### Enumerations

The application contains numerous enumarations to represent datas.
- CloudType: to represent the type of cloud.
- CloudQuantity: to represent the amount of clouds.
- Intensity: to represent the intensity of a meteorological phenomenon.
- Descriptive: to represent the descriptive of a meteorological phenomenon.
- Phenomenon: to represent a phenomenon.

### Classes

#### Airport
The airport class is composed of
- Name
- City
- Country
- IATA code
- ICAO code
- latitude
- longitude
- altitude
- timezone

#### Cloud
In this application a cloud is composed of
- CloudQuantity
- CloudType (optional)
- altitude (optional)

#### Country
A country is represented by its name.

#### Runway information

The runway information is composed of
- The name of the runway
- The minimal visibility on the runway
- The maximal visibility on the runway (optional)
- The trend of the visibility (optional)

#### Visibility

The visibility class is composed of
- The main visibility
- The minimal visibility (optional)
- The direction of the minimal visibility (optional)

#### WeatherCondition
The weather condition is class to represent a meteorological phenomenon.
A weather condition is composed of
- an intensity (optional)
- a descriptive (optional)
- a list of phenomenon

#### Wind
The wind class is composed of
- the speed
- the direction
- the speed of the gust
- the lowest variable wind
- the highest variable wind
- the unit of the wind's speed

## Examples
### Parse a metar
Instantiate the metarFacade and use its method parse.

```java
String code = "LFPG 131830Z 19005KT 170V250 9999 -SHRA FEW040TCU SCT086 16/08 Q1011";
MetarFacade facade = MetarFacade.getInstance();
Metar metar = facade.decode(code);
```

### Retrieve the metar of an airport
Instantiate the metarFacade.
Use the its method retrieveFromAirport with the ICAO code of the airport.

```java
String icao = "LFPG";
MetarFacade facade = MetarFacade.getInstance();
Metar metar = facade.retrieveFromAirport(icao);
```



[![Build Status](https://travis-ci.org/mivek/MetarParser.svg?branch=master)](https://travis-ci.org/mivek/MetarParser)
[![Maintainability](https://api.codeclimate.com/v1/badges/bfd4e09cccf432218d40/maintainability)](https://codeclimate.com/github/mivek/MetarParser/maintainability)
[![Test Coverage](https://api.codeclimate.com/v1/badges/bfd4e09cccf432218d40/test_coverage)](https://codeclimate.com/github/mivek/MetarParser/test_coverage)
# MetarParser


This java lib provides a Metar decoder.

Use the MetarFacade class and its method decode to decode a metar.
Use the MetarFacade class and its method retrieveFromAirport to get the metar of an airport. This metod take the icao code as parameter.
The trends of the metar are not parsed.

## Model
The model is generated by using the Eclipse visualization tool [ObjectAid](http://www.objectaid.com/home).
When updating classes in packages com.mivek.enums or com.mivek.model, the class diagram is also updated.
When added a new class/enumeration in one of those package, drag and drop the new class to model.ucls and generate a new jpeg of the class diagram.
![class diagram](model.jpg)
### Enumerations

The application contains numerous enumarations to represent datas.
- CloudType: to represent the type of cloud.
- CloudQuantity: to represent the amount of clouds.
- Intensity: to represent the intensity of a meteorological phenomenon.
- Descriptive: to represent the descriptive of a meteorological phenomenon.
- Phenomenon: to represent a phenomenon.
- WeatherChangeTime: to represent a trend.
- TimeIndicator: to represent the time of the trend.

### Classes

#### Airport
The airport class is composed of
- Name
- City
- Country
- IATA code
- ICAO code
- latitude
- longitude
- altitude
- timezone

#### Cloud
In this application a cloud is composed of
- CloudQuantity
- CloudType (optional)
- height (optional)

#### Country
A country is represented by its name.

#### Runway information

The runway information is composed of
- The name of the runway
- The minimal visibility on the runway
- The maximal visibility on the runway (optional)
- The trend of the visibility (optional)

#### Visibility

The visibility class is composed of
- The main visibility
- The minimal visibility (optional)
- The direction of the minimal visibility (optional)

#### WeatherCondition
The weather condition is class to represent a meteorological phenomenon.
A weather condition is composed of
- an intensity (optional)
- a descriptive (optional)
- a list of phenomenon

#### Wind
The wind class is composed of
- the speed
- the direction
- the speed of the gust
- the lowest variable wind
- the highest variable wind
- the unit of the wind's speed

### Trends
![trends diagram](trend.jpg)
Numerous classes represents the trends. Trends are stored inside a list of the metar object `Metar.getTrends()`.
Trends are composed of
- a Type (BECMG or TEMPO)
- a wind
- a visibility and vertical visibility
- a list of clouds
- a list of weather conditions
- a list of `AbstractMetarTrendTime` to represent the time with its type (AT, FM, TL)


## Examples
### Parse a metar
Instantiate the metarFacade and use its method parse.

```java
String code = "LFPG 131830Z 19005KT 170V250 9999 -SHRA FEW040TCU SCT086 16/08 Q1011";
MetarFacade facade = MetarFacade.getInstance();
Metar metar = facade.decode(code);
```

### Retrieve the metar of an airport
Instantiate the metarFacade.
Use the its method retrieveFromAirport with the ICAO code of the airport.

```java
String icao = "LFPG";
MetarFacade facade = MetarFacade.getInstance();
Metar metar = facade.retrieveFromAirport(icao);
```



99 changes: 99 additions & 0 deletions checkstyle.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN" "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">

<!--
This configuration file was written by the eclipse-cs plugin configuration editor
-->
<!--
Checkstyle-Configuration: MetarParser
Description:
Checkstyle configuration that checks the sun coding conventions.
-->
<module name="Checker">
<property name="severity" value="warning"/>
<property name="fileExtensions" value="java, properties, xml"/>
<module name="TreeWalker">
<module name="JavadocMethod"/>
<module name="JavadocType"/>
<module name="JavadocVariable"/>
<module name="JavadocStyle"/>
<module name="ConstantName"/>
<module name="LocalFinalVariableName"/>
<module name="LocalVariableName"/>
<module name="MemberName">
<property name="format" value="^f[A-Z][a-zA-Z0-9]*$"/>
</module>
<module name="MethodName"/>
<module name="PackageName"/>
<module name="ParameterName">
<property name="format" value="^p[A-Z][a-zA-Z0-9]*$"/>
<property name="accessModifiers" value="public"/>
</module>
<module name="StaticVariableName"/>
<module name="TypeName"/>
<module name="IllegalImport"/>
<module name="RedundantImport"/>
<module name="UnusedImports">
<property name="processJavadoc" value="false"/>
</module>
<module name="MethodLength"/>
<module name="ParameterNumber"/>
<module name="EmptyForIteratorPad"/>
<module name="GenericWhitespace"/>
<module name="MethodParamPad"/>
<module name="NoWhitespaceAfter"/>
<module name="NoWhitespaceBefore"/>
<module name="OperatorWrap"/>
<module name="ParenPad"/>
<module name="TypecastParenPad"/>
<module name="WhitespaceAfter"/>
<module name="WhitespaceAround"/>
<module name="ModifierOrder"/>
<module name="RedundantModifier"/>
<module name="AvoidNestedBlocks"/>
<module name="EmptyBlock"/>
<module name="LeftCurly"/>
<module name="NeedBraces"/>
<module name="RightCurly"/>
<module name="AvoidInlineConditionals"/>
<module name="EmptyStatement"/>
<module name="EqualsHashCode"/>
<module name="HiddenField"/>
<module name="IllegalInstantiation"/>
<module name="InnerAssignment"/>
<module name="MissingSwitchDefault"/>
<module name="SimplifyBooleanExpression"/>
<module name="SimplifyBooleanReturn"/>
<module name="DesignForExtension"/>
<module name="FinalClass"/>
<module name="HideUtilityClassConstructor"/>
<module name="InterfaceIsType"/>
<module name="VisibilityModifier"/>
<module name="ArrayTypeStyle"/>
<module name="FinalParameters"/>
<module name="TodoComment"/>
<module name="UpperEll"/>
<module name="AbstractClassName"/>
<module name="MissingOverride"/>
<module name="CovariantEquals"/>
<module name="DefaultComesLast"/>
<module name="DeclarationOrder"/>
<module name="UnnecessaryParentheses"/>
<module name="OneStatementPerLine"/>
</module>
<module name="JavadocPackage"/>
<module name="NewlineAtEndOfFile"/>
<module name="Translation"/>
<module name="FileLength"/>
<module name="FileTabCharacter">
<property name="severity" value="ignore"/>
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
</module>
<module name="RegexpSingleline">
<property name="format" value="\s+$"/>
<property name="message" value="Line has trailing spaces."/>
</module>
<module name="BeforeExecutionExclusionFileFilter">
<property name="fileNamePattern" value="Test\.java$"/>
</module>
</module>
Binary file modified model.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit bed5ad4

Please sign in to comment.