⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 filter.java

📁 KWIC系统 采用管道/过滤器风格实现
💻 JAVA
字号:

import javax.swing.*;
import javax.swing.text.*;




abstract public class Filter implements Runnable
{
  protected Pipe input_;
  protected Pipe output_;
 // private JTextArea resultDisp;


  /*Thread control flag. */
  private boolean is_started_ = false;

  public Filter(Pipe input, Pipe output)
  {
    input_ = input;
    output_ = output;
    //resultDisp=resultPanel;
  }

  public void start()       //开始一个线程
  {
    if(!is_started_)
    {
      is_started_ = true;
      Thread thread = new Thread(this);
      thread.start();
    }
  }

  public void stop()
  {
    is_started_ = false;
  }

  public void run()         //当一个线程开始时,这个方法自动运行
  {
    transform();
  }

  //它的子类将实现它,此方法的目的是将 "input" 中的数据经过“变换”写到"output 中
  abstract protected void transform();

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -