Describes given {@link Rule} as:
<p>
<code>ID: Phase - Provider [tags ...]".</code>
498837
public static String prettyPrintRule(Rule rule)
    {
        StringBuilder result = new StringBuilder();
        if (rule instanceof Context)
        {
            final Context context = (Context) rule;
            RuleProvider provider = (RuleProvider) context.get(RuleMetadataType.RULE_PROVIDER);

            if (provider != null && provider.getMetadata() != null)
            {
                result.append(provider.getMetadata().getPhase().getSimpleName()).append(" - ");
                result.append(provider.getMetadata().getID()).append(" - ");
            }

            if (rule.getId() != null)
                result.append(rule.getId());
        }

        return result.toString();
    }
1199029
public PhaseIdType[] getRestrictedPhaseIds(Method restrictAtViewMethod, Annotation annotation) {
        PhaseIdType[] phaseIds;
        try {
            phaseIds = (PhaseIdType[]) restrictAtViewMethod.invoke(annotation);
        } catch (IllegalAccessException ex) {
            throw new IllegalArgumentException("restrictAtView method must be accessible", ex);
        } catch (InvocationTargetException ex) {
            throw new RuntimeException(ex);
        }
        return phaseIds;
    }
871837
public FacesConfigLifecycleType<T> phaseListener(String ... values)
   {
      if (values != null)
      {
         for(String name: values)
         {
            childNode.createChild("phase-listener").text(name);
         }
      }
      return this;
   }
762903
public TypedLinkAttributeDefinition withRules(java.util.Map<String, Rule> rules) {
        setRules(rules);
        return this;
    }
216025
private static RuleList parseRuleChain(String description)
            throws ParseException {
        RuleList result = new RuleList();
        // remove trailing ;
        if (description.endsWith(";")) {
            description = description.substring(0,description.length()-1);
        }
        String[] rules = SEMI_SEPARATED.split(description);
        for (int i = 0; i < rules.length; ++i) {
            Rule rule = parseRule(rules[i].trim());
            result.hasExplicitBoundingInfo |= rule.integerSamples != null || rule.decimalSamples != null;
            result.addRule(rule);
        }
        return result.finish();
    }
1295475
public void removeRuleFlow(String id) {
        ProcessPackage rtp = (ProcessPackage) getResourceTypePackages().get(ResourceType.BPMN2);
        if (rtp == null || rtp.lookup(id) == null) {
            throw new IllegalArgumentException("The rule flow with id [" + id + "] is not part of this package.");
        }
        rtp.remove(id);
    }
835733
Rule dotNewExpressionChaining() {
		return Sequence(
				level1ExpressionChaining().label("head"), set(),
				ZeroOrMore(Sequence(
						Sequence(
								Ch('.'),
								group.basics.optWS(),
								String("new"),
								group.basics.testLexBreak(),
								group.basics.optWS()),
						group.types.typeArguments().label("constructorTypeArgs"),
						group.basics.identifier().label("innerClassName"),
						group.types.typeArguments().label("classTypeArgs"),
						group.structures.methodArguments().label("methodArguments"),
						Optional(group.structures.typeBody()).label("classBody"),
						set(actions.createQualifiedConstructorInvocation(value("constructorTypeArgs"), node("innerClassName"), node("classTypeArgs"), value("methodArguments"), value("classBody"))))),
				set(actions.createChainOfQualifiedConstructorInvocations(node("head"), nodes("ZeroOrMore/Sequence"))));
	}
