Ejemplo n.º 1
0
 private LeftTupleSource unwrapLeftInput(LeftTupleSource leftInput) {
   if (leftInput.getType() == NodeTypeEnums.FromNode
       || leftInput.getType() == NodeTypeEnums.ReactiveFromNode) {
     return leftInput.getLeftTupleSource();
   }
   return leftInput;
 }
Ejemplo n.º 2
0
 protected void initInferredMask(LeftTupleSource leftInput) {
   LeftTupleSource unwrappedLeft = unwrapLeftInput(leftInput);
   if (unwrappedLeft.getType() == NodeTypeEnums.LeftInputAdapterNode
       && ((LeftInputAdapterNode) unwrappedLeft).getParentObjectSource().getType()
           == NodeTypeEnums.AlphaNode) {
     AlphaNode alphaNode =
         (AlphaNode) ((LeftInputAdapterNode) unwrappedLeft).getParentObjectSource();
     leftInferredMask = alphaNode.updateMask(leftDeclaredMask);
   } else {
     leftInferredMask = leftDeclaredMask;
   }
   leftInferredMask = leftInferredMask.resetAll(leftNegativeMask);
 }
Ejemplo n.º 3
0
  protected void initDeclaredMask(BuildContext context, LeftTupleSource leftInput) {
    if (context == null || context.getLastBuiltPatterns() == null) {
      // only happens during unit tests
      leftDeclaredMask = AllSetBitMask.get();
      return;
    }

    if (leftInput.getType() != NodeTypeEnums.LeftInputAdapterNode) {
      // BetaNode's not after LIANode are not relevant for left mask property specific, so don't
      // block anything.
      leftDeclaredMask = AllSetBitMask.get();
      return;
    }

    Pattern pattern = context.getLastBuiltPatterns()[1]; // left input pattern

    ObjectType objectType =
        pattern == null || this.getType() == NodeTypeEnums.AccumulateNode
            ? ((LeftInputAdapterNode) leftInput)
                .getParentObjectSource()
                .getObjectTypeNode()
                .getObjectType()
            : pattern.getObjectType();

    if (!(objectType instanceof ClassObjectType)) {
      // Only ClassObjectType can use property specific
      leftDeclaredMask = AllSetBitMask.get();
      return;
    }

    Class objectClass = ((ClassWireable) objectType).getClassType();
    if (isPropertyReactive(context, objectClass)) {
      // TODO: at the moment if pattern is null (e.g. for eval node) we cannot calculate the mask,
      // so we leave it to 0
      if (pattern != null) {
        List<String> leftListenedProperties = pattern.getListenedProperties();
        List<String> settableProperties =
            getSettableProperties(context.getKnowledgeBase(), objectClass);
        leftDeclaredMask = calculatePositiveMask(leftListenedProperties, settableProperties);
        leftNegativeMask = calculateNegativeMask(leftListenedProperties, settableProperties);
        setLeftListenedProperties(leftListenedProperties);
      }
    } else {
      // if property specific is not on, then accept all modification propagations
      leftDeclaredMask = AllSetBitMask.get();
    }
  }
Ejemplo n.º 4
0
 public final void setLeftTupleSource(LeftTupleSource leftInput) {
   this.leftInput = leftInput;
   positionInPath = leftInput.getPositionInPath() + 1;
 }