2 * Copyright (c) 2010-2024 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
7 * This program and the accompanying materials are made available under the
8 * terms of the Eclipse Public License 2.0 which is available at
9 * http://www.eclipse.org/legal/epl-2.0
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.synopanalyzer.internal.synop;
15 import java.util.List;
17 import org.eclipse.jdt.annotation.NonNullByDefault;
20 * The {@link SynopLand} is responsible for analyzing Land station
21 * specifics Synop messages
23 * @author Jonarzz - Initial contribution
26 public class SynopLand extends Synop {
27 private int rainfall = INITIAL_VALUE;
29 public SynopLand(List<String> stringArray) {
32 if (stringArray.size() >= 11) {
33 String rainfallString = stringArray.get(10);
34 if (isValidString(rainfallString) && rainfallString.charAt(0) == 6) {
36 rainfall = Integer.parseInt(rainfallString.substring(1, 4));
37 if (rainfall >= 990) {
40 } catch (NumberFormatException ignore) {
48 protected void setHorizontalVisibilityInt() {
49 if (stringArray.size() >= 4) {
50 String horizontalVisibility = stringArray.get(3);
51 if (isValidString(horizontalVisibility)) {
53 horizontalVisibilityInt = Integer.parseInt(horizontalVisibility.substring(3, 5));
54 } catch (NumberFormatException ignore) {
61 protected void setTemperatureString() {
62 if (stringArray.size() < 6 || !isValidString(stringArray.get(5))) {
66 if (stringArray.get(5).charAt(0) == '0') {
67 if (stringArray.size() < 7 || !isValidString(stringArray.get(6))) {
71 temperatureString = stringArray.get(6).substring(1, 5);
72 } else if (isValidString(stringArray.get(5))) {
73 temperatureString = stringArray.get(5).substring(1, 5);
78 protected void setWindString() {
79 if (stringArray.size() >= 5) {
80 String windString = stringArray.get(4);
81 if (isValidString(windString)) {
82 this.windString = windString;
88 protected void setPressureString() {
89 if (stringArray.size() >= 8) {
90 String pressureString = stringArray.get(7);
91 if (isValidString(pressureString) && pressureString.charAt(0) == '3') {
92 this.pressureString = pressureString;
97 public int getRainfall() {