本文整理汇总了Java中org.eclipse.xtend2.lib.StringConcatenation.newLineIfNotEmpty方法的典型用法代码示例。如果您正苦于以下问题:Java StringConcatenation.newLineIfNotEmpty方法的具体用法?Java StringConcatenation.newLineIfNotEmpty怎么用?Java StringConcatenation.newLineIfNotEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.xtend2.lib.StringConcatenation
的用法示例。
在下文中一共展示了StringConcatenation.newLineIfNotEmpty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: compilarTexto
import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
public CharSequence compilarTexto(final Postre p) {
StringConcatenation _builder = new StringConcatenation();
{
boolean _isHelado = p.isHelado();
if (_isHelado) {
_builder.append("Tipo de producto: Helado");
_builder.newLineIfNotEmpty();
} else {
_builder.append("Tipo de producto: Postre no helado");
_builder.newLineIfNotEmpty();
}
}
_builder.append("Distribuidor: ");
Distribuidor _distribuidor = p.getDistribuidor();
_builder.append(_distribuidor);
_builder.newLineIfNotEmpty();
_builder.append("Listado de ingredientes: ");
String _ingredientes = this.ingredientes(p.getIngredientes());
_builder.append(_ingredientes);
_builder.newLineIfNotEmpty();
return _builder;
}
示例2: asText
import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
private StringConcatenation asText(final OtherTreeNode treeNode) {
StringConcatenation _builder = new StringConcatenation();
String _name = treeNode.getName();
_builder.append(_name);
_builder.newLineIfNotEmpty();
{
ChildList _childList = treeNode.getChildList();
boolean _tripleNotEquals = (_childList != null);
if (_tripleNotEquals) {
_builder.append("\t");
_builder.append(">");
_builder.newLine();
{
EList<OtherTreeNode> _children = treeNode.getChildList().getChildren();
for(final OtherTreeNode node : _children) {
_builder.append("\t");
_builder.append("\t");
StringConcatenation _asText = this.asText(node);
_builder.append(_asText, "\t\t");
_builder.newLineIfNotEmpty();
}
}
}
}
return _builder;
}
示例3: compileTerminalRules
import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
protected CharSequence compileTerminalRules(final Grammar it, final AntlrOptions options) {
StringConcatenation _builder = new StringConcatenation();
{
boolean _isBacktrackLexer = options.isBacktrackLexer();
if (_isBacktrackLexer) {
_builder.newLine();
_builder.append("// Rules duplicated to allow inter-rule references");
_builder.newLine();
}
}
{
List<TerminalRule> _allTerminalRules = GrammarUtil.allTerminalRules(it);
for(final TerminalRule rule : _allTerminalRules) {
_builder.newLine();
CharSequence _compileRule = this.compileRule(rule, it, options);
_builder.append(_compileRule);
_builder.newLineIfNotEmpty();
}
}
return _builder;
}
示例4: handleMismatch
import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
@Override
public void handleMismatch(final String match, final String matchReference, final AntlrGrammarComparator.ErrorContext context) {
XtextAntlrGeneratorComparisonFragment.copyFile(context.getReferenceGrammar().getAbsoluteFileName(), context.getTestedGrammar().getAbsoluteFileName());
StringConcatenation _builder = new StringConcatenation();
_builder.append("Generated grammar ");
String _absoluteFileName = context.getTestedGrammar().getAbsoluteFileName();
_builder.append(_absoluteFileName);
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("differs at token ");
_builder.append(match, "\t");
_builder.append(" (line ");
int _lineNumber = context.getTestedGrammar().getLineNumber();
_builder.append(_lineNumber, "\t");
_builder.append("), expected token ");
_builder.append(matchReference, "\t");
_builder.append(" (line ");
int _lineNumber_1 = context.getReferenceGrammar().getLineNumber();
_builder.append(_lineNumber_1, "\t");
_builder.append(").");
throw new RuntimeException(_builder.toString());
}
示例5: recursionHandling_02
import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
@Test
public void recursionHandling_02() {
final ToStringHelper helper = new ToStringHelper();
final ToStringHelperTest.DataClass obj = new ToStringHelperTest.DataClass();
obj.other = obj;
obj.name = "test";
StringConcatenation _builder = new StringConcatenation();
_builder.append("DataClass [");
_builder.newLine();
_builder.append(" ");
_builder.append("other = [email protected]");
int _identityHashCode = System.identityHashCode(obj);
_builder.append(_identityHashCode, " ");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("name = \"test\"");
_builder.newLine();
_builder.append("]");
Assert.assertEquals(
ToStringHelperTest.toUnix(_builder.toString()), helper.toString(obj));
}
示例6: _assignmentEbnf
import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
@Override
protected String _assignmentEbnf(final RuleCall it, final Assignment assignment, final AntlrOptions options, final boolean supportsActions) {
StringConcatenation _builder = new StringConcatenation();
_builder.append("(");
_builder.newLine();
_builder.append("\t");
_builder.append("{ before(grammarAccess.");
String _grammarElementAccess = this._grammarAccessExtensions.grammarElementAccess(AntlrGrammarGenUtil.<RuleCall>getOriginalElement(it));
_builder.append(_grammarElementAccess, "\t");
_builder.append("); }");
_builder.newLineIfNotEmpty();
_builder.append("\t");
String _ruleName = this._grammarAccessExtensions.ruleName(it.getRule());
_builder.append(_ruleName, "\t");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("{ after(grammarAccess.");
String _grammarElementAccess_1 = this._grammarAccessExtensions.grammarElementAccess(AntlrGrammarGenUtil.<RuleCall>getOriginalElement(it));
_builder.append(_grammarElementAccess_1, "\t");
_builder.append("); }");
_builder.newLineIfNotEmpty();
_builder.append(")");
_builder.newLine();
return _builder.toString();
}
示例7: compilarTexto
import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
public CharSequence compilarTexto(final Restaurante r) {
StringConcatenation _builder = new StringConcatenation();
this.fsa.generateFile("scripts/ingredientes_gen.inc", this.compilarIngredientes(r.getIngredientes()));
_builder.newLineIfNotEmpty();
this.fsa.generateFile("scripts/productos_gen.inc", this.compilarProductos(r.getProductos()));
_builder.newLineIfNotEmpty();
this.fsa.generateFile("scripts/menus_gen.inc", this.compilarMenus(r.getMenus()));
_builder.newLineIfNotEmpty();
return _builder;
}
示例8: compilarIngredientes
import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
public CharSequence compilarIngredientes(final List<Ingrediente> ingredientes) {
StringConcatenation _builder = new StringConcatenation();
_builder.append("var code = \'<table class=\"tingredientes\">\\");
_builder.newLine();
_builder.append("\t");
_builder.append("<tr class=\"tingredientes_cabecera\">\\");
_builder.newLine();
_builder.append("\t\t");
_builder.append("<td></td>\\");
_builder.newLine();
_builder.append("\t\t");
_builder.append("<td>Ingrediente</td>\\");
_builder.newLine();
_builder.append("\t\t");
_builder.append("<td>Al�rgeno</td>\\");
_builder.newLine();
_builder.append("\t");
_builder.append("</tr>\\");
_builder.newLine();
{
for(final Ingrediente i : ingredientes) {
_builder.append("\t");
CharSequence _compilarTexto = this.compilarTexto(i);
_builder.append(_compilarTexto, "\t");
_builder.newLineIfNotEmpty();
}
}
_builder.append("</table>\';");
_builder.newLine();
return _builder;
}
示例9: compilarProductos
import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
public CharSequence compilarProductos(final List<Producto> productos) {
StringConcatenation _builder = new StringConcatenation();
_builder.append("var code = \'");
{
for(final Producto p : productos) {
CharSequence _compilarTexto = this.compilarTexto(p);
_builder.append(_compilarTexto);
}
}
_builder.append("\';");
_builder.newLineIfNotEmpty();
return _builder;
}
示例10: compilarMenus
import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
public CharSequence compilarMenus(final List<Menu> menus) {
StringConcatenation _builder = new StringConcatenation();
_builder.append("var code = \'");
{
for(final Menu m : menus) {
CharSequence _compilarTexto = this.compilarTexto(m);
_builder.append(_compilarTexto);
}
}
_builder.append("\';");
_builder.newLineIfNotEmpty();
return _builder;
}
示例11: informacionNutricional
import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
public CharSequence informacionNutricional(final Nutricional n) {
StringConcatenation _builder = new StringConcatenation();
_builder.append("Por cada ");
String _cantidad = n.getCantidad();
_builder.append(_cantidad);
String _unidad = n.getUnidad();
_builder.append(_unidad);
_builder.append(" de producto se proporciona:");
_builder.newLineIfNotEmpty();
_builder.append("\t");
String _energia = n.getEnergia();
_builder.append(_energia, "\t");
_builder.append("Kcal de energ�a, ");
String _grasas = n.getGrasas();
_builder.append(_grasas, "\t");
_builder.append("g de grasa, ");
String _hidratos = n.getHidratos();
_builder.append(_hidratos, "\t");
_builder.append("g de hidratos de carbono ");
String _proteinas = n.getProteinas();
_builder.append(_proteinas, "\t");
_builder.append("g de proteinas ");
String _sal = n.getSal();
_builder.append(_sal, "\t");
_builder.append("g de sal");
_builder.newLineIfNotEmpty();
return _builder;
}
示例12: getConfiguration
import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
@Override
public String getConfiguration(final String editorName) {
if ((Objects.equal(editorName, "EclipseChe") || Objects.equal(editorName, "EclipseOrion"))) {
StringConcatenation _builder = new StringConcatenation();
_builder.append("[");
_builder.newLine();
_builder.append(" ");
CharSequence _getStandardPatterns = this.getGetStandardPatterns();
_builder.append(_getStandardPatterns, " ");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("{");
_builder.newLine();
_builder.append(" ");
_builder.append("match: \"\\\\b(?:");
String _join = IterableExtensions.join(this.getKeywords(), "|");
_builder.append(_join, " ");
_builder.append(")\\\\b\", ");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("name: \"keyword.");
String _shortName = this.languageInfo.getShortName();
_builder.append(_shortName, " ");
_builder.append("\" ");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("}");
_builder.newLine();
_builder.append("]");
_builder.newLine();
return _builder.toString();
} else {
StringConcatenation _builder_1 = new StringConcatenation();
return _builder_1.toString();
}
}
示例13: multiLineString
import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
private String multiLineString() {
StringConcatenation _builder = new StringConcatenation();
_builder.append("test ");
_builder.newLine();
_builder.append("bar");
_builder.newLine();
_builder.append("\t");
CharSequence _other = this.other();
_builder.append(_other, "\t");
_builder.newLineIfNotEmpty();
return _builder.toString();
}
示例14: generateProperty
import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
public CharSequence generateProperty(final Property it) {
StringConcatenation _builder = new StringConcatenation();
_builder.append("Property ");
String _name = it.getName();
_builder.append(_name);
_builder.append(" : ");
String _name_1 = IterableExtensions.<Type>head(it.getType()).getName();
_builder.append(_name_1);
_builder.newLineIfNotEmpty();
return _builder;
}
示例15: _compileRule
import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
protected CharSequence _compileRule(final Assignment it, final Grammar grammar, final AntlrOptions options) {
StringConcatenation _builder = new StringConcatenation();
String _contentAssistRuleName = AntlrGrammarGenUtil.getContentAssistRuleName(GrammarUtil.containingRule(it));
_builder.append(_contentAssistRuleName);
_builder.append("__");
String _gaElementIdentifier = this._grammarAccessExtensions.gaElementIdentifier(AntlrGrammarGenUtil.<Assignment>getOriginalElement(it));
_builder.append(_gaElementIdentifier);
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("@init {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("int stackSize = keepStackSize();");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append(":");
_builder.newLine();
_builder.append("\t");
String _assignmentEbnf = this.assignmentEbnf(it.getTerminal(), it, options, false);
_builder.append(_assignmentEbnf, "\t");
_builder.newLineIfNotEmpty();
_builder.append(";");
_builder.newLine();
_builder.append("finally {");
_builder.newLine();
_builder.append("\t");
_builder.append("restoreStackSize(stackSize);");
_builder.newLine();
_builder.append("}");
_builder.newLine();
return _builder;
}