Esempio n. 1
0
 private Comparable getIndexedValue(LeftTuple leftTuple) {
   return (Comparable)
       index
           .getDeclaration()
           .getExtractor()
           .getValue(leftTuple.get(index.getDeclaration()).getObject());
 }
 private Comparable getLeftDescendingIndexedValue(LeftTuple leftTuple) {
   return (Comparable)
       descendingIndex
           .getDeclaration()
           .getExtractor()
           .getValue(leftTuple.get(descendingIndex.getDeclaration()).getObject());
 }
  public void assertLeftTuple(
      final LeftTuple leftTuple,
      final PropagationContext context,
      final InternalWorkingMemory workingMemory) {
    // while we don't do anything with this, it's needed to serialization has a hook point
    // It will still keep the LT's in the serialization, but sucked form the child
    workingMemory.getNodeMemory(this);

    // creating a dummy fact handle to wrap the tuple
    final InternalFactHandle handle = createFactHandle(leftTuple, context, workingMemory);
    boolean useLeftMemory = true;
    if (!isLeftTupleMemoryEnabled()) {
      // This is a hack, to not add closed DroolsQuery objects
      Object object = leftTuple.get(0).getObject();
      if (!(object instanceof DroolsQuery) || !((DroolsQuery) object).isOpen()) {
        useLeftMemory = false;
      }
    }

    if (useLeftMemory) {
      leftTuple.setObject(handle);
    }

    // propagate it
    this.sink.propagateAssertObject(handle, context, workingMemory);

    //        if ( useLeftMemory) {
    //            leftTuple.setObject( handle.getFirstRightTuple() );
    //        }

  }