Skip to content

Commit 65287d0

Browse files
author
Zihlu Wang
committed
refactor: Optimsed comments.
1 parent 5895557 commit 65287d0

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

webcal/src/main/java/cn/org/codecrafters/webcal/impl/WebCalendarEvent.java

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -267,24 +267,24 @@ public String resolve() {
267267
DURATION:PT{6}S
268268
{4}{5}{7}{8}{9}{10}{11}{12}
269269
END:{0}""",
270-
TAG, // 0 - tag
271-
Optional.ofNullable(uid).orElse(UUID.randomUUID().toString()) + "@" + domainName, // 1 - uid
272-
now.format(DateAndTimeFormatter.getUtcDatetimeFormatter()), // 2 - dtstamp
273-
start.atZone(ZoneId.systemDefault()).format(DateAndTimeFormatter.getUtcDatetimeFormatter()), // 3 - start time
274-
Optional.ofNullable(summary).map((item) -> "\nSUMMARY:" + item).orElse(""), // 4 - summary
275-
Optional.ofNullable(categories)
276-
.map((item) -> !item.isEmpty() ? "\nCATEGORIES:" + resolveCategories() : null).orElse(""), // 5 - categories
277-
Optional.ofNullable(duration)
270+
/* 0 - tag */TAG,
271+
/* 1 - uid */ Optional.ofNullable(uid).orElse(UUID.randomUUID().toString()) + "@" + domainName,
272+
/* 2 - dtstamp */ now.format(DateAndTimeFormatter.getUtcDatetimeFormatter()),
273+
/* 3 - start time */ start.atZone(ZoneId.systemDefault()).format(DateAndTimeFormatter.getUtcDatetimeFormatter()),
274+
/* 4 - summary */ Optional.ofNullable(summary).map((item) -> "\nSUMMARY:" + item).orElse(""),
275+
/* 5 - categories */ Optional.ofNullable(categories)
276+
.map((item) -> !item.isEmpty() ? "\nCATEGORIES:" + resolveCategories() : null).orElse(""),
277+
/* 6 - duration */ Optional.ofNullable(duration)
278278
.map((_duration) -> String.valueOf(_duration.getSeconds()))
279279
.orElse(Optional.ofNullable(end)
280280
.map((_end) -> String.valueOf(Duration.between(_end, start).getSeconds()))
281-
.orElse("0")), // 6 - duration
282-
Optional.ofNullable(classification).map((_classification) -> "\nCLASS:" + _classification + "\n").orElse(""), /* 7 - classification */
283-
Optional.ofNullable(comment).map((_comment) -> "\nCOMMENT:" + _comment + "\n").orElse(""), /* 8 - comment */
284-
Optional.ofNullable(location).map((_location) -> "\nLOCATION:" + _location).orElse("") /* 9 - location */,
285-
Optional.ofNullable(percentComplete).map((_percentComplete) -> "\nPERCENT-COMPLETE:" + _percentComplete).orElse("") /* 10 = percentComplete */,
286-
Optional.ofNullable(description).map((_description) -> "\nDESCRIPTION:" + _description).orElse("") /* 11 - description */,
287-
Optional.ofNullable(priority).map((_priority) -> "\nPRIORITY:" + _priority).orElse("") /* 12 - priority */
281+
.orElse("0")),
282+
/* 7 - classification */ Optional.ofNullable(classification).map((_classification) -> "\nCLASS:" + _classification + "\n").orElse(""),
283+
/* 8 - comment */ Optional.ofNullable(comment).map((_comment) -> "\nCOMMENT:" + _comment + "\n").orElse(""),
284+
/* 9 - location */ Optional.ofNullable(location).map((_location) -> "\nLOCATION:" + _location).orElse(""),
285+
/* 10 = percentComplete */ Optional.ofNullable(percentComplete).map((_percentComplete) -> "\nPERCENT-COMPLETE:" + _percentComplete).orElse(""),
286+
/* 11 - description */ Optional.ofNullable(description).map((_description) -> "\nDESCRIPTION:" + _description).orElse(""),
287+
/* 12 - priority */ Optional.ofNullable(priority).map((_priority) -> "\nPRIORITY:" + _priority).orElse("")
288288
);
289289
}
290290

0 commit comments

Comments
 (0)