@Test public void testFunctionType7() { FunctionTypeReference _newFunctionTypeReference = this.getOwner().newFunctionTypeReference(this.type(Procedure3.class)); final Procedure1<FunctionTypeReference> _function = (FunctionTypeReference it) -> { it.addParameterType(this.typeRef(String.class)); it.addTypeArgument(this.typeRef(String.class)); ParameterizedTypeReference _typeRef = this.typeRef(List.class); final Procedure1<ParameterizedTypeReference> _function_1 = (ParameterizedTypeReference it_1) -> { WildcardTypeReference _newWildcardTypeReference = it_1.getOwner().newWildcardTypeReference(); final Procedure1<WildcardTypeReference> _function_2 = (WildcardTypeReference it_2) -> { it_2.setLowerBound(this.typeRef(CharSequence.class)); }; WildcardTypeReference _doubleArrow = ObjectExtensions.<WildcardTypeReference>operator_doubleArrow(_newWildcardTypeReference, _function_2); it_1.addTypeArgument(_doubleArrow); }; final ParameterizedTypeReference listOfCharSequence = ObjectExtensions.<ParameterizedTypeReference>operator_doubleArrow(_typeRef, _function_1); it.addParameterType(listOfCharSequence); it.addTypeArgument(listOfCharSequence); final ArrayTypeReference arrayOfObject = it.getOwner().newArrayTypeReference(this.typeRef(Object.class)); it.addParameterType(arrayOfObject); it.addTypeArgument(arrayOfObject); }; this.assertInJava(this.assertInXtend(ObjectExtensions.<FunctionTypeReference>operator_doubleArrow(_newFunctionTypeReference, _function), "(java.lang.String, java.util.List<? super java.lang.CharSequence>, java.lang.Object[])=>void"), "org.eclipse.xtext.xbase.lib.Procedures$Procedure3<java.lang.String, java.util.List<? super java.lang.CharSequence>, java.lang.Object[]>"); }
/** * Curries a procedure that takes three arguments. * * @param procedure * the original procedure. May not be <code>null</code>. * @param argument * the fixed first argument of {@code procedure}. * @return a procedure that takes two arguments. Never <code>null</code>. */ @Pure public static <P1, P2, P3> Procedure2<P2, P3> curry(final Procedure3<? super P1, ? super P2, ? super P3> procedure, final P1 argument) { if (procedure == null) throw new NullPointerException("procedure"); return new Procedure2<P2, P3>() { @Override public void apply(P2 p2, P3 p3) { procedure.apply(argument, p2, p3); } }; }
/** * Curries a procedure that takes four arguments. * * @param procedure * the original procedure. May not be <code>null</code>. * @param argument * the fixed first argument of {@code procedure}. * @return a procedure that takes three arguments. Never <code>null</code>. */ @Pure public static <P1, P2, P3, P4> Procedure3<P2, P3, P4> curry(final Procedure4<? super P1, ? super P2, ? super P3, ? super P4> procedure, final P1 argument) { if (procedure == null) throw new NullPointerException("procedure"); return new Procedure3<P2, P3, P4>() { @Override public void apply(P2 p2, P3 p3, P4 p4) { procedure.apply(argument, p2, p3, p4); } }; }
/** * Applies the given {@code procedure} for each {@link java.util.Map.Entry key value pair} of the given {@code map}. * The procedure takes the key, the value and a loop counter. If the counter would overflow, {@link Integer#MAX_VALUE} * is returned for all subsequent pairs. The first pair is at index zero. * * @param map * the map. May not be <code>null</code>. * @param procedure * the procedure. May not be <code>null</code>. */ public static <K, V> void forEach(Map<K, V> map, Procedure3<? super K, ? super V, ? super Integer> procedure) { if (procedure == null) throw new NullPointerException("procedure"); int i = 0; for (Map.Entry<K, V> entry : map.entrySet()) { procedure.apply(entry.getKey(), entry.getValue(), i); if (i != Integer.MAX_VALUE) i++; } }
/** * Runs some code safely. * Never throws an Exception. * @return return true; on success. */ public static <E1, E2, E3> boolean attempt( final Procedure3<E1, E2, E3> code, final E1 p1, final E2 p2, final E3 p3) { try { code.apply(p1, p2, p3); return true; } catch (final Throwable t) { LOG.log(Level.SEVERE, t.getMessage(), t); return false; } }
public boolean addStateChangeListener(final Procedure3<? super EObject, ? super Notification, ? super TransactionalEditingDomain> listener) { return this.stateChangeListeners.add(listener); }