-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
143 changed files
with
6,431 additions
and
730 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
drools-base/src/main/java/org/drools/core/phreak/PropagationEntry.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/** | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package org.drools.core.phreak; | ||
|
||
import org.drools.base.base.ValueResolver; | ||
|
||
public interface PropagationEntry<T extends ValueResolver> { | ||
|
||
default void execute(T t) { | ||
internalExecute(t); | ||
t.onWorkingMemoryAction(this); | ||
} | ||
|
||
void internalExecute(T t); | ||
|
||
PropagationEntry getNext(); | ||
void setNext(PropagationEntry next); | ||
|
||
boolean requiresImmediateFlushing(); | ||
|
||
boolean isCalledFromRHS(); | ||
|
||
boolean isPartitionSplittable(); | ||
PropagationEntry getSplitForPartition(int partitionNr); | ||
|
||
boolean defersExpiration(); | ||
|
||
} |
41 changes: 41 additions & 0 deletions
41
drools-base/src/main/java/org/drools/core/phreak/actions/AbstractPropagationEntry.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package org.drools.core.phreak.actions; | ||
|
||
import org.drools.base.base.ValueResolver; | ||
import org.drools.core.phreak.PropagationEntry; | ||
|
||
public abstract class AbstractPropagationEntry<T extends ValueResolver> implements PropagationEntry<T> { | ||
protected PropagationEntry next; | ||
|
||
public void setNext(PropagationEntry next) { | ||
this.next = next; | ||
} | ||
|
||
public PropagationEntry getNext() { | ||
return next; | ||
} | ||
|
||
@Override | ||
public boolean requiresImmediateFlushing() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean isCalledFromRHS() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean isPartitionSplittable() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean defersExpiration() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public PropagationEntry getSplitForPartition(int partitionNr) { | ||
throw new UnsupportedOperationException(); | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
drools-base/src/main/java/org/drools/core/reteoo/DynamicFilter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package org.drools.core.reteoo; | ||
|
||
import org.drools.base.base.ValueResolver; | ||
import org.drools.base.rule.constraint.AlphaNodeFieldConstraint; | ||
import org.drools.core.util.AbstractLinkedListNode; | ||
import org.drools.core.util.LinkedList; | ||
import org.kie.api.runtime.rule.FactHandle; | ||
|
||
public class DynamicFilter extends AbstractLinkedListNode<DynamicFilter> { | ||
private AlphaNodeFieldConstraint constraint; | ||
private LinkedList<SignalAdapter> signalAdapters; | ||
private int activeFilterIndex; | ||
|
||
public DynamicFilter(DynamicFilterProto proto) { | ||
this.constraint = proto.getConstraint(); | ||
this.activeFilterIndex = proto.getFilterIndex(); | ||
this.signalAdapters = new LinkedList<>(); | ||
} | ||
|
||
public AlphaNodeFieldConstraint getConstraint() { | ||
return constraint; | ||
} | ||
|
||
public int getActiveFilterIndex() { | ||
return activeFilterIndex; | ||
} | ||
|
||
public void addSignalAdapter(SignalAdapter signalAdapter) { | ||
signalAdapters.add(signalAdapter); | ||
} | ||
|
||
public void removeSignalAdapter(SignalAdapter signalAdapter) { | ||
signalAdapters.remove(signalAdapter); | ||
} | ||
|
||
public LinkedList<SignalAdapter> getSignalAdapters() { | ||
return signalAdapters; | ||
} | ||
|
||
public void assertObject(final FactHandle factHandle, | ||
final ValueResolver valueResolver) { | ||
System.out.println("true : " + factHandle.getObject()); | ||
|
||
if (constraint.isAllowed(factHandle, valueResolver)) { | ||
for (SignalAdapter signal = signalAdapters.getFirst(); signal != null; signal = signal.getNext()) { | ||
signal.receive(valueResolver, factHandle); | ||
} | ||
} | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
drools-base/src/main/java/org/drools/core/reteoo/DynamicFilterProto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package org.drools.core.reteoo; | ||
|
||
import org.drools.base.rule.constraint.AlphaNodeFieldConstraint; | ||
|
||
public class DynamicFilterProto { | ||
private AlphaNodeFieldConstraint constraint; | ||
private int filterIndex; | ||
|
||
public DynamicFilterProto(AlphaNodeFieldConstraint constraint, int filterIndex) { | ||
this.constraint = constraint; | ||
this.filterIndex = filterIndex; | ||
} | ||
|
||
public AlphaNodeFieldConstraint getConstraint() { | ||
return constraint; | ||
} | ||
|
||
public int getFilterIndex() { | ||
return filterIndex; | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
drools-base/src/main/java/org/drools/core/reteoo/SignalAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package org.drools.core.reteoo; | ||
|
||
import org.drools.base.base.ValueResolver; | ||
import org.drools.core.reteoo.sequencing.Sequence.SequenceMemory; | ||
import org.drools.core.reteoo.sequencing.signalprocessors.SignalProcessor; | ||
import org.drools.core.reteoo.sequencing.signalprocessors.SignalStatus; | ||
import org.drools.core.util.AbstractLinkedListNode; | ||
import org.kie.api.runtime.rule.FactHandle; | ||
|
||
public class SignalAdapter extends AbstractLinkedListNode<SignalAdapter> { | ||
private SignalProcessor output; | ||
private int signalBitIndex; | ||
private SequenceMemory memory; | ||
|
||
public SignalAdapter(SignalProcessor output, int signalBitIndex, SequenceMemory memory) { | ||
this.output = output; | ||
this.signalBitIndex = signalBitIndex; | ||
this.memory = memory; | ||
} | ||
|
||
public void receive(ValueResolver reteEvaluator, FactHandle factHandle) { | ||
memory.getSequencerMemory().getEvents().add(factHandle); | ||
output.consume(signalBitIndex, SignalStatus.MATCHED, memory, reteEvaluator); | ||
} | ||
} |
File renamed without changes.
9 changes: 9 additions & 0 deletions
9
drools-base/src/main/java/org/drools/core/reteoo/sequencing/DynamicFilters.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package org.drools.core.reteoo.sequencing; | ||
|
||
import org.drools.core.reteoo.DynamicFilter; | ||
|
||
public interface DynamicFilters { | ||
DynamicFilter getActiveDynamicFilter(int filterIndex); | ||
|
||
void removeActiveFilter(DynamicFilter filter); | ||
} |
Oops, something went wrong.