当前位置: 首页>>代码示例>>Java>>正文


Java Function1类代码示例

本文整理汇总了Java中org.eclipse.xtext.xbase.lib.Functions.Function1的典型用法代码示例。如果您正苦于以下问题:Java Function1类的具体用法?Java Function1怎么用?Java Function1使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Function1类属于org.eclipse.xtext.xbase.lib.Functions包,在下文中一共展示了Function1类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getTypeAsString

import org.eclipse.xtext.xbase.lib.Functions.Function1; //导入依赖的package包/类
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public String getTypeAsString() {
	String _xifexpression = null;
	boolean _isGeneric = this.isGeneric();
	if (_isGeneric) {
		String _name = this.getName();
		String _plus = (_name + "<");
		final Function1<TypeVariable, String> _function = new Function1<TypeVariable, String>() {
			public String apply(final TypeVariable it) {
				return it.getTypeAsString();
			}
		};
		String _join = IterableExtensions.join(XcoreEListExtensions.<TypeVariable, String>map(this.getTypeVars(), _function), ",");
		String _plus_1 = (_plus + _join);
		_xifexpression = (_plus_1 + ">");
	}
	else {
		_xifexpression = this.getName();
	}
	return _xifexpression;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:26,代码来源:TypeImpl.java

示例2: applyRuleUpperBoundUnionTypeExpression

import org.eclipse.xtext.xbase.lib.Functions.Function1; //导入依赖的package包/类
protected Result<TypeRef> applyRuleUpperBoundUnionTypeExpression(final RuleEnvironment G, final RuleApplicationTrace _trace_, final UnionTypeExpression U) throws RuleFailedException {
  TypeRef T = null; // output parameter
  final Function1<TypeRef, TypeRef> _function = (TypeRef it) -> {
    TypeRef _xblockexpression = null;
    {
      TypeRef E = null;
      /* G|~ it /\ E */
      Result<TypeRef> result = upperBoundInternal(G, _trace_, it);
      checkAssignableTo(result.getFirst(), TypeRef.class);
      E = (TypeRef) result.getFirst();
      
      _xblockexpression = E;
    }
    return _xblockexpression;
  };
  T = TypeUtils.createNonSimplifiedUnionType(
    ListExtensions.<TypeRef, TypeRef>map(U.getTypeRefs(), _function));
  TypeUtils.copyTypeModifiers(T, U);
  return new Result<TypeRef>(T);
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:21,代码来源:InternalTypeSystem.java

示例3: applyRuleUpperBoundIntersectionTypeExpression

import org.eclipse.xtext.xbase.lib.Functions.Function1; //导入依赖的package包/类
protected Result<TypeRef> applyRuleUpperBoundIntersectionTypeExpression(final RuleEnvironment G, final RuleApplicationTrace _trace_, final IntersectionTypeExpression I) throws RuleFailedException {
  TypeRef T = null; // output parameter
  final Function1<TypeRef, TypeRef> _function = (TypeRef it) -> {
    TypeRef _xblockexpression = null;
    {
      TypeRef E = null;
      /* G|~ it /\ E */
      Result<TypeRef> result = upperBoundInternal(G, _trace_, it);
      checkAssignableTo(result.getFirst(), TypeRef.class);
      E = (TypeRef) result.getFirst();
      
      _xblockexpression = E;
    }
    return _xblockexpression;
  };
  T = TypeUtils.createNonSimplifiedIntersectionType(
    ListExtensions.<TypeRef, TypeRef>map(I.getTypeRefs(), _function));
  TypeUtils.copyTypeModifiers(T, I);
  return new Result<TypeRef>(T);
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:21,代码来源:InternalTypeSystem.java

示例4: applyRuleLowerBoundUnionTypeExpression

import org.eclipse.xtext.xbase.lib.Functions.Function1; //导入依赖的package包/类
protected Result<TypeRef> applyRuleLowerBoundUnionTypeExpression(final RuleEnvironment G, final RuleApplicationTrace _trace_, final UnionTypeExpression U) throws RuleFailedException {
  TypeRef T = null; // output parameter
  final Function1<TypeRef, TypeRef> _function = (TypeRef it) -> {
    TypeRef _xblockexpression = null;
    {
      TypeRef E = null;
      /* G|~ it \/ E */
      Result<TypeRef> result = lowerBoundInternal(G, _trace_, it);
      checkAssignableTo(result.getFirst(), TypeRef.class);
      E = (TypeRef) result.getFirst();
      
      _xblockexpression = E;
    }
    return _xblockexpression;
  };
  T = TypeUtils.createNonSimplifiedUnionType(
    ListExtensions.<TypeRef, TypeRef>map(U.getTypeRefs(), _function));
  TypeUtils.copyTypeModifiers(T, U);
  return new Result<TypeRef>(T);
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:21,代码来源:InternalTypeSystem.java

示例5: applyRuleLowerBoundIntersectionTypeExpression

import org.eclipse.xtext.xbase.lib.Functions.Function1; //导入依赖的package包/类
protected Result<TypeRef> applyRuleLowerBoundIntersectionTypeExpression(final RuleEnvironment G, final RuleApplicationTrace _trace_, final IntersectionTypeExpression I) throws RuleFailedException {
  TypeRef T = null; // output parameter
  final Function1<TypeRef, TypeRef> _function = (TypeRef it) -> {
    TypeRef _xblockexpression = null;
    {
      TypeRef E = null;
      /* G|~ it \/ E */
      Result<TypeRef> result = lowerBoundInternal(G, _trace_, it);
      checkAssignableTo(result.getFirst(), TypeRef.class);
      E = (TypeRef) result.getFirst();
      
      _xblockexpression = E;
    }
    return _xblockexpression;
  };
  T = TypeUtils.createNonSimplifiedIntersectionType(
    ListExtensions.<TypeRef, TypeRef>map(I.getTypeRefs(), _function));
  TypeUtils.copyTypeModifiers(T, I);
  return new Result<TypeRef>(T);
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:21,代码来源:InternalTypeSystem.java

示例6: setMarker

import org.eclipse.xtext.xbase.lib.Functions.Function1; //导入依赖的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);
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:22,代码来源:JSDocNodeImpl.java

示例7: _privk3_step

import org.eclipse.xtext.xbase.lib.Functions.Function1; //导入依赖的package包/类
protected static void _privk3_step(final StateAspectStateAspectProperties _self_, final State _self, final String inputString) {
  try {
    final Function1<Transition, Boolean> _function = (Transition t) -> {
      return Boolean.valueOf(inputString.startsWith(t.getInput()));
    };
    final Iterable<Transition> validTransitions = IterableExtensions.<Transition>filter(_self.getOutgoingTransitions(), _function);
    boolean _isEmpty = IterableExtensions.isEmpty(validTransitions);
    if (_isEmpty) {
      throw new Exception("No Transition");
    }
    int _size = IterableExtensions.size(validTransitions);
    boolean _greaterThan = (_size > 1);
    if (_greaterThan) {
      throw new Exception("Non Determinism");
    }
    TransitionAspect.fire(((Transition[])Conversions.unwrapArray(validTransitions, Transition.class))[0]);
  } catch (Throwable _e) {
    throw Exceptions.sneakyThrow(_e);
  }
}
 
开发者ID:eclipse,项目名称:gemoc-studio,代码行数:21,代码来源:StateAspect.java

示例8: organiseContest

import org.eclipse.xtext.xbase.lib.Functions.Function1; //导入依赖的package包/类
@Override
public AgentContest organiseContest(EventSpace space, Scope<Address> scope, 
    BeliefQuery eligibilityQuery, List<Object> prize, long timeout, 
    ExperimentEvaluator<AgentContestBallot> evaluator,
    Function1<? super Set<UUID>, ? extends List<UUID>> winnerSelector)
{
    return new AgentContestImpl.Executor()
        .setSpace(space)
        .setAccessPrincipal(principal)
        .addSurveys(eligibilityQuery)
        .setSurveyScope(scope)
        .setPrize(prize)
        .setEvaluator(evaluator)
        .setWinnerSelector(winnerSelector)
        .endExperimentAfter(timeout)
        .execute();
}
 
开发者ID:mochalog,项目名称:mochalog-sarl-beliefs,代码行数:18,代码来源:BasicBeliefSocialisation.java

示例9: upTo

import org.eclipse.xtext.xbase.lib.Functions.Function1; //导入依赖的package包/类
private <T extends Object> Iterable<T> upTo(final Iterable<T> iter, final Object element) {
  abstract class __AbstractCompletePrefixProviderTest_1 implements Function1<T, Boolean> {
    boolean found;
  }
  
  __AbstractCompletePrefixProviderTest_1 ___AbstractCompletePrefixProviderTest_1 = new __AbstractCompletePrefixProviderTest_1() {
    {
      found = false;
    }
    @Override
    public Boolean apply(final T t) {
      if (this.found) {
        return Boolean.valueOf(false);
      }
      try {
        return Boolean.valueOf(true);
      } finally {
        boolean _equals = Objects.equal(t, element);
        this.found = _equals;
      }
    }
  };
  return IterableExtensions.<T>filter(iter, ___AbstractCompletePrefixProviderTest_1);
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:25,代码来源:AbstractCompletePrefixProviderTest.java

示例10: assertNoLeakedGrammarElements

import org.eclipse.xtext.xbase.lib.Functions.Function1; //导入依赖的package包/类
private void assertNoLeakedGrammarElements(final Grammar grammar, final Pda<ISerState, RuleCall> pda) {
  final Function1<ISerState, AbstractElement> _function = (ISerState it) -> {
    return it.getGrammarElement();
  };
  Iterable<AbstractElement> _filterNull = IterableExtensions.<AbstractElement>filterNull(IterableExtensions.<ISerState, AbstractElement>map(new NfaUtil().<ISerState>collect(pda), _function));
  for (final AbstractElement ele : _filterNull) {
    {
      final Grammar actual = GrammarUtil.getGrammar(ele);
      if ((actual != grammar)) {
        String _objPath = EmfFormatter.objPath(ele);
        String _plus = ("Element " + _objPath);
        String _plus_1 = (_plus + " leaked!");
        Assert.fail(_plus_1);
      }
    }
  }
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:18,代码来源:GrammarPDAProviderTest.java

示例11: getDiagnostics

import org.eclipse.xtext.xbase.lib.Functions.Function1; //导入依赖的package包/类
protected Map<String, List<Diagnostic>> getDiagnostics() {
  try {
    final Function1<CancelIndicator, HashMap<String, List<Diagnostic>>> _function = (CancelIndicator it) -> {
      final HashMap<String, List<Diagnostic>> result = CollectionLiterals.<String, List<Diagnostic>>newHashMap();
      final Function1<Pair<String, Object>, Object> _function_1 = (Pair<String, Object> it_1) -> {
        return it_1.getValue();
      };
      Iterable<PublishDiagnosticsParams> _filter = Iterables.<PublishDiagnosticsParams>filter(ListExtensions.<Pair<String, Object>, Object>map(this.notifications, _function_1), PublishDiagnosticsParams.class);
      for (final PublishDiagnosticsParams diagnostic : _filter) {
        result.put(diagnostic.getUri(), diagnostic.getDiagnostics());
      }
      return result;
    };
    return this.languageServer.getRequestManager().<HashMap<String, List<Diagnostic>>>runRead(_function).get();
  } catch (Throwable _e) {
    throw Exceptions.sneakyThrow(_e);
  }
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:19,代码来源:AbstractLanguageServerTest.java

示例12: testRunWriteAfterRead

import org.eclipse.xtext.xbase.lib.Functions.Function1; //导入依赖的package包/类
@Test(timeout = 1000)
public void testRunWriteAfterRead() {
  final Function1<CancelIndicator, Integer> _function = (CancelIndicator it) -> {
    return Integer.valueOf(this.sharedState.incrementAndGet());
  };
  final CompletableFuture<Integer> previsousRead = this.requestManager.<Integer>runRead(_function);
  final Function0<Object> _function_1 = () -> {
    return null;
  };
  final Function2<CancelIndicator, Object, Integer> _function_2 = (CancelIndicator $0, Object $1) -> {
    int _xblockexpression = (int) 0;
    {
      while (((this.sharedState.get() == 0) && (!previsousRead.isCancelled()))) {
      }
      _xblockexpression = this.sharedState.incrementAndGet();
    }
    return Integer.valueOf(_xblockexpression);
  };
  this.requestManager.<Object, Integer>runWrite(_function_1, _function_2).join();
  Assert.assertEquals(2, this.sharedState.get());
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:22,代码来源:RequestManagerTest.java

示例13: getDelegatedInterfaces

import org.eclipse.xtext.xbase.lib.Functions.Function1; //导入依赖的package包/类
public Set<TypeReference> getDelegatedInterfaces(final MemberDeclaration delegate) {
  Set<TypeReference> _xblockexpression = null;
  {
    final Set<TypeReference> interfacesOfDeclaringType = this.getImplementedInterfaces(this.context.newSelfTypeReference(delegate.getDeclaringType()));
    final Set<TypeReference> listedInterfaces = this.listedInterfaces(delegate);
    final Set<TypeReference> availableInterfaces = this.getImplementedInterfaces(this.getType(delegate));
    final Function1<TypeReference, Boolean> _function = new Function1<TypeReference, Boolean>() {
      @Override
      public Boolean apply(final TypeReference iface) {
        return Boolean.valueOf((interfacesOfDeclaringType.contains(iface) && (listedInterfaces.isEmpty() || IterableExtensions.<TypeReference>exists(listedInterfaces, new Function1<TypeReference, Boolean>() {
          @Override
          public Boolean apply(final TypeReference it) {
            return Boolean.valueOf(iface.isAssignableFrom(it));
          }
        }))));
      }
    };
    _xblockexpression = IterableExtensions.<TypeReference>toSet(IterableExtensions.<TypeReference>filter(availableInterfaces, _function));
  }
  return _xblockexpression;
}
 
开发者ID:eclipse,项目名称:xtext-lib,代码行数:22,代码来源:DelegateProcessor.java

示例14: testGroupBy__WhenCalculatedKeyNull

import org.eclipse.xtext.xbase.lib.Functions.Function1; //导入依赖的package包/类
@Test
public void testGroupBy__WhenCalculatedKeyNull() {
	List<String> names = new ArrayList<String>();
	names.add("Mueller");
	names.add("Schneider");
	names.add("Schmidt");
	names.add("Koch");
	Function1<String, String> computeKeys = new Function1<String, String>() {

		@Override
		public String apply(String p) {
			return p.contains("y") ? "y" : null;
		}
	};
	Map<String, List<String>> map = IteratorExtensions.groupBy(names.iterator(), computeKeys);
	Assert.assertEquals("Expected grouped map size", 1, map.size());
	Assert.assertTrue("Contains null as key", map.keySet().contains(null));
	Assert.assertEquals("Contains 4 entries for key null", 4, map.get(null).size());
}
 
开发者ID:eclipse,项目名称:xtext-lib,代码行数:20,代码来源:IteratorExtensionsTest.java

示例15: testFindLast_exceptionInFilter

import org.eclipse.xtext.xbase.lib.Functions.Function1; //导入依赖的package包/类
@Test public void testFindLast_exceptionInFilter() {
	final RuntimeException expectedException = new RuntimeException();
	Function1<Integer, Boolean> filter = new Functions.Function1<Integer, Boolean>() {
		@Override
		public Boolean apply(Integer p) {
			throw expectedException;
		}
	};
	for(IterableOrIterator testMe: testData(first, second, third)) {
		try {
			findLast(testMe, filter);
			fail("expected exception");
		} catch(RuntimeException e) {
			assertSame(expectedException, e);
		}
	}
}
 
开发者ID:eclipse,项目名称:xtext-lib,代码行数:18,代码来源:BaseIterablesIteratorsTest.java


注:本文中的org.eclipse.xtext.xbase.lib.Functions.Function1类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。