OSDN Git Service

33838c26635da22d6d662be03cf4a93c820dbbe7
[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 File dir;
18     private final String fileName;
19
20     public ConfigCommentProfile() {
21         final Config p = Config.INSTANCE;
22         this.lengthRelatedCommentSize = (p.getCommentSizeAutosize()) ? -1 : Integer.parseInt(p.getCommentSizeManual());
23         this.perMinCommentSize = (p.getCommentMinSizeAutosize()) ? -1 : Integer.parseInt(p.getCommentMinSizeManual());
24         this.disablePerMinComment = p.getCommentMinDisabled();
25         this.backLogPoint = -1L;
26         this.download = !p.getCommentUseLocal();
27         this.dir = new File(p.getCommentDir());
28         this.fileName = p.getCommentFileNamePattern();
29     }
30
31     @Override
32     public int getLengthRelatedCommentSize() {
33         return lengthRelatedCommentSize;
34     }
35
36     @Override
37     public boolean isDisablePerMinComment() {
38         return disablePerMinComment;
39     }
40
41     @Override
42     public int getPerMinCommentSize() {
43         return perMinCommentSize;
44     }
45
46     @Override
47     public long getBackLogPoint() {
48         return backLogPoint;
49     }
50
51     @Override
52     public boolean isOwnerCommentOnly() {
53         return false;
54     }
55
56     @Override
57     public boolean isDownload() {
58         return download;
59     }
60
61     @Override
62     public File getDir() {
63         return dir;
64     }
65
66     @Override
67     public String getFileName() {
68         return fileName;
69     }
70
71     @Override
72     public File getLocalFile() {
73         return getDir();
74     }
75 }