public void writeExternal(ObjectOutput out) throws IOException { super.writeExternal(out); out.writeObject(queryElement); out.writeObject(tupleSource); out.writeBoolean(tupleMemoryEnabled); out.writeBoolean(openQuery); }
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { super.readExternal(in); queryElement = (QueryElement) in.readObject(); tupleSource = (LeftTupleSource) in.readObject(); tupleMemoryEnabled = in.readBoolean(); openQuery = in.readBoolean(); }
public void networkUpdated(UpdateContext updateContext) { updateContext.startVisitNode(leftInput); rightInput.networkUpdated(updateContext); updateContext.endVisit(); if (!updateContext.isVisiting(leftInput)) { leftInput.networkUpdated(updateContext); } }
@Override public int hashCode() { final int prime = 31; int result = super.hashCode(); result = prime * result + (openQuery ? 1231 : 1237); result = prime * result + ((queryElement == null) ? 0 : queryElement.hashCode()); result = prime * result + ((tupleSource == null) ? 0 : tupleSource.hashCode()); return result; }
/* (non-Javadoc) * @see org.drools.reteoo.BaseNode#hashCode() */ public int hashCode() { int hash = (23 * leftInput.hashCode()) + (29 * rightInput.hashCode()) + (31 * constraints.hashCode()); if (leftListenedProperties != null) { hash += 37 * leftListenedProperties.hashCode(); } if (rightListenedProperties != null) { hash += 41 * rightListenedProperties.hashCode(); } return hash; }
@Override protected void initInferredMask(LeftTupleSource leftInput) { super.initInferredMask(leftInput); ObjectSource unwrappedRight = unwrapRightInput(); if (unwrappedRight instanceof AlphaNode) { AlphaNode alphaNode = (AlphaNode) unwrappedRight; rightInferredMask = alphaNode.updateMask(rightDeclaredMask); } else { rightInferredMask = rightDeclaredMask; } rightInferredMask &= (Long.MAX_VALUE - rightNegativeMask); }
@Override protected void initDeclaredMask(BuildContext context, LeftTupleSource leftInput) { if (context == null || context.getLastBuiltPatterns() == null) { // only happens during unit tests rightDeclaredMask = Long.MAX_VALUE; super.initDeclaredMask(context, leftInput); return; } if (!(rightInput instanceof RightInputAdapterNode)) { Pattern pattern = context.getLastBuiltPatterns()[0]; // right input pattern ObjectType objectType = pattern.getObjectType(); if (!(objectType instanceof ClassObjectType)) { // InitialFact has no type declaration and cannot be property specific // Only ClassObjectType can use property specific rightDeclaredMask = Long.MAX_VALUE; } Class objectClass = ((ClassObjectType) objectType).getClassType(); if (isPropertyReactive(context, objectClass)) { rightListenedProperties = pattern.getListenedProperties(); List<String> settableProperties = getSettableProperties(context.getRuleBase(), objectClass); rightDeclaredMask = calculatePositiveMask(rightListenedProperties, settableProperties); rightDeclaredMask |= constraints.getListenedPropertyMask(settableProperties); rightNegativeMask = calculateNegativeMask(rightListenedProperties, settableProperties); } else { // if property reactive is not on, then accept all modification propagations rightDeclaredMask = Long.MAX_VALUE; } } else { rightDeclaredMask = Long.MAX_VALUE; // There would have been no right input pattern, so swap current to first, so leftInput can // still work context.setLastBuiltPattern(context.getLastBuiltPatterns()[0]); } super.initDeclaredMask(context, leftInput); }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; QueryElementNode other = (QueryElementNode) obj; if (openQuery != other.openQuery) return false; if (queryElement == null) { if (other.queryElement != null) return false; } else if (!queryElement.equals(other.queryElement)) return false; if (tupleSource == null) { if (other.tupleSource != null) return false; } else if (!tupleSource.equals(other.tupleSource)) return false; return true; }
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { constraints = (BetaConstraints) in.readObject(); leftInput = (LeftTupleSource) in.readObject(); rightInput = (ObjectSource) in.readObject(); objectMemory = in.readBoolean(); tupleMemoryEnabled = in.readBoolean(); concurrentRightTupleMemory = in.readBoolean(); lrUnlinkingEnabled = in.readBoolean(); rightDeclaredMask = in.readLong(); rightInferredMask = in.readLong(); rightNegativeMask = in.readLong(); leftListenedProperties = (List) in.readObject(); rightListenedProperties = (List) in.readObject(); setUnificationJoin(); super.readExternal(in); }
public void writeExternal(ObjectOutput out) throws IOException { BetaNodeFieldConstraint[] betaCconstraints = this.constraints.getConstraints(); if (betaCconstraints.length > 0) { BetaNodeFieldConstraint c = betaCconstraints[0]; if (IndexUtil.isIndexable(c, getType()) && ((IndexableConstraint) c).isUnification()) { this.constraints = this.constraints.getOriginalConstraint(); } } out.writeObject(constraints); out.writeObject(leftInput); out.writeObject(rightInput); out.writeBoolean(objectMemory); out.writeBoolean(tupleMemoryEnabled); out.writeBoolean(concurrentRightTupleMemory); out.writeBoolean(lrUnlinkingEnabled); out.writeLong(rightDeclaredMask); out.writeLong(rightInferredMask); out.writeLong(rightNegativeMask); out.writeObject(leftListenedProperties); out.writeObject(rightListenedProperties); super.writeExternal(out); }
/** * We need to track tuple source nodes that we visit to avoid multiple removal in case of * subnetworks * * @param node * @return */ public boolean alreadyVisited(LeftTupleSource node) { return this.visitedNodes.containsKey(new Integer(node.getId())); }
/** * We need to track tuple source nodes that we visit to avoid multiple removal in case of * subnetworks * * @param node */ public void visitTupleSource(LeftTupleSource node) { this.visitedNodes.put(new Integer(node.getId()), node); }
public void writeExternal(ObjectOutput out) throws IOException { super.writeExternal(out); out.writeObject(objectSource); out.writeBoolean(leftTupleMemoryEnabled); out.writeBoolean(rootQueryNode); }
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { super.readExternal(in); objectSource = (ObjectSource) in.readObject(); leftTupleMemoryEnabled = in.readBoolean(); rootQueryNode = in.readBoolean(); }
protected ObjectTypeNode getObjectTypeNode() { return tupleSource.getObjectTypeNode(); }