OSDN Git Service

ConfigからProfileを生成するためのデフォルト実装クラス
[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 user
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         // TODO disablePerMinComment がデフォルト設定値に無い
25         this.disablePerMinComment = false;
26         this.backLogPoint = -1L;
27         this.download = !p.getCommentUseLocal();
28         this.dir = new File(p.getCommentDir());
29         this.fileName = p.getCommentFileNamePattern();
30     }
31
32     @Override
33     public int getLengthRelatedCommentSize() {
34         return lengthRelatedCommentSize;
35     }
36
37     @Override
38     public boolean isDisablePerMinComment() {
39         return disablePerMinComment;
40     }
41
42     @Override
43     public int getPerMinCommentSize() {
44         return perMinCommentSize;
45     }
46
47     @Override
48     public long getBackLogPoint() {
49         return backLogPoint;
50     }
51
52     @Override
53     public boolean isDownload() {
54         return download;
55     }
56
57     @Override
58     public File getDir() {
59         return dir;
60     }
61
62     @Override
63     public String getFileName() {
64         return fileName;
65     }
66
67     @Override
68     public File getLocalFile() {
69         return getDir();
70     }
71 }