org.eclipse.xtext.xbase.lib
Class ProcedureExtensions

java.lang.Object
  extended by org.eclipse.xtext.xbase.lib.ProcedureExtensions

public class ProcedureExtensions
extends Object

This is an extension library for procedures, e.g. side-effect only-closures.

Author:
Sebastian Zarnekow - Initial contribution and API
See Also:
Procedures

Constructor Summary
ProcedureExtensions()
           
 
Method Summary
static
<P1> Procedures.Procedure0
curry(Procedures.Procedure1<? super P1> procedure, P1 argument)
          Curries a procedure that takes one argument.
static
<P1,P2> Procedures.Procedure1<P2>
curry(Procedures.Procedure2<? super P1,? super P2> procedure, P1 argument)
          Curries a procedure that takes two arguments.
static
<P1,P2,P3> Procedures.Procedure2<P2,P3>
curry(Procedures.Procedure3<? super P1,? super P2,? super P3> procedure, P1 argument)
          Curries a procedure that takes three arguments.
static
<P1,P2,P3,P4>
Procedures.Procedure3<P2,P3,P4>
curry(Procedures.Procedure4<? super P1,? super P2,? super P3,? super P4> procedure, P1 argument)
          Curries a procedure that takes four arguments.
static
<P1,P2,P3,P4,P5>
Procedures.Procedure4<P2,P3,P4,P5>
curry(Procedures.Procedure5<? super P1,? super P2,? super P3,? super P4,? super P5> procedure, P1 argument)
          Curries a procedure that takes five arguments.
static
<P1,P2,P3,P4,P5,P6>
Procedures.Procedure5<P2,P3,P4,P5,P6>
curry(Procedures.Procedure6<? super P1,? super P2,? super P3,? super P4,? super P5,? super P6> procedure, P1 argument)
          Curries a procedure that takes six arguments.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProcedureExtensions

public ProcedureExtensions()
Method Detail

curry

public static <P1> Procedures.Procedure0 curry(Procedures.Procedure1<? super P1> procedure,
                                               P1 argument)
Curries a procedure that takes one argument.

Parameters:
procedure - the original procedure. May not be null.
argument - the fixed argument.
Returns:
a procedure that takes no arguments. Never null.

curry

public static <P1,P2> Procedures.Procedure1<P2> curry(Procedures.Procedure2<? super P1,? super P2> procedure,
                                                      P1 argument)
Curries a procedure that takes two arguments.

Parameters:
procedure - the original procedure. May not be null.
argument - the fixed first argument of procedure.
Returns:
a procedure that takes one argument. Never null.

curry

public static <P1,P2,P3> Procedures.Procedure2<P2,P3> curry(Procedures.Procedure3<? super P1,? super P2,? super P3> procedure,
                                                            P1 argument)
Curries a procedure that takes three arguments.

Parameters:
procedure - the original procedure. May not be null.
argument - the fixed first argument of procedure.
Returns:
a procedure that takes two arguments. Never null.

curry

public static <P1,P2,P3,P4> Procedures.Procedure3<P2,P3,P4> curry(Procedures.Procedure4<? super P1,? super P2,? super P3,? super P4> procedure,
                                                                  P1 argument)
Curries a procedure that takes four arguments.

Parameters:
procedure - the original procedure. May not be null.
argument - the fixed first argument of procedure.
Returns:
a procedure that takes three arguments. Never null.

curry

public static <P1,P2,P3,P4,P5> Procedures.Procedure4<P2,P3,P4,P5> curry(Procedures.Procedure5<? super P1,? super P2,? super P3,? super P4,? super P5> procedure,
                                                                        P1 argument)
Curries a procedure that takes five arguments.

Parameters:
procedure - the original procedure. May not be null.
argument - the fixed first argument of procedure.
Returns:
a procedure that takes four arguments. Never null.

curry

public static <P1,P2,P3,P4,P5,P6> Procedures.Procedure5<P2,P3,P4,P5,P6> curry(Procedures.Procedure6<? super P1,? super P2,? super P3,? super P4,? super P5,? super P6> procedure,
                                                                              P1 argument)
Curries a procedure that takes six arguments.

Parameters:
procedure - the original procedure. May not be null.
argument - the fixed first argument of procedure.
Returns:
a procedure that takes five arguments. Never null.


Copyright © 2012. All Rights Reserved.