本文整理汇总了Java中org.eclipse.xtext.xbase.lib.IterableExtensions.findFirst方法的典型用法代码示例。如果您正苦于以下问题:Java IterableExtensions.findFirst方法的具体用法?Java IterableExtensions.findFirst怎么用?Java IterableExtensions.findFirst使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.xtext.xbase.lib.IterableExtensions
的用法示例。
在下文中一共展示了IterableExtensions.findFirst方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setMarker
import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setMarker(final String theKey, final String value) {
final Function1<Marker, Boolean> _function = new Function1<Marker, Boolean>() {
public Boolean apply(final Marker it) {
String _key = it.getKey();
String _key_1 = it.getKey();
return Boolean.valueOf(Objects.equal(_key, _key_1));
}
};
Marker marker = IterableExtensions.<Marker>findFirst(this.getMarkers(), _function);
if ((marker == null)) {
marker = DomFactory.eINSTANCE.createMarker();
marker.setKey(theKey);
this.getMarkers().add(marker);
}
marker.setValue(value);
}
示例2: getPortableURIFragment
import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
/**
* @return a portable URI fragment, or <code>null</code> if the give EObject isn't itself or is not contained in an exported EObjectDescription
*/
protected String getPortableURIFragment(final EObject obj) {
final IResourceDescriptions descriptions = this.resourceDescriptionsProvider.getResourceDescriptions(obj.eResource());
final IResourceDescription desc = descriptions.getResourceDescription(obj.eResource().getURI());
if ((desc == null)) {
return null;
}
final Function1<IEObjectDescription, Boolean> _function = (IEObjectDescription it) -> {
boolean _xblockexpression = false;
{
final EObject possibleContainer = EcoreUtil.resolve(it.getEObjectOrProxy(), obj.eResource());
_xblockexpression = (Objects.equal(obj, possibleContainer) || EcoreUtil.isAncestor(obj, possibleContainer));
}
return Boolean.valueOf(_xblockexpression);
};
final IEObjectDescription containerDesc = IterableExtensions.<IEObjectDescription>findFirst(desc.getExportedObjects(), _function);
if ((containerDesc != null)) {
final PortableURIs.PortableFragmentDescription fragmentDescription = this.createPortableFragmentDescription(containerDesc, obj);
return this.toFragmentString(fragmentDescription);
}
return null;
}
示例3: idAttribute
import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
public static EAttribute idAttribute(final EClass it) {
EAttribute _xblockexpression = null;
{
final EAttribute idAttr = Ecore2XtextExtensions.idAttributeInternal(it);
EAttribute _xifexpression = null;
if ((idAttr != null)) {
_xifexpression = idAttr;
} else {
final Function1<EAttribute, Boolean> _function = (EAttribute a) -> {
return Boolean.valueOf((((Ecore2XtextExtensions.needsAssignment(a) && Objects.equal(a.getName(), "name")) && Objects.equal(a.getEType().getName(), "EString")) && (!a.isMany())));
};
_xifexpression = IterableExtensions.<EAttribute>findFirst(it.getEAllAttributes(), _function);
}
_xblockexpression = _xifexpression;
}
return _xblockexpression;
}
示例4: getOwnedCtor
import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public N4MethodDeclaration getOwnedCtor() {
final Function1<N4MethodDeclaration, Boolean> _function = new Function1<N4MethodDeclaration, Boolean>() {
public Boolean apply(final N4MethodDeclaration it) {
return Boolean.valueOf(it.isConstructor());
}
};
return IterableExtensions.<N4MethodDeclaration>findFirst(Iterables.<N4MethodDeclaration>filter(this.getOwnedMembersRaw(), N4MethodDeclaration.class), _function);
}
示例5: getOwnedCallableCtor
import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public N4MethodDeclaration getOwnedCallableCtor() {
final Function1<N4MethodDeclaration, Boolean> _function = new Function1<N4MethodDeclaration, Boolean>() {
public Boolean apply(final N4MethodDeclaration it) {
return Boolean.valueOf(it.isCallableConstructor());
}
};
return IterableExtensions.<N4MethodDeclaration>findFirst(Iterables.<N4MethodDeclaration>filter(this.getOwnedMembersRaw(), N4MethodDeclaration.class), _function);
}
示例6: getDefaultClause
import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public DefaultClause getDefaultClause() {
final Function1<AbstractCaseClause, Boolean> _function = new Function1<AbstractCaseClause, Boolean>() {
public Boolean apply(final AbstractCaseClause it) {
return Boolean.valueOf((it instanceof DefaultClause));
}
};
AbstractCaseClause _findFirst = IterableExtensions.<AbstractCaseClause>findFirst(this.getCases(), _function);
return ((DefaultClause) _findFirst);
}
示例7: getOwnedCtor
import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public TMethod getOwnedCtor() {
final Function1<TMethod, Boolean> _function = new Function1<TMethod, Boolean>() {
public Boolean apply(final TMethod it) {
return Boolean.valueOf(it.getName().equals("constructor"));
}
};
return IterableExtensions.<TMethod>findFirst(Iterables.<TMethod>filter(this.getOwnedMembers(), TMethod.class), _function);
}
示例8: getOwnedCtor
import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public TMethod getOwnedCtor() {
final Function1<TMethod, Boolean> _function = new Function1<TMethod, Boolean>() {
public Boolean apply(final TMethod it) {
return Boolean.valueOf(it.isConstructor());
}
};
return IterableExtensions.<TMethod>findFirst(Iterables.<TMethod>filter(this.getOwnedMembers(), TMethod.class), _function);
}
示例9: getValueByKey
import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public TagValue getValueByKey(final String theKey) {
final Function1<TagValue, Boolean> _function = new Function1<TagValue, Boolean>() {
public Boolean apply(final TagValue it) {
String _key = it.getKey();
return Boolean.valueOf(Objects.equal(_key, theKey));
}
};
return IterableExtensions.<TagValue>findFirst(this.getValues(), _function);
}
示例10: getMarkerValue
import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getMarkerValue(final String theKey) {
final Function1<Marker, Boolean> _function = new Function1<Marker, Boolean>() {
public Boolean apply(final Marker it) {
String _key = it.getKey();
return Boolean.valueOf(Objects.equal(_key, theKey));
}
};
Marker _findFirst = IterableExtensions.<Marker>findFirst(this.getMarkers(), _function);
String _value = null;
if (_findFirst!=null) {
_value=_findFirst.getValue();
}
return _value;
}
示例11: isMarkedAs
import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isMarkedAs(final String theKey, final String theValue) {
final Function1<Marker, Boolean> _function = new Function1<Marker, Boolean>() {
public Boolean apply(final Marker it) {
return Boolean.valueOf((Objects.equal(it.getKey(), theKey) && Objects.equal(it.getValue(), theValue)));
}
};
Marker _findFirst = IterableExtensions.<Marker>findFirst(this.getMarkers(), _function);
return (_findFirst != null);
}
示例12: hasLineTag
import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean hasLineTag(final String title) {
final Function1<LineTag, Boolean> _function = new Function1<LineTag, Boolean>() {
public Boolean apply(final LineTag it) {
String _title = it.getTitle().getTitle();
return Boolean.valueOf(Objects.equal(_title, title));
}
};
LineTag _findFirst = IterableExtensions.<LineTag>findFirst(this.getLineTags(), _function);
return (_findFirst != null);
}
示例13: testOverridenInterfaceMethod
import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
@Test
public void testOverridenInterfaceMethod() {
StringConcatenation _builder = new StringConcatenation();
_builder.append("public interface MySuperClass {");
_builder.newLine();
_builder.append(" ");
_builder.append("public java.util.Collection<? extends CharSequence> getThem();");
_builder.newLine();
_builder.append("}");
_builder.newLine();
Pair<String, String> _mappedTo = Pair.<String, String>of("MySuperClass.java", _builder.toString());
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("public interface MySubClass extends MySuperClass {");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("@Override");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("public java.util.List<? extends String> getThem();");
_builder_1.newLine();
_builder_1.append("}");
_builder_1.newLine();
Pair<String, String> _mappedTo_1 = Pair.<String, String>of("MySubClass.java", _builder_1.toString());
final XtextResourceSet rs = this.resourceSet(_mappedTo, _mappedTo_1);
final Function1<Resource, Boolean> _function = (Resource it) -> {
return Boolean.valueOf(it.getURI().toString().endsWith("MySubClass.java"));
};
final Resource resource = IterableExtensions.<Resource>findFirst(rs.getResources(), _function);
EObject _head = IterableExtensions.<EObject>head(resource.getContents());
final JvmGenericType clazz = ((JvmGenericType) _head);
final JvmTypeReference referenced = IterableExtensions.<JvmOperation>head(clazz.getDeclaredOperations()).getReturnType();
Assert.assertNotNull(IterableExtensions.<JvmTypeReference>head(((JvmParameterizedTypeReference) referenced).getArguments()));
}
示例14: testClassShadowing
import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
@Test
public void testClassShadowing() {
StringConcatenation _builder = new StringConcatenation();
_builder.append("package org.eclipse.xtext.java.tests;");
_builder.newLine();
_builder.append("public class MySuperClass2 {");
_builder.newLine();
_builder.append(" ");
_builder.append("public void doSomething() {");
_builder.newLine();
_builder.append(" ");
_builder.newLine();
_builder.append(" ");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
Pair<String, String> _mappedTo = Pair.<String, String>of("org/eclipse/xtext/java/tests/MySuperClass2.java", _builder.toString());
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("package org.eclipse.xtext.java.tests;");
_builder_1.newLine();
_builder_1.append("public class MySubClass2 extends MySuperClass2 {");
_builder_1.newLine();
_builder_1.append("}");
_builder_1.newLine();
Pair<String, String> _mappedTo_1 = Pair.<String, String>of("org/eclipse/xtext/java/tests/MySubClass2.java", _builder_1.toString());
final XtextResourceSet rs = this.resourceSet(_mappedTo, _mappedTo_1);
final Function1<Resource, Boolean> _function = (Resource it) -> {
return Boolean.valueOf(it.getURI().toString().endsWith("MySuperClass2.java"));
};
final Resource superResource = IterableExtensions.<Resource>findFirst(rs.getResources(), _function);
EObject _head = IterableExtensions.<EObject>head(superResource.getContents());
final JvmGenericType clazz = ((JvmGenericType) _head);
Assert.assertNotNull(IterableExtensions.<JvmOperation>head(clazz.getDeclaredOperations()));
}
示例15: nodeForKeyword
import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
public ILeafNode nodeForKeyword(final EObject obj, final String kw) {
ILeafNode _xblockexpression = null;
{
final ICompositeNode node = NodeModelUtils.findActualNodeFor(obj);
final Function1<INode, Boolean> _function = (INode it) -> {
return Boolean.valueOf(((Objects.equal(it.getSemanticElement(), obj) && (it.getGrammarElement() instanceof Keyword)) && Objects.equal(it.getText(), kw)));
};
INode _findFirst = IterableExtensions.<INode>findFirst(node.getAsTreeIterable(), _function);
_xblockexpression = ((ILeafNode) _findFirst);
}
return _xblockexpression;
}