Skip to content

Commit e4b475b

Browse files
committed
Polishes and dep upgrades
1 parent d7e5a91 commit e4b475b

File tree

3 files changed

+31
-17
lines changed

3 files changed

+31
-17
lines changed

pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<modelVersion>4.0.0</modelVersion>
33
<groupId>fun.seabird</groupId>
44
<artifactId>ebird-csv-parser</artifactId>
5-
<version>0.0.2</version>
5+
<version>0.0.3</version>
66
<name>ebird-csv-parser</name>
77

88
<build>
@@ -55,14 +55,14 @@
5555
<dependency>
5656
<groupId>org.slf4j</groupId>
5757
<artifactId>slf4j-api</artifactId>
58-
<version>2.0.9</version>
58+
<version>2.0.11</version>
5959
</dependency>
6060

6161
<!-- https://mvnrepository.com/artifact/io.projectreactor/reactor-core -->
6262
<dependency>
6363
<groupId>io.projectreactor</groupId>
6464
<artifactId>reactor-core</artifactId>
65-
<version>3.6.1</version>
65+
<version>3.6.2</version>
6666
</dependency>
6767

6868
<dependency>

src/main/java/fun/seabird/EbirdCsvParser.java

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -123,15 +123,18 @@ private static EbirdCsvRow parseCsvLine(CSVRecord record)
123123
}
124124

125125
/**
126-
* Parses a CSV file and applies the given row processor to each CSV record.
127-
* The parsing can be performed in single-threaded or multi-threaded mode,
128-
* based on the provided ParseMode. Optionally, the CSV records can be pre-sorted
129-
* based on the specified PreSort before processing.
126+
* Parses a CSV file containing eBird observation data and processes each row according to the specified {@code rowProcessor}.
127+
* The method allows for pre-sorting of data based on the observation date and supports processing in either single-threaded
128+
* or multi-threaded mode as specified by the {@code mode} parameter.
130129
*
131-
* @param csvFile The path to the CSV file to be parsed.
132-
* @param rowProcessor The consumer function to be applied to each parsed CSV row.
133-
* @param mode The parsing mode: SINGLE_THREAD or MULTI_THREAD.
134-
* @param preSort The pre-sorting option for the CSV records: null, PreSort.DATE, or PreSort.DEFAULT_SORT.
130+
* @param csvFile The path to the CSV file to be parsed. Must not be {@code null}.
131+
* @param rowProcessor A {@link Consumer} that processes each parsed row of the CSV file. The consumer receives an instance
132+
* of {@link EbirdCsvRow}, which represents the parsed data of each row. Must not be {@code null}.
133+
* @param mode The {@link ParseMode} specifying how the CSV file should be processed. {@link ParseMode#MULTI_THREAD} enables
134+
* multi-threaded processing, while {@link ParseMode#SINGLE_THREAD} uses a single thread for processing.
135+
* @param preSort Specifies the pre-sorting method to be applied to the CSV data before processing. If set to
136+
* {@link PreSort#DATE}, the data will be sorted by observation date prior to processing; otherwise, the
137+
* data is processed in the order it appears in the file.
135138
* @throws IOException If an I/O error occurs while reading the CSV file.
136139
*/
137140
public static final void parseCsv(Path csvFile,Consumer<EbirdCsvRow> rowProcessor,ParseMode mode,PreSort preSort) throws IOException

src/main/java/fun/seabird/EbirdCsvRow.java

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,28 @@
66
import java.util.ArrayList;
77
import java.util.List;
88

9-
import lombok.Data;
9+
import lombok.EqualsAndHashCode;
10+
import lombok.EqualsAndHashCode.Include;
11+
import lombok.Getter;
12+
import lombok.NoArgsConstructor;
13+
import lombok.Setter;
14+
import lombok.ToString;
1015

11-
@Data
16+
@Getter
17+
@Setter
18+
@NoArgsConstructor
19+
@EqualsAndHashCode(onlyExplicitlyIncluded=true)
20+
@ToString
1221
public class EbirdCsvRow
1322
{
1423
private String subId;
1524
private String commonName;
16-
private String sciName;
25+
@Include private String sciName;
1726
private Double taxonOrder;
1827
private String count;
1928
private String subnat1Code;
2029
private String subnat2Name;
21-
private String locId;
30+
@Include private String locId;
2231
private String locName;
2332
private Double lat;
2433
private Double lng;
@@ -32,6 +41,10 @@ public class EbirdCsvRow
3241
private Integer partySize;
3342
private String breedingCode;
3443

44+
//space-separated String in the CSV
45+
private List<Long> assetIds = new ArrayList<>();
46+
47+
@Include
3548
public LocalDateTime dateTime()
3649
{
3750
if (time == null)
@@ -40,6 +53,4 @@ public LocalDateTime dateTime()
4053
return date.atTime(time);
4154
}
4255

43-
//space-separated String in the CSV
44-
private List<Long> assetIds = new ArrayList<>();
4556
}

0 commit comments

Comments
 (0)