1074113
public final EObject ruleXUnaryOperation() throws RecognitionException {
        EObject current = null;

        EObject lv_operand_2_0 = null;

        EObject this_XCastedExpression_3 = null;



        	enterRule();

        try {
            // InternalPureXbase.g:2017:2: ( ( ( () ( ( ruleOpUnary ) ) ( (lv_operand_2_0= ruleXUnaryOperation ) ) ) | this_XCastedExpression_3= ruleXCastedExpression ) )
            // InternalPureXbase.g:2018:2: ( ( () ( ( ruleOpUnary ) ) ( (lv_operand_2_0= ruleXUnaryOperation ) ) ) | this_XCastedExpression_3= ruleXCastedExpression )
            {
            // InternalPureXbase.g:2018:2: ( ( () ( ( ruleOpUnary ) ) ( (lv_operand_2_0= ruleXUnaryOperation ) ) ) | this_XCastedExpression_3= ruleXCastedExpression )
            int alt36=2;
            int LA36_0 = input.LA(1);

            if ( ((LA36_0>=44 && LA36_0<=45)||LA36_0==50) ) {
                alt36=1;
            }
            else if ( ((LA36_0>=RULE_STRING && LA36_0<=RULE_ID)||(LA36_0>=14 && LA36_0<=15)||LA36_0==28||(LA36_0>=58 && LA36_0<=59)||LA36_0==61||LA36_0==64||LA36_0==66||(LA36_0>=69 && LA36_0<=80)) ) {
                alt36=2;
            }
            else {
                if (state.backtracking>0) {state.failed=true; return current;}
                NoViableAltException nvae =
                    new NoViableAltException("", 36, 0, input);

                throw nvae;
            }
            switch (alt36) {
                case 1 :
                    // InternalPureXbase.g:2019:3: ( () ( ( ruleOpUnary ) ) ( (lv_operand_2_0= ruleXUnaryOperation ) ) )
                    {
                    // InternalPureXbase.g:2019:3: ( () ( ( ruleOpUnary ) ) ( (lv_operand_2_0= ruleXUnaryOperation ) ) )
                    // InternalPureXbase.g:2020:4: () ( ( ruleOpUnary ) ) ( (lv_operand_2_0= ruleXUnaryOperation ) )
                    {
                    // InternalPureXbase.g:2020:4: ()
                    // InternalPureXbase.g:2021:5: 
                    {
                    if ( state.backtracking==0 ) {

                      					current = forceCreateModelElement(
                      						grammarAccess.getXUnaryOperationAccess().getXUnaryOperationAction_0_0(),
                      						current);
                      				
                    }

                    }

                    // InternalPureXbase.g:2027:4: ( ( ruleOpUnary ) )
                    // InternalPureXbase.g:2028:5: ( ruleOpUnary )
                    {
                    // InternalPureXbase.g:2028:5: ( ruleOpUnary )
                    // InternalPureXbase.g:2029:6: ruleOpUnary
                    {
                    if ( state.backtracking==0 ) {

                      						if (current==null) {
                      							current = createModelElement(grammarAccess.getXUnaryOperationRule());
                      						}
                      					
                    }
                    if ( state.backtracking==0 ) {

                      						newCompositeNode(grammarAccess.getXUnaryOperationAccess().getFeatureJvmIdentifiableElementCrossReference_0_1_0());
                      					
                    }
                    pushFollow(FOLLOW_3);
                    ruleOpUnary();

                    state._fsp--;
                    if (state.failed) return current;
                    if ( state.backtracking==0 ) {

                      						afterParserOrEnumRuleCall();
                      					
                    }

                    }


                    }

                    // InternalPureXbase.g:2043:4: ( (lv_operand_2_0= ruleXUnaryOperation ) )
                    // InternalPureXbase.g:2044:5: (lv_operand_2_0= ruleXUnaryOperation )
                    {
                    // InternalPureXbase.g:2044:5: (lv_operand_2_0= ruleXUnaryOperation )
                    // InternalPureXbase.g:2045:6: lv_operand_2_0= ruleXUnaryOperation
                    {
                    if ( state.backtracking==0 ) {

                      						newCompositeNode(grammarAccess.getXUnaryOperationAccess().getOperandXUnaryOperationParserRuleCall_0_2_0());
                      					
                    }
                    pushFollow(FOLLOW_2);
                    lv_operand_2_0=ruleXUnaryOperation();

                    state._fsp--;
                    if (state.failed) return current;
                    if ( state.backtracking==0 ) {

                      						if (current==null) {
                      							current = createModelElementForParent(grammarAccess.getXUnaryOperationRule());
                      						}
                      						set(
                      							current,
                      							"operand",
                      							lv_operand_2_0,
                      							"org.eclipse.xtext.xbase.Xbase.XUnaryOperation");
                      						afterParserOrEnumRuleCall();
                      					
                    }

                    }


                    }


                    }


                    }
                    break;
                case 2 :
                    // InternalPureXbase.g:2064:3: this_XCastedExpression_3= ruleXCastedExpression
                    {
                    if ( state.backtracking==0 ) {

                      			newCompositeNode(grammarAccess.getXUnaryOperationAccess().getXCastedExpressionParserRuleCall_1());
                      		
                    }
                    pushFollow(FOLLOW_2);
                    this_XCastedExpression_3=ruleXCastedExpression();

                    state._fsp--;
                    if (state.failed) return current;
                    if ( state.backtracking==0 ) {

                      			current = this_XCastedExpression_3;
                      			afterParserOrEnumRuleCall();
                      		
                    }

                    }
                    break;

            }


            }

            if ( state.backtracking==0 ) {

              	leaveRule();

            }
        }

            catch (RecognitionException re) {
                recover(input,re);
                appendSkippedTokens();
            }
        finally {
        }
        return current;
    }
