summaryrefslogtreecommitdiffstats
path: root/src/de/fhswf/in/inf/se/notepadMinusMinus/model/Grade.java
blob: 9758e6a02cde6a9fd90f6ed057a76a07c491d7b7 (plain)
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
/**
 * 
 */
package de.fhswf.in.inf.se.notepadMinusMinus.model;

import java.math.BigDecimal;

import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlValue;

import javafx.beans.Observable;
import javafx.beans.property.IntegerProperty;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.util.Callback;

/**
 * TODO Add comment here
 *
 * @author $Author: $
 * @version $Revision: $, $Date: $ UTC
 */
@XmlRootElement(name = "grade")
public class Grade
{
   private static ObservableList<BigDecimal> gradeValues;

   private IntegerProperty semester = new SimpleIntegerProperty(1);

   private StringProperty modulename = new SimpleStringProperty(
         "Neues Modul");

   private IntegerProperty ects = new SimpleIntegerProperty(0);

   private ObjectProperty<BigDecimal> grade = new SimpleObjectProperty<>(
         new BigDecimal("0.0"));

   private IntegerProperty attempt = new SimpleIntegerProperty(1);

   /**
    * TODO Add method comment here
    *
    * @return
    */
   public static Callback<Grade, Observable[]> extractor()
   {
      return (Grade grade) -> new Observable[] { grade.semesterProperty(),
            grade.modulenameProperty(), grade.ectsProperty(),
            grade.gradeProperty(), grade.attemptProperty() };
   }

   /**
    * TODO Add method comment here
    *
    * @return
    */
   public final IntegerProperty semesterProperty()
   {
      return this.semester;
   }

   /**
    * TODO Add method comment here
    *
    * @return
    */
   @XmlAttribute(name = "semester")
   public final int getSemester()
   {
      return this.semesterProperty().get();
   }

   /**
    * TODO Add method comment here
    *
    * @param semester
    */
   public final void setSemester(final int semester)
   {
      this.semesterProperty().set(semester);
   }

   /**
    * TODO Add method comment here
    *
    * @return
    */
   public final StringProperty modulenameProperty()
   {
      return this.modulename;
   }

   /**
    * TODO Add method comment here
    *
    * @return
    */
   @XmlAttribute(name = "modulename", required = true)
   public final String getModulename()
   {
      return this.modulenameProperty().get();
   }

   /**
    * TODO Add method comment here
    *
    * @param modulename
    */
   public final void setModulename(final java.lang.String modulename)
   {
      this.modulenameProperty().set(modulename);
   }

   /**
    * TODO Add method comment here
    *
    * @return
    */
   public final IntegerProperty ectsProperty()
   {
      return this.ects;
   }

   /**
    * TODO Add method comment here
    *
    * @return
    */
   @XmlAttribute(name = "ects")
   public final int getEcts()
   {
      return this.ectsProperty().get();
   }

   /**
    * TODO Add method comment here
    *
    * @param ects
    */
   public final void setEcts(final int ects)
   {
      this.ectsProperty().set(ects);
   }

   /**
    * TODO Add method comment here
    *
    * @return
    */
   public final ObjectProperty<BigDecimal> gradeProperty()
   {
      return this.grade;
   }

   /**
    * TODO Add method comment here
    *
    * @return
    */
   @XmlValue
   public final BigDecimal getGrade()
   {
      return this.gradeProperty().get();
   }

   /**
    * TODO Add method comment here
    *
    * @param grade
    */
   public final void setGrade(final BigDecimal grade)
   {
      this.gradeProperty().set(grade);
   }

   /**
    * TODO Add method comment here
    *
    * @return
    */
   public final IntegerProperty attemptProperty()
   {
      return this.attempt;
   }

   /**
    * TODO Add method comment here
    *
    * @return
    */
   @XmlAttribute(name = "attempt")
   public final int getAttempt()
   {
      return this.attemptProperty().get();
   }

   /**
    * TODO Add method comment here
    *
    * @param attempt
    */
   public final void setAttempt(final int attempt)
   {
      this.attemptProperty().set(attempt);
   }

   /**
    * TODO Add method comment here
    *
    * @return
    */
   public static final ObservableList<BigDecimal> gradeValuesProperty()
   {
      if (gradeValues == null)
      {
         gradeValues = FXCollections.observableArrayList();

         gradeValues.add(new BigDecimal("0.0"));
         gradeValues.add(new BigDecimal("1.0"));
         gradeValues.add(new BigDecimal("1.3"));
         gradeValues.add(new BigDecimal("1.7"));
         gradeValues.add(new BigDecimal("2.0"));
         gradeValues.add(new BigDecimal("2.3"));
         gradeValues.add(new BigDecimal("2.7"));
         gradeValues.add(new BigDecimal("3.0"));
         gradeValues.add(new BigDecimal("3.3"));
         gradeValues.add(new BigDecimal("3.7"));
         gradeValues.add(new BigDecimal("4.0"));
      }

      return FXCollections.unmodifiableObservableList(gradeValues);
   }
}