public void visitFromCompositeFactPattern( final FromCompositeFactPattern pattern, final 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" ); }
protected void calculateReadOnly() { if ( this.pattern.getFactPattern() != null ) { this.isFactTypeKnown = this.getModeller().getSuggestionCompletions().isFactTypeRecognized( this.pattern.getFactPattern().getFactType() ); this.readOnly = !this.isFactTypeKnown; } }
@Override protected void calculateReadOnly() { if ( this.pattern.getFactPattern() != null ) { this.readOnly = !( this.getExtraLeftSidePatternFactTypes().containsValue( this.pattern.getFactPattern().getFactType() ) || this.getModeller().getSuggestionCompletions().isFactTypeRecognized( this.pattern.getFactPattern().getFactType() ) ); } }
/** * 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; }
protected void doLayout() { int row = 0; if ( pattern.getFactPattern() != null ) { FactPattern fact = pattern.getFactPattern(); if ( fact != null ) { this.layout.setWidget( row++, 0, createFactPatternWidget( fact ) ); } } this.layout.setWidget( row++, 0, getCompositeLabel() ); }
/** * 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; }
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; }
IPattern pat = this.lhs[ i ]; if ( pat instanceof FromCompositeFactPattern ) { pat = ( (FromCompositeFactPattern) pat ).getFactPattern();
/** * Get the data-type associated with the binding * @param var * @return The data-type, or null if the binding could not be found */ public String getLHSBindingType( 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.isBound() && var.equals( p.getBoundName() ) ) { return p.getFactType(); } for ( FieldConstraint fc : p.getFieldConstraints() ) { String type = getFieldBinding( fc, var ); if ( type != null ) { return type; } } } } return null; }
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();
if ( pattern.getFactPattern() == null ) { panel.setWidget( r, 0,
if ( pattern.getFactPattern() == null ) { panel.setWidget( r, 0,
if ( pattern.getFactPattern() == null ) { panel.setWidget( r++, 0,
if ( pattern.getFactPattern() == null ) { panel.setWidget( r++, 0,