本文整理汇总了Java中org.eclipse.xtend2.lib.StringConcatenation.appendImmediate方法的典型用法代码示例。如果您正苦于以下问题:Java StringConcatenation.appendImmediate方法的具体用法?Java StringConcatenation.appendImmediate怎么用?Java StringConcatenation.appendImmediate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.xtend2.lib.StringConcatenation
的用法示例。
在下文中一共展示了StringConcatenation.appendImmediate方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toQualifiedNames
import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
protected <T extends Object> CharSequence toQualifiedNames(final List<T> it, final Function1<? super T, ? extends String> toQualifiedNameFunction) {
CharSequence _xblockexpression = null;
{
if (((it == null) || (it.size() == 0))) {
return "";
}
StringConcatenation _builder = new StringConcatenation();
{
boolean _hasElements = false;
for(final T element : it) {
if (!_hasElements) {
_hasElements = true;
} else {
_builder.appendImmediate(", ", "");
}
String _apply = toQualifiedNameFunction.apply(element);
_builder.append(_apply);
}
}
_xblockexpression = _builder;
}
return _xblockexpression;
}
示例2: _compileInitHiddenTokens
import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
protected CharSequence _compileInitHiddenTokens(final ParserRule it, final AntlrOptions options) {
StringConcatenation _builder = new StringConcatenation();
{
boolean _isDefinesHiddenTokens = it.isDefinesHiddenTokens();
if (_isDefinesHiddenTokens) {
_builder.append("HiddenTokens myHiddenTokenState = ((XtextTokenStream)input).setHiddenTokens(");
{
EList<AbstractRule> _hiddenTokens = it.getHiddenTokens();
boolean _hasElements = false;
for(final AbstractRule hidden : _hiddenTokens) {
if (!_hasElements) {
_hasElements = true;
} else {
_builder.appendImmediate(", ", "");
}
_builder.append("\"");
String _ruleName = this._grammarAccessExtensions.ruleName(hidden);
_builder.append(_ruleName);
_builder.append("\"");
}
}
_builder.append(");");
}
}
return _builder;
}
示例3: _dataTypeEbnf2
import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
protected String _dataTypeEbnf2(final Alternatives it, final boolean supportActions) {
StringConcatenation _builder = new StringConcatenation();
{
EList<AbstractElement> _elements = it.getElements();
boolean _hasElements = false;
for(final AbstractElement e : _elements) {
if (!_hasElements) {
_hasElements = true;
} else {
_builder.appendImmediate("\n |", "");
}
String _dataTypeEbnf = this.dataTypeEbnf(e, supportActions);
_builder.append(_dataTypeEbnf);
}
}
_builder.newLineIfNotEmpty();
return _builder.toString();
}
示例4: _ebnf2
import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
protected String _ebnf2(final Alternatives it, final AntlrOptions options, final boolean supportActions) {
StringConcatenation _builder = new StringConcatenation();
{
EList<AbstractElement> _elements = it.getElements();
boolean _hasElements = false;
for(final AbstractElement element : _elements) {
if (!_hasElements) {
_hasElements = true;
} else {
_builder.appendImmediate("\n |", "");
}
String _ebnf = this.ebnf(element, options, supportActions);
_builder.append(_ebnf);
}
}
_builder.newLineIfNotEmpty();
return _builder.toString();
}
示例5: testAppendImmediateComplex
import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
@Test
public void testAppendImmediateComplex() {
final StringConcatenation c = new StringConcatenation("\n");
c.append("a\n");
c.append(" b ");
c.newLineIfNotEmpty();
c.append(" ");
c.appendImmediate("c\nd", " ");
assertEquals("a\n b c\n d\n", c.toString());
}
示例6: _getLabel
import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
private String _getLabel(final Operation it) {
StringConcatenation _builder = new StringConcatenation();
String _name = EcoreUtil2.<TypeDeclaration>getContainerOfType(it, TypeDeclaration.class).getName();
_builder.append(_name);
_builder.append(".");
String _name_1 = it.getName();
_builder.append(_name_1);
_builder.append("(");
{
EList<Parameter> _params = it.getParams();
boolean _hasElements = false;
for(final Parameter p : _params) {
if (!_hasElements) {
_hasElements = true;
} else {
_builder.appendImmediate(", ", "");
}
String _name_2 = p.getName();
_builder.append(_name_2);
_builder.append(": ");
String _label = this.getLabel(p.getType());
_builder.append(_label);
}
}
_builder.append("): ");
{
Type _returnType = it.getReturnType();
boolean _tripleEquals = (_returnType == null);
if (_tripleEquals) {
_builder.append("void");
} else {
String _label_1 = this.getLabel(it.getReturnType());
_builder.append(_label_1);
}
}
return _builder.toString();
}
示例7: _compileInitUnorderedGroups
import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
protected CharSequence _compileInitUnorderedGroups(final ParserRule it, final AntlrOptions options) {
StringConcatenation _builder = new StringConcatenation();
{
boolean _definesUnorderedGroups = this._grammarAccessExtensions.definesUnorderedGroups(it, options);
if (_definesUnorderedGroups) {
_builder.newLineIfNotEmpty();
_builder.append("UnorderedGroupState myUnorderedGroupState = getUnorderedGroupHelper().snapShot(");
_builder.newLine();
{
Iterable<UnorderedGroup> _filter = Iterables.<UnorderedGroup>filter(EcoreUtil2.eAllContentsAsList(it), UnorderedGroup.class);
boolean _hasElements = false;
for(final UnorderedGroup group : _filter) {
if (!_hasElements) {
_hasElements = true;
} else {
_builder.appendImmediate(", ", "");
}
_builder.append("grammarAccess.");
UnorderedGroup _originalElement = AntlrGrammarGenUtil.<UnorderedGroup>getOriginalElement(group);
String _gaRuleElementAccessor = this._grammarAccessExtensions.gaRuleElementAccessor(((AbstractElement) _originalElement));
_builder.append(_gaRuleElementAccessor);
_builder.newLineIfNotEmpty();
}
}
_builder.append(");");
}
}
return _builder;
}
示例8: ebnfPredicate
import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
protected String ebnfPredicate(final AbstractElement it, final AntlrOptions options) {
StringConcatenation _builder = new StringConcatenation();
{
if ((this._grammarAccessExtensions.predicated(it) || it.isFirstSetPredicated())) {
_builder.append("(");
{
boolean _predicated = this._grammarAccessExtensions.predicated(it);
if (_predicated) {
String _ebnf2 = this.ebnf2(this._grammarAccessExtensions.predicatedElement(it), options, false);
_builder.append(_ebnf2);
} else {
{
List<AbstractElement> _firstSet = AntlrGrammarGenUtil.getFirstSet(it);
boolean _hasElements = false;
for(final AbstractElement e : _firstSet) {
if (!_hasElements) {
_hasElements = true;
} else {
_builder.appendImmediate(" | ", "");
}
String _ebnf2_1 = this.ebnf2(e, options, false);
_builder.append(_ebnf2_1);
}
}
}
}
_builder.append(")=>");
}
}
_builder.newLineIfNotEmpty();
return _builder.toString();
}
示例9: dataTypeEbnfPredicate
import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
protected String dataTypeEbnfPredicate(final AbstractElement it) {
StringConcatenation _builder = new StringConcatenation();
{
if ((this._grammarAccessExtensions.predicated(it) || it.isFirstSetPredicated())) {
_builder.append("(");
{
boolean _predicated = this._grammarAccessExtensions.predicated(it);
if (_predicated) {
String _dataTypeEbnf2 = this.dataTypeEbnf2(this._grammarAccessExtensions.predicatedElement(it), false);
_builder.append(_dataTypeEbnf2);
} else {
{
List<AbstractElement> _firstSet = AntlrGrammarGenUtil.getFirstSet(it);
boolean _hasElements = false;
for(final AbstractElement e : _firstSet) {
if (!_hasElements) {
_hasElements = true;
} else {
_builder.appendImmediate(" | ", "");
}
String _dataTypeEbnf2_1 = this.dataTypeEbnf2(e, false);
_builder.append(_dataTypeEbnf2_1);
}
}
}
}
_builder.append(")=>");
}
}
_builder.newLineIfNotEmpty();
return _builder.toString();
}
示例10: processPage
import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
public CharSequence processPage(final Page p) {
StringConcatenation _builder = new StringConcatenation();
_builder.append("{");
_builder.newLine();
_builder.append("\t");
{
String _title = p.getTitle();
boolean _notEquals = (!Objects.equal(_title, null));
if (_notEquals) {
_builder.append("title: \"");
String _title_1 = p.getTitle();
_builder.append(_title_1, "\t");
_builder.append("\",");
}
}
_builder.newLineIfNotEmpty();
_builder.append("\t");
{
String _visibleIf = p.getVisibleIf();
boolean _notEquals_1 = (!Objects.equal(_visibleIf, null));
if (_notEquals_1) {
_builder.append("visibleIf: \",");
String _visibleIf_1 = p.getVisibleIf();
_builder.append(_visibleIf_1, "\t");
_builder.append("\"");
}
}
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.newLine();
_builder.append("\t");
this.initializeQuestions(p);
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("questions: [");
_builder.newLine();
{
boolean _hasElements = false;
for(final Question q : this.questions) {
if (!_hasElements) {
_hasElements = true;
} else {
_builder.appendImmediate(",", "\t");
}
_builder.append("\t");
CharSequence _processQuestion = this.processQuestion(q);
_builder.append(_processQuestion, "\t");
_builder.newLineIfNotEmpty();
}
}
_builder.append("\t\t");
_builder.newLine();
_builder.append("\t");
_builder.append("]");
_builder.newLine();
_builder.append("}");
_builder.newLine();
return _builder;
}
示例11: testAppendImmediateSimple
import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
@Test
public void testAppendImmediateSimple() {
final StringConcatenation c = new StringConcatenation();
c.appendImmediate("a", " ");
assertEquals("a", c.toString());
}
示例12: generateKeywords
import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
protected CharSequence generateKeywords(final List<String> wordKeywords, final List<String> nonWordKeywords) {
StringConcatenation _builder = new StringConcatenation();
{
boolean _isEmpty = wordKeywords.isEmpty();
boolean _not = (!_isEmpty);
if (_not) {
_builder.append("var keywords = \"");
{
boolean _hasElements = false;
for(final String kw : wordKeywords) {
if (!_hasElements) {
_hasElements = true;
} else {
_builder.appendImmediate("|", "");
}
String _regexpString = RegexpExtensions.toRegexpString(kw, ((!Objects.equal(this.framework.get(), WebIntegrationFragment.Framework.CODEMIRROR)) && this.ignoreCase));
_builder.append(_regexpString);
}
}
_builder.append("\";");
_builder.newLineIfNotEmpty();
}
}
{
boolean _isEmpty_1 = nonWordKeywords.isEmpty();
boolean _not_1 = (!_isEmpty_1);
if (_not_1) {
_builder.append("var extraKeywords = \"");
{
boolean _hasElements_1 = false;
for(final String kw_1 : nonWordKeywords) {
if (!_hasElements_1) {
_hasElements_1 = true;
} else {
_builder.appendImmediate("|", "");
}
String _regexpString_1 = RegexpExtensions.toRegexpString(kw_1, ((!Objects.equal(this.framework.get(), WebIntegrationFragment.Framework.CODEMIRROR)) && this.ignoreCase));
_builder.append(_regexpString_1);
}
}
_builder.append("\";");
_builder.newLineIfNotEmpty();
}
}
return _builder;
}
示例13: _compileRule
import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
protected CharSequence _compileRule(final Alternatives 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.<Alternatives>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");
{
EList<AbstractElement> _elements = it.getElements();
boolean _hasElements = false;
for(final AbstractElement element : _elements) {
if (!_hasElements) {
_hasElements = true;
} else {
_builder.appendImmediate("\n|", "\t");
}
String _ebnf = this.ebnf(element, options, false);
_builder.append(_ebnf, "\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;
}