2 package saccubus.properties;
5 import java.util.Properties;
11 public class InputCommentSetting extends InputFileSetting<Boolean> {
14 private static final String PROP_SAVE_COMMENT = "SaveCommentFile";
15 /** 変換後にコメントファイルを削除する. */
16 private static final String PROP_DEL_COMMENT_AFTER_CONV = "DeleteCommentAfterConv";
17 /** コメント取得数は自動で調整する. */
18 private static final String PROP_FIX_COMMENT_NUM = "FixCommentSize";
20 private static final String PROP_BACK_COMMENT = "BackComment";
21 /** フォルダ/ファイル保存選択ラジオボタン. */
22 private static final String PROP_COMMENT_FIX_FILE_NAME = "CommentFixFileName";
24 private static final String PROP_COMMENT_FOLDER = "CommentFixFileNameFolder";
26 private static final String PROP_COMMENT_FILE = "CommentFile";
27 private final boolean selfAdjustNumOfComment;
28 private final int numOfComment;
29 private final boolean reduceComment;
30 private final String backLogPoint;
32 public InputCommentSetting(boolean download, boolean autoNaming, File folder, File file, boolean deleteAfterConvert,
33 boolean adjust, int numOfCom, boolean reduceComment, String backLogPoint) {
34 super(Boolean.valueOf(download), autoNaming, folder, file, deleteAfterConvert);
35 this.selfAdjustNumOfComment = adjust;
36 this.numOfComment = numOfCom;
37 this.reduceComment = reduceComment;
38 this.backLogPoint = backLogPoint;
42 public void save(Properties prop) {
43 prop.setProperty(PROP_SAVE_COMMENT, getProcessKind().toString());
44 prop.setProperty(PROP_DEL_COMMENT_AFTER_CONV, Boolean.toString(isDeleteAfterConvert()));
45 prop.setProperty(PROP_FIX_COMMENT_NUM, Boolean.toString(isSelfAdjustNumOfComment()));
46 prop.setProperty(PROP_BACK_COMMENT, Integer.toString(getNumOfComment()));
47 prop.setProperty(PROP_COMMENT_FIX_FILE_NAME, Boolean.toString(isAutoNaming()));
48 prop.setProperty(PROP_COMMENT_FOLDER, getFolder().getPath());
49 prop.setProperty(PROP_COMMENT_FILE, getFile().getPath());
53 public static InputCommentSetting load(Properties prop) {
54 boolean download = Boolean.parseBoolean(prop.getProperty(PROP_SAVE_COMMENT, "true"));
55 boolean delete = Boolean.parseBoolean(prop.getProperty(PROP_DEL_COMMENT_AFTER_CONV, "false"));
56 boolean adjustNumOfComment = Boolean.parseBoolean(prop.getProperty(PROP_FIX_COMMENT_NUM, "true"));
57 String numOfComment = prop.getProperty(PROP_BACK_COMMENT, "500");
58 boolean autoNaming = Boolean.parseBoolean(prop.getProperty(PROP_COMMENT_FIX_FILE_NAME, "true"));
59 String folder = prop.getProperty(PROP_COMMENT_FOLDER, "out/comment");
60 String file = prop.getProperty(PROP_COMMENT_FILE, "comment.xml");
62 return new InputCommentSetting(download, autoNaming, new File(folder), new File(file), delete,
64 Integer.parseInt(numOfComment), false, "");
67 public final boolean isSelfAdjustNumOfComment() {
68 return selfAdjustNumOfComment;
71 public final int getNumOfComment() {
75 public boolean isReduceComment(){
79 public String getBackLogPoint() {