1266292
private void attributes( RuleDescrBuilder rule ) throws RecognitionException {
        if ( helper.validateIdentifierKey( DroolsSoftKeywords.ATTRIBUTES ) ) {
            match( input,
                   DRL5Lexer.ID,
                   DroolsSoftKeywords.ATTRIBUTES,
                   null,
                   DroolsEditorType.IDENTIFIER );
            if ( state.failed ) return;

            if ( input.LA( 1 ) == DRL5Lexer.COLON ) {
                match( input,
                       DRL5Lexer.COLON,
                       null,
                       null,
                       DroolsEditorType.SYMBOL );
                if ( state.failed ) return;
            }
        }

        if ( helper.validateAttribute( 1 ) ) {
            attribute( rule );
            if ( state.failed ) return;

            while ( input.LA( 1 ) == DRL5Lexer.COMMA || helper.validateAttribute( 1 ) ) {
                if ( input.LA( 1 ) == DRL5Lexer.COMMA ) {
                    match( input,
                           DRL5Lexer.COMMA,
                           null,
                           null,
                           DroolsEditorType.SYMBOL );
                    if ( state.failed ) return;
                }
                attribute( rule );
                if ( state.failed ) return;
            }
        }
    }
875580
private void addAttribute(Rule rule, String newAttribute, List<String> xmlLines) {
    List<Integer> linesToModify = new ArrayList<>();
    String currentRuleId = null;
    Pattern pattern = Pattern.compile(".*id=[\"'](.*?)[\"'].*");
    String expectedSubId = ((AbstractPatternRule) rule).getSubId();
    int lineCount = 0;
    int subRuleCount = 0;
    int modifyCount = 0;
    boolean inRuleGroup = false;
    for (String xmlLine : xmlLines) {
      if (xmlLine.contains("<rulegroup")) {
        subRuleCount = 0;
        inRuleGroup = true;
      } else if (xmlLine.contains("</rulegroup>")) {
        subRuleCount = 0;
        inRuleGroup = false;
      } else if ((xmlLine.contains("<rule ")||xmlLine.contains("<rule>")) && inRuleGroup) {
        subRuleCount++;
      }
      Matcher m = pattern.matcher(xmlLine);
      if (m.matches()) {
        currentRuleId = m.group(1);
      }
      if (xmlLine.contains("type=\"incorrect\"") || xmlLine.contains("type='incorrect'")) {
        if (currentRuleId != null && !currentRuleId.equals(rule.getId())) {
          lineCount++;
          continue;
        }
        if (!inRuleGroup) {
          subRuleCount = 1;
        }
        if (!expectedSubId.equals("0") && !expectedSubId.equals(String.valueOf(subRuleCount))) {
          lineCount++;
          continue;
        }
        linesToModify.add(lineCount);
        break;
      }
      lineCount++;
    }
    for (Integer s : linesToModify) {
      String newLine = xmlLines.get(s).replaceFirst("type=[\"']incorrect[\"']", newAttribute);
      xmlLines.set(s, newLine);
      addedCorrectionsCount++;
      modifyCount++;
    }
    if (modifyCount == 0) {
      System.err.println("No line modified: " + rule + "[" + expectedSubId + "]");
    }
  }
