SHARE
TWEET

Untitled

a guest Sep 23rd, 2014 508 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* Copyright(C) 2014 Mo Enterprises. Proprietary and confidential. Usage of this file on any medium without written consent form is strictly prohibited. All Rights Reserved. */
  2. package momomo.Core.sources.closure.v0;
  3.  
  4.  
  5. // TODO Add throwable to all closures
  6. public final class Closure {
  7.         // Cannot be initiated or subclassed. Works as a container class only
  8.         private Closure() {}
  9.  
  10.         /** O = Returns Object and takes an unlimited amount of parameters of type Object */
  11.         public static interface G {
  12.                 public Object call(Object... objs);
  13.         }
  14.  
  15.         /** R0 = Return of defined type with 0 parameters */
  16.         public static interface R0<Returns>  {
  17.                 public Returns call();
  18.         }
  19.         public static interface R0E<Returns, E extends Throwable> {
  20.                 public Returns call() throws E;
  21.         }
  22.         public static interface R0T<Returns> extends R0E<Returns, Throwable> {}
  23.  
  24.         /** R1 = Return of defined type with 1 defined parameters */
  25.         public static interface R1<Returns, Param1>  {
  26.                 public Returns call(Param1 p1);
  27.         }
  28.         public static interface R1E<Returns, Param1, E extends Throwable> {
  29.                 public Returns call(Param1 p1) throws E;
  30.         }
  31.         public static interface R1T<Returns, Param1> extends R1E<Returns, Param1, Throwable> {}
  32.  
  33.  
  34.         /** R2 = Return of defined type with 2 defined parameters */
  35.         public static interface R2<Returns, Param1, Param2> {
  36.                 public Returns call(Param1 p1, Param2 p2);
  37.         }
  38.  
  39.         /** R3 = Return of defined type with 3 defined parameters */
  40.         public static interface R3<Returns, Param1, Param2, Param3>  {
  41.                 public Returns call(Param1 p1, Param2 p2, Param3 p3);
  42.         }
  43.         public static interface R3E<Returns, Param1, Param2, Param3, E extends Throwable>  {
  44.                 public Returns call(Param1 p1, Param2 p2, Param3 p3) throws E;
  45.         }
  46.         public static interface R3T<Returns, Param1, Param2, Param3>  extends R3E<Returns, Param1, Param2, Param3, Throwable> {}
  47.  
  48.  
  49.         /** R4 = Return of defined type with 4 defined parameters */
  50.         public static interface R4<Returns, Param1, Param2, Param3, Param4>  {
  51.                 public Returns call(Param1 p1, Param2 p2, Param3 p3, Param4 p4);
  52.         }
  53.  
  54.         /** R5 = Return of defined type with 5 defined parameters */
  55.         public static interface R5<Returns, Param1, Param2, Param3, Param4, Param5>  {
  56.                 public Returns call(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5);
  57.         }
  58.  
  59.         /** R6 = Return of defined type with 6 defined parameters */
  60.         public static interface R6<Returns, Param1, Param2, Param3, Param4, Param5, Param6>  {
  61.                 public Returns call(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6);
  62.         }
  63.  
  64.         /** R7 = Return of defined type with 7 defined parameters */
  65.         public static interface R7<Returns, Param1, Param2, Param3, Param4, Param5, Param6, Param7>  {
  66.                 public Returns call(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7);
  67.         }
  68.  
  69.         /** R8 = Return of defined type with 8 defined parameters */
  70.         public static interface R8<Returns, Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8>  {
  71.                 public Returns call(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8);
  72.         }
  73.  
  74.         /** R9 = Return of defined type with 9 defined parameters */
  75.         public static interface R9<Returns, Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9>  {
  76.                 public Returns call(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9);
  77.         }
  78.  
  79.         /** R10 = Return of defined type with 10 defined parameters */
  80.         public static interface R10<Returns, Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10>  {
  81.                 public Returns call(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10);
  82.         }
  83.  
  84.         /** R11 = Return of defined type with 11 defined parameters */
  85.         public static interface R11<Returns, Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11>  {
  86.                 public Returns call(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11);
  87.         }
  88.  
  89.         /** R12 = Return of defined type with 12 defined parameters */
  90.         public static interface R12<Returns, Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12>  {
  91.                 public Returns call(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12);
  92.         }
  93.  
  94.         /** R13 = Return of defined type with 13 defined parameters */
  95.         public static interface R13<Returns, Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13>  {
  96.                 public Returns call(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13);
  97.         }
  98.  
  99.         /** R14 = Return of defined type with 14 defined parameters */
  100.         public static interface R14<Returns, Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14>  {
  101.                 public Returns call(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14);
  102.         }
  103.  
  104.         /** R15 = Return of defined type with 15 defined parameters */
  105.         public static interface R15<Returns, Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15>  {
  106.                 public Returns call(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15);
  107.         }
  108.  
  109.         /** R16 = Return of defined type with 16 defined parameters */
  110.         public static interface R16<Returns, Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16>  {
  111.                 public Returns call(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16);
  112.         }
  113.  
  114.         /** R17 = Return of defined type with 17 defined parameters */
  115.         public static interface R17<Returns, Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17>  {
  116.                 public Returns call(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17);
  117.         }
  118.  
  119.         /** R18 = Return of defined type with 18 defined parameters */
  120.         public static interface R18<Returns, Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, Param18>  {
  121.                 public Returns call(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17, Param18 p18);
  122.         }
  123.  
  124.         /** R19 = Return of defined type with 19 defined parameters */
  125.         public static interface R19<Returns, Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, Param18, Param19>  {
  126.                 public Returns call(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17, Param18 p18, Param19 p19);
  127.         }
  128.  
  129.         /** R20 = Return of defined type with 20 defined parameters */
  130.         public static interface R20<Returns, Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, Param18, Param19, Param20>  {
  131.                 public Returns call(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17, Param18 p18, Param19 p19, Param20 p20);
  132.         }
  133.  
  134.         /** RU = Return of defined type with undefined and unlimited amount of method parameters */
  135.         public static interface RU<Returns>  {
  136.                 public Returns call(Object... parameters);
  137.         }
  138.  
  139.         //======================================================================================================
  140.         // Voids are treated specially as well to cover the complete spectrum for static declaration and usage
  141.         // Question: Should we allow
  142.         //======================================================================================================
  143.  
  144.  
  145.         /** V0 = Void with zero parameters */
  146.         public static interface V0  {
  147.                 public void call();
  148.         }
  149.         public static interface V0E<E extends Throwable> {
  150.                 public void call() throws E ;
  151.         }
  152.         public static interface V0T extends V0E<Throwable> {}
  153.  
  154.         /** V1 = Void with 1 defined parameter */
  155.         public static interface V1<Param1>  {
  156.                 public void call(Param1 p1);
  157.         }
  158.  
  159.         /** V2 = Void with 2 defined parameters */
  160.         public static interface V2<Param1, Param2>  {
  161.                 public void call(Param1 p1, Param2 p2);
  162.         }
  163.  
  164.         /** V3 = Void with 3 defined parameters */
  165.         public static interface V3<Param1, Param2, Param3>  {
  166.                 public void call(Param1 p1, Param2 p2, Param3 p3);
  167.         }
  168.  
  169.         /** V4 = Void with 4 defined parameters */
  170.         public static interface V4<Param1, Param2, Param3, Param4>  {
  171.                 public void call(Param1 p1, Param2 p2, Param3 p3, Param4 p4);
  172.         }
  173.  
  174.         /** V5 = Void with 5 defined parameters */
  175.         public static interface V5<Param1, Param2, Param3, Param4, Param5>  {
  176.                 public void call(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5);
  177.         }
  178.  
  179.         /** V6 = Void with 6 defined parameters */
  180.         public static interface V6<Param1, Param2, Param3, Param4, Param5, Param6>  {
  181.                 public void call(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6);
  182.         }
  183.  
  184.         /** V7 = Void with 7 defined parameters */
  185.         public static interface V7<Param1, Param2, Param3, Param4, Param5, Param6, Param7>  {
  186.                 public void call(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7);
  187.         }
  188.  
  189.         /** V8 = Void with 8 defined parameters */
  190.         public static interface V8<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8>  {
  191.                 public void call(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8);
  192.         }
  193.  
  194.         /** V9 = Void with 9 defined parameters */
  195.         public static interface V9<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9>  {
  196.                 public void call(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9);
  197.         }
  198.  
  199.         /** V10 = Void with 10 defined parameters */
  200.         public static interface V10<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10>  {
  201.                 public void call(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10);
  202.         }
  203.  
  204.         /** V11 = Void with 11 defined parameters */
  205.         public static interface V11<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11>  {
  206.                 public void call(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11);
  207.         }
  208.  
  209.         /** V12 = Void with 12 defined parameters */
  210.         public static interface V12<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12>  {
  211.                 public void call(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12);
  212.         }
  213.  
  214.         /** V13 = Void with 13 defined parameters */
  215.         public static interface V13<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13>  {
  216.                 public void call(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13);
  217.         }
  218.  
  219.         /** V14 = Void with 14 defined parameters */
  220.         public static interface V14<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14>  {
  221.                 public void call(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14);
  222.         }
  223.  
  224.         /** V15 = Void with 15 defined parameters */
  225.         public static interface V15<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15>  {
  226.                 public void call(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15);
  227.         }
  228.  
  229.         /** V16 = Void with 16 defined parameters */
  230.         public static interface V16<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16>  {
  231.                 public void call(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16);
  232.         }
  233.  
  234.         /** V17 = Void with 17 defined parameters */
  235.         public static interface V17<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17>  {
  236.                 public void call(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17);
  237.         }
  238.  
  239.         /** V18 = Void with 18 defined parameters */
  240.         public static interface V18<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, Param18>  {
  241.                 public void call(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17, Param18 p18);
  242.         }
  243.  
  244.         /** V19 = Void with 19 defined parameters */
  245.         public static interface V19<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, Param18, Param19>  {
  246.                 public void call(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17, Param18 p18, Param19 p19);
  247.         }
  248.  
  249.         /** V20 = Void with 20 defined parameters */
  250.         public static interface V20<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, Param18, Param19, Param20>  {
  251.                 public void call(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17, Param18 p18, Param19 p19, Param20 p20);
  252.         }
  253.  
  254.         /** VU = Void with undefined and unlimited amount of method parameters */
  255.         public static interface VU  {
  256.                 public void call(Object... parameters);
  257.         }
  258.  
  259. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top