Skip to content

Method: setDoubleAttribute(Double)

1: /**
2: * Copyright (C) 2016 Czech Technical University in Prague
3: *
4: * This program is free software: you can redistribute it and/or modify it under
5: * the terms of the GNU General Public License as published by the Free Software
6: * Foundation, either version 3 of the License, or (at your option) any
7: * later version.
8: *
9: * This program is distributed in the hope that it will be useful, but WITHOUT
10: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11: * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12: * details. You should have received a copy of the GNU General Public License
13: * along with this program. If not, see <http://www.gnu.org/licenses/>.
14: */
15: package cz.cvut.kbss.jopa.test;
16:
17: import cz.cvut.kbss.jopa.model.annotations.Id;
18: import cz.cvut.kbss.jopa.model.annotations.OWLClass;
19: import cz.cvut.kbss.jopa.model.annotations.OWLDataProperty;
20: import cz.cvut.kbss.jopa.test.environment.Generators;
21:
22: import java.util.Date;
23: import java.util.Set;
24: import java.util.stream.Collectors;
25: import java.util.stream.IntStream;
26:
27: /**
28: * Contains a generated string URI and data property attributes of primitive wrapper types
29: * - boolean, int, long, double and date.
30: */
31: @OWLClass(iri = Vocabulary.c_OwlClassM)
32: public class OWLClassM {
33:
34: @Id(generated = true)
35: private String key;
36:
37: @OWLDataProperty(iri = Vocabulary.p_m_booleanAttribute)
38: private Boolean booleanAttribute;
39:
40: @OWLDataProperty(iri = Vocabulary.p_m_intAttribute)
41: private Integer intAttribute;
42:
43: @OWLDataProperty(iri = Vocabulary.p_m_longAttribute)
44: private Long longAttribute;
45:
46: @OWLDataProperty(iri = Vocabulary.p_m_doubleAttribute)
47: private Double doubleAttribute;
48:
49: @OWLDataProperty(iri = Vocabulary.p_m_dateAttribute)
50: private Date dateAttribute;
51:
52: @OWLDataProperty(iri = Vocabulary.p_m_enumAttribute)
53: private Severity enumAttribute;
54:
55: @OWLDataProperty(iri = Vocabulary.p_m_IntegerSet)
56: private Set<Integer> integerSet;
57:
58: public enum Severity {
59: LOW, MEDIUM, HIGH
60: }
61:
62: public String getKey() {
63: return key;
64: }
65:
66: public void setKey(String key) {
67: this.key = key;
68: }
69:
70: public Boolean getBooleanAttribute() {
71: return booleanAttribute;
72: }
73:
74: public void setBooleanAttribute(Boolean booleanAttribute) {
75: this.booleanAttribute = booleanAttribute;
76: }
77:
78: public Integer getIntAttribute() {
79: return intAttribute;
80: }
81:
82: public void setIntAttribute(Integer intAttribute) {
83: this.intAttribute = intAttribute;
84: }
85:
86: public Long getLongAttribute() {
87: return longAttribute;
88: }
89:
90: public void setLongAttribute(Long longAttribute) {
91: this.longAttribute = longAttribute;
92: }
93:
94: public Double getDoubleAttribute() {
95: return doubleAttribute;
96: }
97:
98: public void setDoubleAttribute(Double doubleAttribute) {
99: this.doubleAttribute = doubleAttribute;
100: }
101:
102: public Date getDateAttribute() {
103: return dateAttribute;
104: }
105:
106: public void setDateAttribute(Date dateAttribute) {
107: this.dateAttribute = dateAttribute;
108: }
109:
110: public Severity getEnumAttribute() {
111: return enumAttribute;
112: }
113:
114: public void setEnumAttribute(Severity enumAttribute) {
115: this.enumAttribute = enumAttribute;
116: }
117:
118: public Set<Integer> getIntegerSet() {
119: return integerSet;
120: }
121:
122: public void setIntegerSet(Set<Integer> integerSet) {
123: this.integerSet = integerSet;
124: }
125:
126: @Override
127: public String toString() {
128: return "OWLCLassM{" +
129: "key='" + key + '\'' +
130: ", booleanAttribute=" + booleanAttribute +
131: ", intAttribute=" + intAttribute +
132: ", longAttribute=" + longAttribute +
133: ", doubleAttribute=" + doubleAttribute +
134: ", enumAttribute=" + enumAttribute +
135: ", integerSet=" + integerSet +
136: '}';
137: }
138:
139: public void initializeTestValues(boolean includingKey) {
140: if (includingKey) {
141: this.key = "http://krizik.felk.cvut.cz/ontologies/entityM";
142: }
143: this.booleanAttribute = true;
144: this.intAttribute = 117;
145: this.longAttribute = 365L;
146: this.doubleAttribute = 3.14D;
147: this.dateAttribute = new Date();
148: this.enumAttribute = Severity.MEDIUM;
149: this.integerSet = IntStream.generate(Generators::randomInt).limit(10).boxed().collect(Collectors.toSet());
150: }
151: }