예제 #1
0
  @Override
  protected void execute() {

    Packet p;
    while ((p = _inport.receive()) != null) {
      String text = (String) p.getContent();

      String[] parts = text.split(",");
      String note = parts[0].trim();
      String duration = parts[1].trim();
      int[] intArray = {Integer.parseInt(note), Integer.parseInt(duration)};
      drop(p);
      _outport.send(create(intArray));
    }
  }
예제 #2
0
  @Override
  protected void execute() {
    String find = ""; // Default empty string
    Packet pfind = findport.receive();
    if (pfind != null) {
      find = (String) pfind.getContent();
      drop(pfind);
    }
    findport.close();

    String repl = " "; // Default empty string
    Packet prepl = replport.receive();
    if (prepl != null) {
      repl = (String) prepl.getContent();
      drop(prepl);
    }
    replport.close();

    Packet pin;
    while ((pin = inport.receive()) != null) {
      String out = "";
      String in = (String) pin.getContent();
      out = in.replaceAll(find, repl);
      drop(pin);

      Packet pout = create(out);
      outport.send(pout);
    }
  }
예제 #3
0
파일: VertexGT.java 프로젝트: spantonsg/fbp
 @Override
 public final void procData(final Packet aPacket) {
   graphTraversal = (GraphTraversal<Vertex, Vertex>) aPacket.getContent();
   drop(aPacket);
   sendOut(create(list()));
 }