forked from shuzijun/leetcode-editor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathQuestion.java
141 lines (105 loc) · 3.1 KB
/
Question.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
package com.shuzijun.leetcode.plugin.model;
import org.apache.commons.collections.CollectionUtils;
import java.util.List;
/**
* @author shuzijun
*/
public class Question extends QuestionView {
private String testCase;
private String exampleTestcases;
private String langSlug;
private String nodeType = Constant.NODETYPE_DEF;
/**
* 题目描述
*/
private String content;
/**
* 所有的代码片段
*/
private List<CodeSnippet> codeSnippets;
/**
* 文章类型
*/
private Integer articleLive;
/**
* 文章标识
*/
private String articleSlug;
/**
* 专栏文章
*/
private Integer columnArticles = 0;
public Question() {
super();
}
public Question(String title) {
super(title);
}
public String getTestCase() {
return testCase;
}
public void setTestCase(String testCase) {
this.testCase = testCase;
}
public String getExampleTestcases() {
return exampleTestcases;
}
public void setExampleTestcases(String exampleTestcases) {
this.exampleTestcases = exampleTestcases;
}
public String getNodeType() {
return nodeType;
}
public void setNodeType(String nodeType) {
this.nodeType = nodeType;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public void setLangSlug(String langSlug) {
this.langSlug = langSlug;
}
public String getCode() {
if (CollectionUtils.isEmpty(codeSnippets)) {
return "Subscribe to unlock.";
}
CodeTypeEnum codeType = CodeTypeEnum.getCodeTypeEnumByLangSlug(langSlug);
for (CodeSnippet codeSnippet : codeSnippets) {
if (codeType.getLangSlug().equals(codeSnippet.getLangSlug())) {
StringBuffer sb = new StringBuffer();
// sb.append(codeType.getComment()).append(Constant.SUBMIT_REGION_BEGIN).append("\n");
sb.append(codeSnippet.getCode()).append("\n");
// sb.append(codeType.getComment()).append(Constant.SUBMIT_REGION_END).append("\n");
return sb.toString();
}
}
return codeType.getComment() + "There is no code of " + codeType.getType() + " type for this problem";
}
public List<CodeSnippet> getCodeSnippets() {
return codeSnippets;
}
public void setCodeSnippets(List<CodeSnippet> codeSnippets) {
this.codeSnippets = codeSnippets;
}
public Integer getArticleLive() {
return articleLive;
}
public void setArticleLive(Integer articleLive) {
this.articleLive = articleLive;
}
public String getArticleSlug() {
return articleSlug;
}
public void setArticleSlug(String articleSlug) {
this.articleSlug = articleSlug;
}
public Integer getColumnArticles() {
return columnArticles;
}
public void setColumnArticles(Integer columnArticles) {
this.columnArticles = columnArticles;
}
}