Create a style with a single rule.

@param rule rule
@return the style
182950
public static UserStyleInfo createStyle(RuleInfo rule) {
		UserStyleInfo userStyleInfo = new UserStyleInfo();
		FeatureTypeStyleInfo fts = new FeatureTypeStyleInfo();
		fts.getRuleList().add(rule);
		userStyleInfo.getFeatureTypeStyleList().add(fts);
		return userStyleInfo;
	}
1176556
public static List<ExternalGraphic> externalGraphicsFromRule( Rule rule ) {
        List<ExternalGraphic> gList = new ArrayList<ExternalGraphic>();
        List<Symbolizer> symbolizers = rule.symbolizers();
        if (symbolizers.size() != 0) {
            for( Symbolizer symbolizer : symbolizers ) {
                Graphic[] graphics = new Graphic[2];
                if (symbolizer instanceof PointSymbolizer) {
                    PointSymbolizer pointSymbolizer = (PointSymbolizer) symbolizer;
                    graphics[0] = pointSymbolizer.getGraphic();
                } else if (symbolizer instanceof LineSymbolizer) {
                    LineSymbolizer lineSymbolizer = (LineSymbolizer) symbolizer;
                    Stroke stroke = lineSymbolizer.getStroke();
                    graphics[0] = stroke.getGraphicStroke();
                } else if (symbolizer instanceof PolygonSymbolizer) {
                    PolygonSymbolizer polygonSymbolizer = (PolygonSymbolizer) symbolizer;
                    Stroke stroke = polygonSymbolizer.getStroke();
                    if (stroke != null)
                        graphics[0] = stroke.getGraphicStroke();
                    Fill fill = polygonSymbolizer.getFill();
                    if (fill != null)
                        graphics[1] = fill.getGraphicFill();
                }
                for( int i = 0; i < graphics.length; i++ ) {
                    if (graphics[i] != null) {
                        for( GraphicalSymbol gs : graphics[i].graphicalSymbols() ) {
                            if ((gs != null) && (gs instanceof ExternalGraphic)) {
                                ExternalGraphic externalGraphic = (ExternalGraphic) gs;
                                gList.add(externalGraphic);
                            }
                        }
                    }
                }
            }
            return gList;
        }
        return Collections.emptyList();
    }
804465
public static Rule createDefaultLineRule() {
        LineSymbolizer lineSymbolizer = sf.createLineSymbolizer();
        lineSymbolizer.setStroke(createDefaultStroke());

        Rule rule = sf.createRule();
        rule.setName("New rule");
        rule.symbolizers().add(lineSymbolizer);

        return rule;
    }
890549
function createRuleListeners(rule, ruleContext) {
    try {
        return rule.create(ruleContext);
    } catch (ex) {
        ex.message = `Error while loading rule '${ruleContext.id}': ${ex.message}`;
        throw ex;
    }
}
158781
public Schema withRule(IValidationRule rule) {
		_rules = _rules != null ? _rules : new ArrayList<IValidationRule>();
		_rules.add(rule);
		return this;
	}
822389
public static TextSymbolizerInfo createSymbolizer(FontStyleInfo style) {
		TextSymbolizerInfo symbolizerInfo = new TextSymbolizerInfo();
		FontInfo font = new FontInfo();
		font.setFamily(style.getFamily());
		font.setStyle(style.getStyle());
		font.setWeight(style.getWeight());
		font.setSize(style.getSize());
		symbolizerInfo.setFont(font);
		symbolizerInfo.setFill(createFill(style.getColor(), style.getOpacity()));
		return symbolizerInfo;
	}
42995
public static Rule getRule(final String field, final String pattern) {
    try {
        return new LikeRule(field, Pattern.compile(pattern, Pattern.CASE_INSENSITIVE));
    } catch (PatternSyntaxException e) {
        throw new IllegalArgumentException(
                "Invalid LIKE rule - " + e.getMessage());
    }
  }
1319105
protected StringBuilder style(StringBuilder b, String line, Color color, Style style){
    if(color != Color.NONE || style != Style.NONE){
      b.append(color.ansiCode);
      b.append(style.ansiCode);
      b.append(line);
      b.append("\033[0m");
    } else {
      b.append(line);
    }
    return b;
  }
999986
function(rule){
    rule = basis.getter(rule || UNION);

    if (this.rule !== rule)
    {
      var oldRule = this.rule;

      this.rule = rule;
      this.emit_ruleChanged(oldRule);

      return this.applyRule();
    }
  }
1122027
public NeedleRule withOuter(final MethodRule rule) {
        if (rule instanceof InjectionProvider) {
            addInjectionProvider((InjectionProvider<?>) rule);
        }
        methodRuleChain.add(0, rule);
        return this;
    }
1012582
public <RO> SingleRuleContext<DPO, TDPO, RO> check(Rule<TDPO, RO> rule) {
        List<Rule<TDPO, RO>> addedRules = new ArrayList<Rule<TDPO, RO>>();
        if (rule != null) {
            addedRules.add(rule);
        }

        // Change context
        return new SingleRuleContext<DPO, TDPO, RO>(addedTriggers, addedDataProviders, dataProviderToRuleMapping,
                addedRuleInputTransformers, addedRules);
    }
914561
public AbstractCSSRuleImpl parseRule(final String rule) throws IOException {
        try (InputSource source = new InputSource(new StringReader(rule))) {
            final CSSOMHandler handler = new CSSOMHandler();
            parser_.setDocumentHandler(handler);
            parser_.parseRule(source);
            return (AbstractCSSRuleImpl) handler.getRoot();
        }
    }
746104
public static String getRuleName(AbstractRule rule) {
		return org.eclipse.xtext.xtext.generator.parser.antlr.AntlrGrammarGenUtil.getRuleName(rule);
	}
149066
public static PolygonSymbolizer polygonSymbolizerFromRule( Rule rule ) {
        List<Symbolizer> symbolizers = rule.symbolizers();
        PolygonSymbolizer polygonSymbolizer = null;
        for( Symbolizer symbolizer : symbolizers ) {
            if (symbolizer instanceof PolygonSymbolizer) {
                polygonSymbolizer = (PolygonSymbolizer) symbolizer;
                break;
            }
        }
        if (polygonSymbolizer == null) {
            throw new IllegalArgumentException();
        }
        return polygonSymbolizer;
    }
1163755
public static Rule createDefaultPolygonRule() {
        PolygonSymbolizer polygonSymbolizer = sf.createPolygonSymbolizer();
        Fill fill = createDefaultFill();
        polygonSymbolizer.setFill(fill);
        polygonSymbolizer.setStroke(createDefaultStroke());

        Rule rule = sf.createRule();
        rule.setName("New rule");
        rule.symbolizers().add(polygonSymbolizer);

        return rule;
    }
1052706
public static String escapeRuleId(Rule rule) {
        return rule != null ? rule.getId().replaceAll("\\:", "_") : null;
    }
261819
public void copyFrom(Rule rule) {
        setPolicy(rule.getPolicy());
        setCaptureStart(rule.getCaptureStart());
        setCaptureEnd(rule.getCaptureEnd());
        setPrivateComment(rule.getPrivateComment());
        setPublicComment(rule.getPublicComment());
        setRetrievalStart(rule.getRetrievalStart());
        setRetrievalEnd(rule.getRetrievalEnd());
        setSecondsSinceCapture(rule.getSecondsSinceCapture());
        setSurt(rule.getSurt());
        setWho(rule.getWho());
        setEnabled(rule.getEnabled());
        setExactMatch(rule.isExactMatch());
    }