OSDN Git Service

デバッグ出力を追加
[coroid/inqubus.git] / frontend / src / saccubus / converter / AbstractCommand.java
1 /* $Id$ */
2 package saccubus.converter;
3
4 import saccubus.ConvertStopFlag;
5 import saccubus.net.TextProgressListener;
6
7 /**
8  *
9  * @author yuki
10  */
11 public abstract class AbstractCommand {
12
13     private final TextProgressListener listener;
14     private final ConvertStopFlag StopFlag;
15
16     public AbstractCommand(TextProgressListener listener, ConvertStopFlag StopFlag) {
17         this.listener = listener;
18         this.StopFlag = StopFlag;
19     }
20
21     protected void stopFlagReturn() throws InterruptedException {
22         if (getStopFlag().needStop()) {
23             throw new InterruptedException("中止しました。");
24         }
25     }
26
27     protected void sendText(String text) {
28         sendText(text, true);
29     }
30
31     protected void sendText(String text, boolean debugOut) {
32         getListener().setText(text);
33         if (debugOut) {
34             System.out.println(text);
35         }
36     }
37
38     /**
39      * @return the listener
40      */
41     protected TextProgressListener getListener() {
42         return listener;
43     }
44
45     /**
46      * @return the StopFlag
47      */
48     protected ConvertStopFlag getStopFlag() {
49         return StopFlag;
50     }
51 }