-
Notifications
You must be signed in to change notification settings - Fork 2
/
TemporalEntity.java
156 lines (120 loc) · 4.39 KB
/
TemporalEntity.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
package cz.cvut.kbss.jsonld.environment.model;
import cz.cvut.kbss.jopa.model.annotations.OWLClass;
import cz.cvut.kbss.jopa.model.annotations.OWLDataProperty;
import cz.cvut.kbss.jsonld.environment.Generator;
import cz.cvut.kbss.jsonld.environment.Vocabulary;
import java.time.*;
import java.util.Date;
@OWLClass(iri = Vocabulary.DEFAULT_PREFIX + "temporal-entity")
public class TemporalEntity {
@OWLDataProperty(iri = Vocabulary.DEFAULT_PREFIX + "local-date-time")
private LocalDateTime localDateTime;
@OWLDataProperty(iri = Vocabulary.DEFAULT_PREFIX + "offset-date-time")
private OffsetDateTime offsetDateTime;
@OWLDataProperty(iri = Vocabulary.DEFAULT_PREFIX + "zoned-date-time")
private ZonedDateTime zonedDateTime;
@OWLDataProperty(iri = Vocabulary.DEFAULT_PREFIX + "instant")
private Instant instant;
@OWLDataProperty(iri = Vocabulary.DEFAULT_PREFIX + "timestamp")
private Date timestamp;
@OWLDataProperty(iri = Vocabulary.DEFAULT_PREFIX + "local-date")
private LocalDate localDate;
@OWLDataProperty(iri = Vocabulary.DEFAULT_PREFIX + "offset-time")
private OffsetTime offsetTime;
@OWLDataProperty(iri = Vocabulary.DEFAULT_PREFIX + "local-time")
private LocalTime localTime;
@OWLDataProperty(iri = Vocabulary.DEFAULT_PREFIX + "period")
private Period period;
@OWLDataProperty(iri = Vocabulary.DEFAULT_PREFIX + "duration")
private Duration duration;
public void initTemporalAccessorValues() {
this.offsetDateTime = OffsetDateTime.now();
this.localDateTime = offsetDateTime.toLocalDateTime();
this.zonedDateTime = offsetDateTime.toZonedDateTime();
this.instant = offsetDateTime.toInstant();
this.timestamp = Date.from(instant);
this.localDate = offsetDateTime.toLocalDate();
this.offsetTime = offsetDateTime.toOffsetTime();
this.localTime = offsetTime.toLocalTime();
}
public void initTemporalAmountValues() {
this.period =
Period.of(Generator.randomCount(2, 100), Generator.randomCount(1, 12), Generator.randomCount(1, 28));
this.duration = Duration.ofSeconds(Generator.randomCount(5, 10000));
}
public LocalDateTime getLocalDateTime() {
return localDateTime;
}
public void setLocalDateTime(LocalDateTime localDateTime) {
this.localDateTime = localDateTime;
}
public OffsetDateTime getOffsetDateTime() {
return offsetDateTime;
}
public void setOffsetDateTime(OffsetDateTime offsetDateTime) {
this.offsetDateTime = offsetDateTime;
}
public ZonedDateTime getZonedDateTime() {
return zonedDateTime;
}
public void setZonedDateTime(ZonedDateTime zonedDateTime) {
this.zonedDateTime = zonedDateTime;
}
public Instant getInstant() {
return instant;
}
public void setInstant(Instant instant) {
this.instant = instant;
}
public Date getTimestamp() {
return timestamp;
}
public void setTimestamp(Date timestamp) {
this.timestamp = timestamp;
}
public LocalDate getLocalDate() {
return localDate;
}
public void setLocalDate(LocalDate localDate) {
this.localDate = localDate;
}
public OffsetTime getOffsetTime() {
return offsetTime;
}
public void setOffsetTime(OffsetTime offsetTime) {
this.offsetTime = offsetTime;
}
public LocalTime getLocalTime() {
return localTime;
}
public void setLocalTime(LocalTime localTime) {
this.localTime = localTime;
}
public Period getPeriod() {
return period;
}
public void setPeriod(Period period) {
this.period = period;
}
public Duration getDuration() {
return duration;
}
public void setDuration(Duration duration) {
this.duration = duration;
}
@Override
public String toString() {
return "TemporalEntity{" +
"localDateTime=" + localDateTime +
", offsetDateTime=" + offsetDateTime +
", zonedDateTime=" + zonedDateTime +
", instant=" + instant +
", timestamp=" + timestamp +
", localDate=" + localDate +
", offsetTime=" + offsetTime +
", localTime=" + localTime +
", period=" + period +
", duration=" + duration +
'}';
}
}