Skip to content

Commit 21bbc67

Browse files
committed
Documentation was added
1 parent 1f561b9 commit 21bbc67

4 files changed

Lines changed: 40 additions & 14 deletions

File tree

src/com/temporaryteam/noticeditor/controller/NoticeSettingsController.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ public void initialize(URL url, ResourceBundle rb) {
6060
open(null);
6161
}
6262

63+
/**
64+
* Updates items (statuses) in choice box
65+
*/
6366
public void updateStatuses() {
6467
choiceBoxNoticeStatus.setItems(NoticeStatusList.asObservable());
6568
}

src/com/temporaryteam/noticeditor/io/JsonFormat.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import com.temporaryteam.noticeditor.model.*;
55
import java.io.File;
66
import java.io.IOException;
7-
import java.util.Iterator;
87
import javafx.scene.control.TreeItem;
98
import org.json.JSONArray;
109
import org.json.JSONException;

src/com/temporaryteam/noticeditor/model/NoticeStatus.java

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,37 @@
1-
/*
2-
* To change this license header, choose License Headers in Project Properties.
3-
* To change this template file, choose Tools | Templates
4-
* and open the template in the editor.
5-
*/
61
package com.temporaryteam.noticeditor.model;
72

83
/**
9-
*
4+
* Representation of notice status
105
* @author Maximillian M.
116
*/
127
public class NoticeStatus {
138
private String name;
149
private int code;
1510

11+
/**
12+
* Instantiates notice status
13+
* @param name Status name
14+
* @param code Status code
15+
*/
1616
public NoticeStatus(String name, int code) {
1717
this.name = name;
1818
this.code = code;
1919
}
20-
20+
21+
/**
22+
* @return Status code
23+
*/
2124
public int getCode() {
2225
return code;
2326
}
27+
2428
public void setCode(int code) {
2529
this.code = code;
2630
}
31+
32+
/**
33+
* @return Status name
34+
*/
2735
public String getName() {
2836
return name;
2937
}

src/com/temporaryteam/noticeditor/model/NoticeStatusList.java

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
1-
/*
2-
* To change this license header, choose License Headers in Project Properties.
3-
* To change this template file, choose Tools | Templates
4-
* and open the template in the editor.
5-
*/
61
package com.temporaryteam.noticeditor.model;
72

83
import java.util.ArrayList;
9-
import java.util.stream.Collectors;
104
import javafx.collections.FXCollections;
115
import javafx.collections.ObservableList;
126

@@ -42,27 +36,49 @@ public static void restore() {
4236
lastIndex = mementoLastIndex;
4337
}
4438

39+
/**
40+
* Adds new status with next status code
41+
* @param statusName Status name
42+
*/
4543
public static void add(String statusName) {
4644
++lastIndex;
4745
NoticeStatus newStatus = new NoticeStatus(statusName, lastIndex);
4846
list.add(newStatus);
4947
}
5048

49+
/**
50+
* Adds new status with specified status code
51+
* @param statusName Status name
52+
* @param statusCode Status code
53+
*/
5154
public static void add(String statusName, int statusCode) {
5255
lastIndex = (lastIndex < statusCode) ? statusCode : lastIndex + 1;
5356
NoticeStatus newStatus = new NoticeStatus(statusName, statusCode);
5457
list.add(newStatus);
5558
}
5659

60+
/**
61+
* Clears status list
62+
*/
5763
public static void clear() {
5864
list = new ArrayList<>();
5965
}
6066

67+
/**
68+
* Returns status by code
69+
* @param statusCode Status code
70+
* @return Status
71+
*/
6172
public static NoticeStatus getStatus(int statusCode) {
6273
NoticeStatus foo = list.stream().filter(status -> status.getCode() == statusCode).findFirst().orElse(list.get(0));
6374
return foo;
6475
}
6576

77+
/**
78+
* Returns status code by name
79+
* @param statusName Status name
80+
* @return Status code
81+
*/
6682
public static int getStatusCode(String statusName) {
6783
for (NoticeStatus status : list) {
6884
if (status.getName().equals(statusName)) {

0 commit comments

Comments
 (0)