OSDN Git Service

config値を読んで投稿者コメントのみ取得するかどうかを決定する
[coroid/inqubus.git] / frontend / src / yukihane / inqubus / config / ConfigCommentProfile.java
1 package yukihane.inqubus.config;
2
3 import java.io.File;
4 import saccubus.worker.profile.CommentProfile;
5
6 /**
7  * コンフィグに設定された値を基にしたCommentProfile実装.
8  * @author yuki
9  */
10 public class ConfigCommentProfile implements CommentProfile {
11
12     private final int lengthRelatedCommentSize;
13     private final int perMinCommentSize;
14     private final boolean disablePerMinComment;
15     private final long backLogPoint;
16     private final boolean download;
17     private final boolean ownerCommentOnly;
18     private final File dir;
19     private final String fileName;
20
21     public ConfigCommentProfile() {
22         final Config p = Config.INSTANCE;
23         this.lengthRelatedCommentSize = (p.getCommentSizeAutosize()) ? -1 : Integer.parseInt(p.getCommentSizeManual());
24         this.perMinCommentSize = (p.getCommentMinSizeAutosize()) ? -1 : Integer.parseInt(p.getCommentMinSizeManual());
25         this.disablePerMinComment = p.getCommentMinDisabled();
26         this.backLogPoint = -1L;
27         this.download = !p.getCommentUseLocal();
28         this.ownerCommentOnly = p.getCommentOwnerOnly();
29         this.dir = new File(p.getCommentDir());
30         this.fileName = p.getCommentFileNamePattern();
31     }
32
33     @Override
34     public int getLengthRelatedCommentSize() {
35         return lengthRelatedCommentSize;
36     }
37
38     @Override
39     public boolean isDisablePerMinComment() {
40         return disablePerMinComment;
41     }
42
43     @Override
44     public int getPerMinCommentSize() {
45         return perMinCommentSize;
46     }
47
48     @Override
49     public long getBackLogPoint() {
50         return backLogPoint;
51     }
52
53     @Override
54     public boolean isOwnerCommentOnly() {
55         return ownerCommentOnly;
56     }
57
58     @Override
59     public boolean isDownload() {
60         return download;
61     }
62
63     @Override
64     public File getDir() {
65         return dir;
66     }
67
68     @Override
69     public String getFileName() {
70         return fileName;
71     }
72
73     @Override
74     public File getLocalFile() {
75         return getDir();
76     }
77 }