1290788
private void logTimeTakenByPhase(GraphContext graphContext, Class<? extends RulePhase> phase, int timeTaken)
    {
        if (!timeTakenByPhase.containsKey(phase))
        {
            RulePhaseExecutionStatisticsModel model = new GraphService<>(graphContext,
                        RulePhaseExecutionStatisticsModel.class).create();
            model.setRulePhase(phase.toString());
            model.setTimeTaken(timeTaken);
            model.setOrderExecuted(timeTakenByPhase.size());
            timeTakenByPhase.put(phase, model.getElement().id());
        }
        else
        {
            GraphService<RulePhaseExecutionStatisticsModel> service = new GraphService<>(graphContext,
                        RulePhaseExecutionStatisticsModel.class);
            RulePhaseExecutionStatisticsModel model = service.getById(timeTakenByPhase.get(phase));
            int prevTimeTaken = model.getTimeTaken();
            model.setTimeTaken(prevTimeTaken + timeTaken);
        }
    }
1144165
public final void setId(final ID id) {
    Assert.notNull(id, "The identifier for Rule ({0}) cannot be null!", getClass().getName());
    this.id = id;
  }
1037450
public Map<String,Transformer> getJavaSuffixRule() {
        Map<String,Transformer> sr = new HashMap<>();
        sr.put(".java", compileJavaPackages);
        return sr;
    }
773357
public final void mRULE_ID() throws RecognitionException {
        try {
            int _type = RULE_ID;
            int _channel = DEFAULT_TOKEN_CHANNEL;
            // InternalSimpleExpressions.g:800:9: ( ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* )
            // InternalSimpleExpressions.g:800:11: ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )*
            {
            // InternalSimpleExpressions.g:800:11: ( '^' )?
            int alt1=2;
            int LA1_0 = input.LA(1);

            if ( (LA1_0=='^') ) {
                alt1=1;
            }
            switch (alt1) {
                case 1 :
                    // InternalSimpleExpressions.g:800:11: '^'
                    {
                    match('^'); 

                    }
                    break;

            }

            if ( (input.LA(1)>='A' && input.LA(1)<='Z')||input.LA(1)=='_'||(input.LA(1)>='a' && input.LA(1)<='z') ) {
                input.consume();

            }
            else {
                MismatchedSetException mse = new MismatchedSetException(null,input);
                recover(mse);
                throw mse;}

            // InternalSimpleExpressions.g:800:40: ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )*
            loop2:
            do {
                int alt2=2;
                int LA2_0 = input.LA(1);

                if ( ((LA2_0>='0' && LA2_0<='9')||(LA2_0>='A' && LA2_0<='Z')||LA2_0=='_'||(LA2_0>='a' && LA2_0<='z')) ) {
                    alt2=1;
                }


                switch (alt2) {
            	case 1 :
            	    // InternalSimpleExpressions.g:
            	    {
            	    if ( (input.LA(1)>='0' && input.LA(1)<='9')||(input.LA(1)>='A' && input.LA(1)<='Z')||input.LA(1)=='_'||(input.LA(1)>='a' && input.LA(1)<='z') ) {
            	        input.consume();

            	    }
            	    else {
            	        MismatchedSetException mse = new MismatchedSetException(null,input);
            	        recover(mse);
            	        throw mse;}


            	    }
            	    break;

            	default :
            	    break loop2;
                }
            } while (true);


            }

            state.type = _type;
            state.channel = _channel;
        }
        finally {
        }
    }
1122027
public NeedleRule withOuter(final MethodRule rule) {
        if (rule instanceof InjectionProvider) {
            addInjectionProvider((InjectionProvider<?>) rule);
        }
        methodRuleChain.add(0, rule);
        return this;
    }
1157159
protected final String computeId(
            final ITemplateContext context,
            final IProcessableElementTag tag,
            final String name, final boolean sequence) {

        String id = tag.getAttributeValue(this.idAttributeDefinition.getAttributeName());
        if (!org.thymeleaf.util.StringUtils.isEmptyOrWhitespace(id)) {
            return (StringUtils.hasText(id) ? id : null);
        }

        id = FieldUtils.idFromName(name);
        if (sequence) {
            final Integer count = context.getIdentifierSequences().getAndIncrementIDSeq(id);
            return id + count.toString();
        }
        return id;

    }
1077954
public Rule getRule(int id) {
    Rule returnRule = null;
    for (Rule rule : this.getRules().getRule()) {
      if (rule.getId() == id) {
        returnRule = rule;
        break;
      }
    }
    return returnRule;
  }