public void visitFromCompositeFactPattern( FromCompositeFactPattern pattern, boolean isSubPattern ) { buf.append( indentation ); if ( !isSubPattern && isDSLEnhanced ) { // adding passthrough markup buf.append( ">" ); } if ( pattern.getFactPattern() != null ) { generateFactPattern( pattern.getFactPattern() ); } buf.append( " from " ); renderExpression( pattern.getExpression() ); buf.append( "\n" ); }
public void visitFromCompositeFactPattern( FromCompositeFactPattern pattern, boolean isSubPattern ) { buf.append( indentation ); if ( !isSubPattern && isDSLEnhanced ) { // adding passthrough markup buf.append( ">" ); } if ( pattern.getFactPattern() != null ) { generateFactPattern( pattern.getFactPattern() ); } buf.append( " from " ); renderExpression( pattern.getExpression() ); buf.append( "\n" ); }
/** * This will return a List<String> of all FactPattern bindings * * @return The bindings or an empty list if no bindings are found. */ public List<String> getLHSBoundFacts() { if ( this.lhs == null ) { return Collections.emptyList(); } final List<String> list = new ArrayList<String>(); for ( int i = 0; i < this.lhs.length; i++ ) { IPattern pat = this.lhs[i]; if ( pat instanceof FromCompositeFactPattern ) { pat = ((FromCompositeFactPattern) pat).getFactPattern(); } if ( pat instanceof FactPattern ) { final FactPattern p = (FactPattern) pat; if ( p.getBoundName() != null ) { list.add( p.getBoundName() ); } } } return list; }
/** * This will return a List<String> of all FactPattern bindings * * @return The bindings or an empty list if no bindings are found. */ public List<String> getLHSBoundFacts() { if ( this.lhs == null ) { return Collections.emptyList(); } final List<String> list = new ArrayList<String>(); for ( int i = 0; i < this.lhs.length; i++ ) { IPattern pat = this.lhs[i]; if ( pat instanceof FromCompositeFactPattern ) { pat = ((FromCompositeFactPattern) pat).getFactPattern(); } if ( pat instanceof FactPattern ) { final FactPattern p = (FactPattern) pat; if ( p.getBoundName() != null ) { list.add( p.getBoundName() ); } } } return list; }
/** * This will return the FactPattern that a variable is bound Eto. * * @param var * The bound fact variable (NOT bound field). * @return null or the FactPattern found. */ public FactPattern getLHSBoundFact(final String var) { if ( this.lhs == null ) { return null; } for ( int i = 0; i < this.lhs.length; i++ ) { IPattern pat = this.lhs[i]; if ( pat instanceof FromCompositeFactPattern ) { pat = ((FromCompositeFactPattern) pat).getFactPattern(); } if ( pat instanceof FactPattern ) { final FactPattern p = (FactPattern) pat; if ( p.getBoundName() != null && var.equals( p.getBoundName() ) ) { return p; } } } return null; }
/** * This will return the FactPattern that a variable is bound Eto. * * @param var * The bound fact variable (NOT bound field). * @return null or the FactPattern found. */ public FactPattern getLHSBoundFact(final String var) { if ( this.lhs == null ) { return null; } for ( int i = 0; i < this.lhs.length; i++ ) { IPattern pat = this.lhs[i]; if ( pat instanceof FromCompositeFactPattern ) { pat = ((FromCompositeFactPattern) pat).getFactPattern(); } if ( pat instanceof FactPattern ) { final FactPattern p = (FactPattern) pat; if ( p.getBoundName() != null && var.equals( p.getBoundName() ) ) { return p; } } } return null; }
/** * This will return the FieldConstraint that a variable is bound to. * * @param var * The bound field variable (NOT bound fact). * @return null or the FieldConstraint found. */ public FieldConstraint getLHSBoundField(final String var) { if ( this.lhs == null ) { return null; } for ( int i = 0; i < this.lhs.length; i++ ) { IPattern pat = this.lhs[i]; if ( pat instanceof FromCompositeFactPattern ) { pat = ((FromCompositeFactPattern) pat).getFactPattern(); } if ( pat instanceof FactPattern ) { final FactPattern p = (FactPattern) pat; for ( int j = 0; j < p.getFieldConstraints().length; j++ ) { FieldConstraint fc = p.getFieldConstraints()[j]; List<String> fieldBindings = getFieldBinding( fc ); if ( fieldBindings.contains( var ) ) { return fc; } } } } return null; }
/** * This will return the FieldConstraint that a variable is bound to. * * @param var * The bound field variable (NOT bound fact). * @return null or the FieldConstraint found. */ public FieldConstraint getLHSBoundField(final String var) { if ( this.lhs == null ) { return null; } for ( int i = 0; i < this.lhs.length; i++ ) { IPattern pat = this.lhs[i]; if ( pat instanceof FromCompositeFactPattern ) { pat = ((FromCompositeFactPattern) pat).getFactPattern(); } if ( pat instanceof FactPattern ) { final FactPattern p = (FactPattern) pat; for ( int j = 0; j < p.getFieldConstraints().length; j++ ) { FieldConstraint fc = p.getFieldConstraints()[j]; List<String> fieldBindings = getFieldBinding( fc ); if ( fieldBindings.contains( var ) ) { return fc; } } } } return null; }
private void visitFromCompositeFactPattern(FromCompositeFactPattern pattern) { visit( pattern.getFactPattern() ); parseStringPattern( pattern.getExpression().getText() ); }
private void visitFromCompositeFactPattern(FromCompositeFactPattern pattern) { visit( pattern.getFactPattern() ); parseStringPattern( pattern.getExpression().getText() ); }
/** * @param idx * Remove this index from the LHS. returns false if it was NOT * allowed to remove this item (ie it is used on the RHS). */ public boolean removeLhsItem(final int idx) { final IPattern[] newList = new IPattern[this.lhs.length - 1]; int newIdx = 0; for ( int i = 0; i < this.lhs.length; i++ ) { if ( i != idx ) { newList[newIdx] = this.lhs[i]; newIdx++; } else { IPattern pat = this.lhs[i]; if ( pat instanceof FromCompositeFactPattern ) { pat = ((FromCompositeFactPattern) pat).getFactPattern(); } if ( pat instanceof FactPattern ) { final FactPattern p = (FactPattern) pat; if ( p.getBoundName() != null && isBoundFactUsed( p.getBoundName() ) ) { return false; } } } } this.lhs = newList; return true; }
/** * @param idx * Remove this index from the LHS. returns false if it was NOT * allowed to remove this item (ie it is used on the RHS). */ public boolean removeLhsItem(final int idx) { final IPattern[] newList = new IPattern[this.lhs.length - 1]; int newIdx = 0; for ( int i = 0; i < this.lhs.length; i++ ) { if ( i != idx ) { newList[newIdx] = this.lhs[i]; newIdx++; } else { IPattern pat = this.lhs[i]; if ( pat instanceof FromCompositeFactPattern ) { pat = ((FromCompositeFactPattern) pat).getFactPattern(); } if ( pat instanceof FactPattern ) { final FactPattern p = (FactPattern) pat; if ( p.getBoundName() != null && isBoundFactUsed( p.getBoundName() ) ) { return false; } } } } this.lhs = newList; return true; }
IPattern pat = this.lhs[i]; if ( pat instanceof FromCompositeFactPattern ) { pat = ((FromCompositeFactPattern) pat).getFactPattern();
IPattern pat = this.lhs[i]; if ( pat instanceof FromCompositeFactPattern ) { pat = ((FromCompositeFactPattern) pat).getFactPattern();
IPattern pat = this.lhs[i]; if ( pat instanceof FromCompositeFactPattern ) { pat = ((FromCompositeFactPattern) pat).getFactPattern();
private FromCompositeFactPattern visitFromCompositeFactPattern(FromCompositeFactPattern pattern) { FromCompositeFactPattern clone = new FromCompositeFactPattern(); clone.setExpression( (ExpressionFormLine) visit( pattern.getExpression() ) ); clone.setFactPattern( (FactPattern) visit( pattern.getFactPattern() ) ); return clone; }
IPattern pat = this.lhs[i]; if ( pat instanceof FromCompositeFactPattern ) { pat = ((FromCompositeFactPattern) pat).getFactPattern();
private FromCompositeFactPattern visitFromCompositeFactPattern(FromCompositeFactPattern pattern) { FromCompositeFactPattern clone = new FromCompositeFactPattern(); clone.setExpression( (ExpressionFormLine) visit( pattern.getExpression() ) ); clone.setFactPattern( (FactPattern) visit( pattern.getFactPattern() ) ); return clone; }
IPattern pat = this.lhs[i]; if ( pat instanceof FromCompositeFactPattern ) { pat = ((FromCompositeFactPattern) pat).getFactPattern();
IPattern pat = this.lhs[i]; if ( pat instanceof FromCompositeFactPattern ) { pat = ((FromCompositeFactPattern) pat).getFactPattern();