]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.scl.runtime/src/org/simantics/scl/runtime/function/FunctionImpl2.java
Fixed multiple issues causing dangling references to discarded queries
[simantics/platform.git] / bundles / org.simantics.scl.runtime / src / org / simantics / scl / runtime / function / FunctionImpl2.java
1 /**
2  * This code is generated in org.simantics.scl.runtime.generation.GenerateFunctions.
3  * Do not edit manually!
4  */
5 package org.simantics.scl.runtime.function;
6
7 import java.util.Arrays;
8
9 @SuppressWarnings("all")
10 public abstract class FunctionImpl2<P0,P1,R> implements Function<P0,P1,Object,Object,Object,Object,Object,Object,Object,R,Object,Object,Object,Object,Object,Object> {
11     @Override
12     public Object apply(Object p0) {
13         return new UnsaturatedFunction1(this, p0);
14     }
15
16     @Override
17     public abstract R apply(P0 p0, P1 p1);
18
19     @Override
20     public Object apply(Object p0, Object p1, Object p2) {
21         try {
22             return ((Function)apply((P0)p0, (P1)p1)).apply(p2);
23         } catch(ClassCastException e) {
24             throw new CalledWithTooManyParameters();
25         }
26     }
27
28     @Override
29     public Object apply(Object p0, Object p1, Object p2, Object p3) {
30         try {
31             return ((Function)apply((P0)p0, (P1)p1)).apply(p2, p3);
32         } catch(ClassCastException e) {
33             throw new CalledWithTooManyParameters();
34         }
35     }
36
37     @Override
38     public Object apply(Object p0, Object p1, Object p2, Object p3, Object p4) {
39         try {
40             return ((Function)apply((P0)p0, (P1)p1)).apply(p2, p3, p4);
41         } catch(ClassCastException e) {
42             throw new CalledWithTooManyParameters();
43         }
44     }
45
46     @Override
47     public Object apply(Object p0, Object p1, Object p2, Object p3, Object p4, Object p5) {
48         try {
49             return ((Function)apply((P0)p0, (P1)p1)).apply(p2, p3, p4, p5);
50         } catch(ClassCastException e) {
51             throw new CalledWithTooManyParameters();
52         }
53     }
54
55     @Override
56     public Object apply(Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6) {
57         try {
58             return ((Function)apply((P0)p0, (P1)p1)).apply(p2, p3, p4, p5, p6);
59         } catch(ClassCastException e) {
60             throw new CalledWithTooManyParameters();
61         }
62     }
63
64     @Override
65     public Object apply(Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7) {
66         try {
67             return ((Function)apply((P0)p0, (P1)p1)).apply(p2, p3, p4, p5, p6, p7);
68         } catch(ClassCastException e) {
69             throw new CalledWithTooManyParameters();
70         }
71     }
72
73     @Override
74     public Object applyArray(Object ... ps) {
75         switch(ps.length) {
76         case 0:
77             return this;
78         case 1:
79             return new UnsaturatedFunction1(this, ps[0]);
80         case 2:
81             return apply((P0)ps[0], (P1)ps[1]);
82         case 3:
83             try {
84                 return ((Function)apply((P0)ps[0], (P1)ps[1])).apply(ps[2]);
85             } catch(ClassCastException e) {
86                 throw new CalledWithTooManyParameters();
87             }
88         case 4:
89             try {
90                 return ((Function)apply((P0)ps[0], (P1)ps[1])).apply(ps[2], ps[3]);
91             } catch(ClassCastException e) {
92                 throw new CalledWithTooManyParameters();
93             }
94         case 5:
95             try {
96                 return ((Function)apply((P0)ps[0], (P1)ps[1])).apply(ps[2], ps[3], ps[4]);
97             } catch(ClassCastException e) {
98                 throw new CalledWithTooManyParameters();
99             }
100         case 6:
101             try {
102                 return ((Function)apply((P0)ps[0], (P1)ps[1])).apply(ps[2], ps[3], ps[4], ps[5]);
103             } catch(ClassCastException e) {
104                 throw new CalledWithTooManyParameters();
105             }
106         case 7:
107             try {
108                 return ((Function)apply((P0)ps[0], (P1)ps[1])).apply(ps[2], ps[3], ps[4], ps[5], ps[6]);
109             } catch(ClassCastException e) {
110                 throw new CalledWithTooManyParameters();
111             }
112         case 8:
113             try {
114                 return ((Function)apply((P0)ps[0], (P1)ps[1])).apply(ps[2], ps[3], ps[4], ps[5], ps[6], ps[7]);
115             } catch(ClassCastException e) {
116                 throw new CalledWithTooManyParameters();
117             }
118         case 9:
119             try {
120                 return ((Function)apply((P0)ps[0], (P1)ps[1])).apply(ps[2], ps[3], ps[4], ps[5], ps[6], ps[7], ps[8]);
121             } catch(ClassCastException e) {
122                 throw new CalledWithTooManyParameters();
123             }
124         case 10:
125             try {
126                 return ((Function)apply((P0)ps[0], (P1)ps[1])).apply(ps[2], ps[3], ps[4], ps[5], ps[6], ps[7], ps[8], ps[9]);
127             } catch(ClassCastException e) {
128                 throw new CalledWithTooManyParameters();
129             }
130         default:
131             try {
132                 return ((Function)apply((P0)ps[0], (P1)ps[1])).apply(Arrays.copyOfRange(ps, 2, ps.length));
133             } catch(ClassCastException e) {
134                 throw new CalledWithTooManyParameters();
135             }
136         }
137     }
138 }