-
Notifications
You must be signed in to change notification settings - Fork 674
Expand file tree
/
Copy pathModifyModel.java
More file actions
55 lines (43 loc) · 1.33 KB
/
ModifyModel.java
File metadata and controls
55 lines (43 loc) · 1.33 KB
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
package com.gitblit.markdown;
/**
* Created by Yuriy Aizenberg
*/
public class ModifyModel {
private static final String PATTERN = "%s- [%s](#%s)";
private static final String AFFIX = " ";
private int currentDeepLevel = 1;
private String headerName;
private String headerLink;
public ModifyModel(int currentDeepLevel, String headerName, String headerLink) {
this.currentDeepLevel = currentDeepLevel;
this.headerName = headerName;
this.headerLink = headerLink;
}
public int getCurrentDeepLevel() {
return currentDeepLevel;
}
public void setCurrentDeepLevel(int currentDeepLevel) {
this.currentDeepLevel = currentDeepLevel;
}
public String getHeaderName() {
return headerName;
}
public void setHeaderName(String headerName) {
this.headerName = headerName;
}
public String getHeaderLink() {
return headerLink;
}
public void setHeaderLink(String headerLink) {
this.headerLink = headerLink;
}
public String create() {
String affixs = "";
if (currentDeepLevel > 1) {
for (int i = 0; i < currentDeepLevel - 1; i++) {
affixs += AFFIX;
}
}
return String.format(PATTERN, affixs, headerName, headerLink);
}
}