Package lupos.engine.operators.messages

Examples of lupos.engine.operators.messages.Message


    return msg;
  }

  @Override
  public Message preProcessMessage(BoundVariablesMessage msg) {
    Message msgResult = super.preProcessMessage(msg);
    Set<Variable> leftUnion = null;
    Set<Variable> rightUnion = null;

    // if all variables that must be compared are always bound in every
    // binding, then they can easily be presorted,
View Full Code Here


   * @return the post-processed message after processing and forwarding the
   *         merged message of all operands, which has been received from the
   *         succeeding operators
   */
  public Message receive(final Message message, final BasicOperator from) {
    Message msg = message;
    if (from != null) {
      Map<BasicOperator, Message> received = this.messages.get(msg.getId());
      if (received == null) {
        received = new HashMap<BasicOperator, Message>();
        this.messages.put(msg.getId(), received);
      }
      received.put(from, msg);

      final HashSet<BasicOperator> operatorsWithoutCycles = new HashSet<BasicOperator>();
      operatorsWithoutCycles.addAll(this.precedingOperators);
      operatorsWithoutCycles.removeAll(this.cycleOperands);

      if (!received.keySet().containsAll(operatorsWithoutCycles)) {
        return null;
      }

      if (received.keySet().containsAll(this.precedingOperators)) {
        this.messages.remove(msg.getId());
      }
      msg = msg.merge(received.values(), this);
    }
    msg = msg.preProcess(this);
    msg = this.forwardMessage(msg);
    if (msg == null) {
      return null;
    } else {
      return msg.postProcess(this);
    }
  }
View Full Code Here

   *            the message to be forwarded
   * @return a message received from the succeeding operators
   */
  protected Message forwardMessage(final Message msg) {
    msg.setVisited(this);
    Message result = msg;
    for (final OperatorIDTuple opid : this.succeedingOperators) {
      if (!msg.hasVisited(opid.getOperator())) {
        final Message msg2 = msg.clone();
        result = opid.getOperator().receive(msg2, this);
      }
    }
    return result;
  }
View Full Code Here

   *            the message to be sent
   * @return the received (and post-processed) message from the succeeding
   *         operators
   */
  public Message sendMessage(final Message msg) {
    final Message msgResult = this.forwardMessage(msg.preProcess(this));
    // postprocess anyway one message, does not matter if the resultant msg is null or not to allow processing right after initialization
    if(msgResult == null) {
      return msg.postProcess(this);
    } else {
      return msgResult.postProcess(this);
    }
  }
View Full Code Here

  }

  protected Message forwardMessageDebug(final Message msg,
      final DebugStep debugstep) {
    msg.setVisited(this);
    Message result = msg;
    for (final OperatorIDTuple opid : this.succeedingOperators) {
      if (!msg.hasVisited(opid.getOperator())) {
        final Message msg2 = msg.clone();
        result = opid.getOperator().receiveDebug(msg2, this, debugstep);
      }
    }
    return result;
  }
View Full Code Here

  public Message preProcessMessageDebug(final ComputeIntermediateResultMessage msg, final DebugStep debugstep) {
    return msg;
  }

  public Message receiveDebug(final Message message, final BasicOperator from, final DebugStep debugstep) {
    Message msg = message;
    if (from != null) {
      debugstep.stepMessage(from, this, msg);
      Map<BasicOperator, Message> received = this.messages.get(msg.getId());
      if (received == null) {
        received = new HashMap<BasicOperator, Message>();
        this.messages.put(msg.getId(), received);
      }
      received.put(from, msg);

      final HashSet<BasicOperator> operatorsWithoutCycles = new HashSet<BasicOperator>();
      operatorsWithoutCycles.addAll(this.precedingOperators);
      operatorsWithoutCycles.removeAll(this.cycleOperands);

      if (!received.keySet().containsAll(operatorsWithoutCycles)) {
        return null;
      }

      if (received.keySet().containsAll(this.precedingOperators)) {
        this.messages.remove(msg.getId());
      }
      msg = msg.merge(received.values(), this);
    }
    msg = msg.preProcessDebug(this, debugstep);
    msg = this.forwardMessageDebug(msg, debugstep);
    if (msg == null) {
      return null;
    } else {
      return msg.postProcessDebug(this, debugstep);
    }
  }
View Full Code Here

      return msg.postProcessDebug(this, debugstep);
    }
  }

  public Message sendMessageDebug(final Message msg, final DebugStep debugstep) {
    final Message msgResult = this.forwardMessageDebug(msg.preProcessDebug(this, debugstep), debugstep);
    // postprocess anyway one message, does not matter if the resultant msg is null or not to allow processing right after initialization
    if(msgResult == null) {
      return msg.postProcessDebug(this, debugstep);
    } else {
      return msgResult.postProcessDebug(this, debugstep);
    }
  }
View Full Code Here

TOP

Related Classes of lupos.engine.operators.messages.Message

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.