예제 #1
0
  public static void pullPipelineA() {

    PullPipe<LinkedList<String>> pipe1 = new PullPipe<>();
    PrintSink filter1 = new PrintSink(pipe1, outputPath);

    PullPipe<LinkedList<LineWithLineNumber>> pipe2 = new PullPipe<>();
    CreateIndexFilter filter2 = new CreateIndexFilter(pipe2);

    PullPipe<WordArray> pipe3 = new PullPipe<>();
    ShiftFilter filter3 = new ShiftFilter(pipe3);

    PullPipe<LineWithLineNumber> pipe4 = new PullPipe<>();
    LineToWordFilter filter4 = new LineToWordFilter(pipe4);

    ReadLineFromRessourceSource filter5 =
        new ReadLineFromRessourceSource(new File("").getAbsolutePath() + inputPath);

    pipe1.setPredecessorFilter(filter2);
    pipe2.setPredecessorFilter(filter3);
    pipe3.setPredecessorFilter(filter4);
    pipe4.setPredecessorFilter(filter5);

    try {
      filter1.read();
    } catch (StreamCorruptedException e) {
      e.printStackTrace();
    }
  }
예제 #2
0
  public static void pullPipelineB() {

    PullPipe<LinkedList<String>> pipe1 = new PullPipe<>();
    PrintSink filter1 = new PrintSink(pipe1, outputPath);

    PullPipe<LineWithLineNumber> pipe2 = new PullPipe<>();
    LineToListFilter filter2 = new LineToListFilter(pipe2);

    PullPipe<WordTransfer> pipe3 = new PullPipe<>();
    WordToLineFilter filter3 = new WordToLineFilter(pipe3, len, align);

    PullPipe<CharTransfer> pipe4 = new PullPipe<>();
    CharToWordFilter filter4 = new CharToWordFilter(pipe4);

    CharacterSource filter5 = new CharacterSource(new File("").getAbsolutePath() + inputPath);

    pipe1.setPredecessorFilter(filter2);
    pipe2.setPredecessorFilter(filter3);
    pipe3.setPredecessorFilter(filter4);
    pipe4.setPredecessorFilter(filter5);

    try {
      filter1.read();
    } catch (StreamCorruptedException e) {
      e.printStackTrace();
    }
  }
예제 #3
0
  public static void pullPipelineAandB() {

    PullPipe<LinkedList<String>> pipe1 = new PullPipe<>();
    PrintSink filter1 = new PrintSink(pipe1, outputPath);

    PullPipe<LinkedList<LineWithLineNumber>> pipe2 = new PullPipe<>();
    CreateIndexFilter filter2 = new CreateIndexFilter(pipe2);

    PullPipe<WordArray> pipe3 = new PullPipe<>();
    ShiftFilter filter3 = new ShiftFilter(pipe3);

    PullPipe<LineWithLineNumber> pipe4 = new PullPipe<>();
    LineToWordFilter filter4 = new LineToWordFilter(pipe4);

    PullPipe<WordTransfer> pipe5 = new PullPipe<>();
    // Allignment wird hier nicht durchgeführt, da der LineToWordFilter alle Leerzeichen wieder
    // entfernt
    WordToLineFilter filter5 = new WordToLineFilter(pipe5, len, align);

    PullPipe<CharTransfer> pipe6 = new PullPipe<>();
    CharToWordFilter filter6 = new CharToWordFilter(pipe6);

    CharacterSource filter7 = new CharacterSource(new File("").getAbsolutePath() + inputPath);

    pipe1.setPredecessorFilter(filter2);
    pipe2.setPredecessorFilter(filter3);
    pipe3.setPredecessorFilter(filter4);
    pipe4.setPredecessorFilter(filter5);
    pipe5.setPredecessorFilter(filter6);
    pipe6.setPredecessorFilter(filter7);

    try {
      filter1.read();
    } catch (StreamCorruptedException e) {
      e.printStackTrace();
    }
  }