From 609178138e361bcc4d8938ae46e5a2b4ae9ace5b Mon Sep 17 00:00:00 2001 From: yukihane Date: Wed, 21 Sep 2011 16:18:37 +0900 Subject: [PATCH] =?utf8?q?CommentType=E3=82=92=E5=88=A5=E3=83=95=E3=82=A1?= =?utf8?q?=E3=82=A4=E3=83=AB=E3=81=AB=E5=88=87=E3=82=8A=E5=87=BA=E3=81=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- frontend/src/saccubus/conv/CommentType.java | 47 ++++++++++++++++++++++ frontend/src/saccubus/conv/ConvertToVideoHook.java | 4 +- frontend/src/saccubus/conv/NicoXMLReader.java | 46 --------------------- .../src/saccubus/worker/impl/convert/Convert.java | 2 +- 4 files changed, 50 insertions(+), 49 deletions(-) create mode 100644 frontend/src/saccubus/conv/CommentType.java diff --git a/frontend/src/saccubus/conv/CommentType.java b/frontend/src/saccubus/conv/CommentType.java new file mode 100644 index 0000000..7f2e587 --- /dev/null +++ b/frontend/src/saccubus/conv/CommentType.java @@ -0,0 +1,47 @@ +package saccubus.conv; + +/** + * 処理するコメントの種別. + */ +public enum CommentType { + + /** 通常のコメント. */ + NORMAL(false, false), + /** 投稿者コメント. */ + OWNER(true, false), + /** オプショナルスレッドコメント. */ + OPTIONAL(false, true), + /** オプショナルスレッド投稿者コメント. */ + OPTIONAL_OWNER(true, true); + private final boolean owner; + private final boolean optional; + + private CommentType(boolean owner, boolean optional) { + this.owner = owner; + this.optional = optional; + } + + static CommentType valueOf(boolean owner, boolean optional) { + if (!optional) { + if (!owner) { + return NORMAL; + } else { + return OWNER; + } + } else { + if (!owner) { + return OPTIONAL; + } else { + return OPTIONAL_OWNER; + } + } + } + + boolean isOwner() { + return owner; + } + + boolean isOptional() { + return optional; + } +} diff --git a/frontend/src/saccubus/conv/ConvertToVideoHook.java b/frontend/src/saccubus/conv/ConvertToVideoHook.java index cb4d860..d78d44a 100644 --- a/frontend/src/saccubus/conv/ConvertToVideoHook.java +++ b/frontend/src/saccubus/conv/ConvertToVideoHook.java @@ -33,10 +33,10 @@ public final class ConvertToVideoHook { @Deprecated public static void convert(File file, File out, String ng_id, String ng_word) throws IOException { - convert(EnumSet.allOf(NicoXMLReader.CommentType.class), file, out, ng_id, ng_word); + convert(EnumSet.allOf(CommentType.class), file, out, ng_id, ng_word); } - public static void convert(Set types, File file, File out, String ng_id, String ng_word) + public static void convert(Set types, File file, File out, String ng_id, String ng_word) throws IOException { try { final Packet packet = new Packet(); diff --git a/frontend/src/saccubus/conv/NicoXMLReader.java b/frontend/src/saccubus/conv/NicoXMLReader.java index 2c4f0c4..075bcc4 100644 --- a/frontend/src/saccubus/conv/NicoXMLReader.java +++ b/frontend/src/saccubus/conv/NicoXMLReader.java @@ -41,52 +41,6 @@ public class NicoXMLReader extends DefaultHandler { private boolean itemKicked; /** - * 処理するコメントの種別. - */ - public enum CommentType { - - /** 通常のコメント. */ - NORMAL(false, false), - /** 投稿者コメント. */ - OWNER(true, false), - /** オプショナルスレッドコメント. */ - OPTIONAL(false, true), - /** オプショナルスレッド投稿者コメント. */ - OPTIONAL_OWNER(true, true); - private final boolean owner; - private final boolean optional; - - private CommentType(boolean owner, boolean optional) { - this.owner = owner; - this.optional = optional; - } - - static CommentType valueOf(boolean owner, boolean optional) { - if (!optional) { - if (!owner) { - return NORMAL; - } else { - return OWNER; - } - } else { - if (!owner) { - return OPTIONAL; - } else { - return OPTIONAL_OWNER; - } - } - } - - boolean isOwner() { - return owner; - } - - boolean isOptional() { - return optional; - } - } - - /** * コンストラクタ. * @param types 処理するコメントの種別. * @param packet diff --git a/frontend/src/saccubus/worker/impl/convert/Convert.java b/frontend/src/saccubus/worker/impl/convert/Convert.java index 2083f71..b8449f3 100644 --- a/frontend/src/saccubus/worker/impl/convert/Convert.java +++ b/frontend/src/saccubus/worker/impl/convert/Convert.java @@ -19,7 +19,7 @@ import org.slf4j.LoggerFactory; import java.util.regex.Matcher; import java.util.regex.Pattern; import saccubus.conv.ConvertToVideoHook; -import saccubus.conv.NicoXMLReader.CommentType; +import saccubus.conv.CommentType; import saccubus.util.FfmpegUtil; import saccubus.worker.Worker; import saccubus.worker.WorkerListener; -- 2.11.0