Skip to content

Commit

Permalink
improve summary field names
Browse files Browse the repository at this point in the history
  • Loading branch information
cwensel committed Nov 9, 2023
1 parent 24f79a1 commit 6ede23f
Show file tree
Hide file tree
Showing 5 changed files with 104 additions and 87 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@
@JsonPropertyOrder({
"arc",
"temporalUnit",
"startLot",
"firstLot",
"startGap",
"endLot",
"lastLot",
"endGap",
"intervals",
"earliest",
"earliestFound",
"earliestGap",
"latest",
"latestFound",
"latestGap",
"running",
"partial",
"missing",
"complete",
"gaps",
"total"
"totalFound",
"range",
"rangeGap"
})
public class ArcStatusSummaryRecord extends StatusSummaryRecord<ArcState> {
@JsonUnwrapped
Expand Down Expand Up @@ -87,9 +87,11 @@ public void addState(ArcState state) {
public static final class Builder {
ArcRecord arcRecord;
TemporalUnit temporalUnit;
String startLot;
String endLot;
long intervals;
String earliestLot;
String latestLot;
long rangeIntervals;
String firstFoundLot;
String lastFoundLot;

private Builder() {
}
Expand All @@ -108,28 +110,40 @@ public Builder withTemporalUnit(TemporalUnit temporalUnit) {
return this;
}

public Builder withStartLot(String startLot) {
this.startLot = startLot;
public Builder withEarliestLot(String earliestLot) {
this.earliestLot = earliestLot;
return this;
}

public Builder withEndLot(String endLot) {
this.endLot = endLot;
public Builder withLatestLot(String latestLot) {
this.latestLot = latestLot;
return this;
}

public Builder withIntervals(long intervals) {
this.intervals = intervals;
public Builder withRangeIntervals(long rangeIntervals) {
this.rangeIntervals = rangeIntervals;
return this;
}

public Builder withFirstFoundLot(String firstFoundLot) {
this.firstFoundLot = firstFoundLot;
return this;
}

public Builder withLastFoundLot(String lastFoundLot) {
this.lastFoundLot = lastFoundLot;
return this;
}

public ArcStatusSummaryRecord build() {
ArcStatusSummaryRecord arcStatusSummaryRecord = new ArcStatusSummaryRecord();
arcStatusSummaryRecord.startLot = this.startLot;
arcStatusSummaryRecord.intervals = this.intervals;
arcStatusSummaryRecord.temporalUnit = this.temporalUnit;
arcStatusSummaryRecord.arcRecord = this.arcRecord;
arcStatusSummaryRecord.endLot = this.endLot;
arcStatusSummaryRecord.earliestLot = this.earliestLot;
arcStatusSummaryRecord.latestLot = this.latestLot;
arcStatusSummaryRecord.lastFoundLot = this.lastFoundLot;
arcStatusSummaryRecord.firstFoundLot = this.firstFoundLot;
arcStatusSummaryRecord.rangeIntervals = this.rangeIntervals;
arcStatusSummaryRecord.temporalUnit = this.temporalUnit;
return arcStatusSummaryRecord;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@
@JsonPropertyOrder({
"manifest",
"temporalUnit",
"startLot",
"firstLot",
"startGap",
"endLot",
"lastLot",
"endGap",
"intervals",
"earliest",
"earliestFound",
"earliestGap",
"latest",
"latestFound",
"latestGap",
"removed",
"partial",
"empty",
"complete",
"gaps",
"total"
"totalFound",
"range",
"rangeGap"
})
public class DatasetStatusSummaryRecord extends StatusSummaryRecord<ManifestState> {
@JsonUnwrapped
Expand Down Expand Up @@ -83,11 +83,11 @@ public int removed() {
public static final class Builder {
DatasetRecord datasetRecord;
TemporalUnit temporalUnit;
String startLot;
String endLot;
long intervals;
String firstLot;
String lastLot;
String earliestLot;
String latestLot;
long rangeIntervals;
String firstFoundLot;
String lastFoundLot;

private Builder() {
}
Expand All @@ -106,42 +106,41 @@ public Builder withTemporalUnit(TemporalUnit temporalUnit) {
return this;
}

public Builder withStartLot(String startLot) {
this.startLot = startLot;
public Builder withEarliestLot(String earliestLot) {
this.earliestLot = earliestLot;
return this;
}

public Builder withEndLot(String endLot) {
this.endLot = endLot;
public Builder withLatestLot(String latestLot) {
this.latestLot = latestLot;
return this;
}

public Builder withIntervals(long intervals) {
this.intervals = intervals;
public Builder withRangeIntervals(long rangeIntervals) {
this.rangeIntervals = rangeIntervals;
return this;
}

public Builder withFirstLot(String firstLot) {
this.firstLot = firstLot;
public Builder withFirstFoundLot(String firstFoundLot) {
this.firstFoundLot = firstFoundLot;
return this;
}

public Builder withLastLot(String lastLot) {
this.lastLot = lastLot;
public Builder withLastFoundLot(String lastFoundLot) {
this.lastFoundLot = lastFoundLot;
return this;
}

public DatasetStatusSummaryRecord build() {
DatasetStatusSummaryRecord datasetStatusSummaryRecord = new DatasetStatusSummaryRecord();
datasetStatusSummaryRecord.intervals = this.intervals;
datasetStatusSummaryRecord.earliestLot = this.earliestLot;
datasetStatusSummaryRecord.datasetRecord = this.datasetRecord;
datasetStatusSummaryRecord.latestLot = this.latestLot;
datasetStatusSummaryRecord.lastFoundLot = this.lastFoundLot;
datasetStatusSummaryRecord.firstFoundLot = this.firstFoundLot;
datasetStatusSummaryRecord.rangeIntervals = this.rangeIntervals;
datasetStatusSummaryRecord.temporalUnit = this.temporalUnit;
datasetStatusSummaryRecord.endLot = this.endLot;
datasetStatusSummaryRecord.startLot = this.startLot;
datasetStatusSummaryRecord.lastLot = this.lastLot;
datasetStatusSummaryRecord.firstLot = this.firstLot;
return datasetStatusSummaryRecord;
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -21,40 +21,44 @@

public abstract class StatusSummaryRecord<S extends State> implements Struct {
TemporalUnit temporalUnit;
String startLot;
String endLot;
long intervals;
String firstLot;
String lastLot;
String earliestLot;
String latestLot;
long rangeIntervals;
String firstFoundLot;
String lastFoundLot;

public TemporalUnit temporalUnit() {
return temporalUnit;
}

public String startLot() {
return startLot;
@JsonProperty("earliest")
public String earliestLot() {
return earliestLot;
}

public String endLot() {
return endLot;
@JsonProperty("latest")
public String latestLot() {
return latestLot;
}

public String firstLot() {
return firstLot;
@JsonProperty("earliestFound")
public String firstFoundLot() {
return firstFoundLot;
}

public String lastLot() {
return lastLot;
@JsonProperty("latestFound")
public String lastFoundLot() {
return lastFoundLot;
}

@JsonProperty("startGap")
public Integer startGap() {
return gap(startLot, firstLot);
@JsonProperty("earliestGap")
public Integer earliestGap() {
return gap(earliestLot, firstFoundLot);
}

@JsonProperty("endGap")
public Integer endGap() {
return gap(lastLot, endLot);
@JsonProperty("latestGap")
public Integer latestGap() {
return gap(lastFoundLot, latestLot);
}

private Integer gap(String lhs, String rhs) {
Expand All @@ -74,17 +78,17 @@ private Integer gap(String lhs, String rhs) {
return (int) Duration.between(begin.query(Instant::from), end.query(Instant::from)).dividedBy(temporalUnit.getDuration());
}

@JsonProperty("intervals")
public long intervals() {
return intervals;
@JsonProperty("range")
public long rangeIntervals() {
return rangeIntervals;
}

@JsonProperty("gaps")
public long gaps() {
return intervals - statesSize();
@JsonProperty("rangeGap")
public long rangeGap() {
return rangeIntervals - statesSize();
}

@JsonProperty("total")
@JsonProperty("totalFound")
public int total() {
return statesSize();
}
Expand All @@ -95,9 +99,9 @@ public int total() {

public void addStateRecord(StatusRecord<S> statusRecord) {
addState(statusRecord.state());
if (firstLot == null) {
firstLot = statusRecord.lotId();
if (firstFoundLot == null) {
firstFoundLot = statusRecord.lotId();
}
lastLot = statusRecord.lotId();
lastFoundLot = statusRecord.lotId();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ protected ArcStatusSummaryRecord createSummaryRecord(long count) {
return ArcStatusSummaryRecord.builder()
.withArcRecord(record)
.withTemporalUnit(temporalUnit)
.withStartLot(startLotInclusive)
.withEndLot(endLotInclusive)
.withIntervals(count)
.withEarliestLot(startLotInclusive)
.withLatestLot(endLotInclusive)
.withRangeIntervals(count)
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ protected Stream<DatasetStatusRecord> parseStreamIntoUri(Stream<String> resultSt
return DatasetStatusSummaryRecord.builder()
.withDatasetRecord(record)
.withTemporalUnit(temporalUnit)
.withStartLot(startLotInclusive)
.withEndLot(endLotInclusive)
.withIntervals(count)
.withEarliestLot(startLotInclusive)
.withLatestLot(endLotInclusive)
.withRangeIntervals(count)
.build();
}

Expand Down

0 comments on commit 6ede23f

Please sign in to comment.