001    package fj;
002    
003    import static fj.FW.$;
004    
005    /**
006     * A product-8.
007     *
008     * @version %build.number%<br>
009     *          <ul>
010     *          <li>$LastChangedRevision: 270 $</li>
011     *          <li>$LastChangedDate: 2009-07-28 14:06:27 +1000 (Tue, 28 Jul 2009) $</li>
012     *          </ul>
013     */
014    @SuppressWarnings({"UnnecessaryFullyQualifiedName"})
015    public abstract class P8<A, B, C, D, E, F, G, H> {
016      /**
017       * Access the first element of the product.
018       *
019       * @return The first element of the product.
020       */
021      public abstract A _1();
022    
023      /**
024       * Access the second element of the product.
025       *
026       * @return The second element of the product.
027       */
028      public abstract B _2();
029    
030      /**
031       * Access the third element of the product.
032       *
033       * @return The third element of the product.
034       */
035      public abstract C _3();
036    
037      /**
038       * Access the fourth element of the product.
039       *
040       * @return The fourth element of the product.
041       */
042      public abstract D _4();
043    
044      /**
045       * Access the fifth element of the product.
046       *
047       * @return The fifth element of the product.
048       */
049      public abstract E _5();
050    
051      /**
052       * Access the sixth element of the product.
053       *
054       * @return The sixth element of the product.
055       */
056      public abstract F _6();
057    
058      /**
059       * Access the seventh element of the product.
060       *
061       * @return The seventh element of the product.
062       */
063      public abstract G _7();
064    
065      /**
066       * Access the eighth element of the product.
067       *
068       * @return The eighth element of the product.
069       */
070      public abstract H _8();
071    
072      /**
073       * Map the first element of the product.
074       *
075       * @param f The function to map with.
076       * @return A product with the given function applied.
077       */
078      public <X> P8<X, B, C, D, E, F, G, H> map1(final fj.F<A, X> f) {
079        return new P8<X, B, C, D, E, F, G, H>() {
080          public X _1() {
081            return f.f(P8.this._1());
082          }
083    
084          public B _2() {
085            return P8.this._2();
086          }
087    
088          public C _3() {
089            return P8.this._3();
090          }
091    
092          public D _4() {
093            return P8.this._4();
094          }
095    
096          public E _5() {
097            return P8.this._5();
098          }
099    
100          public F _6() {
101            return P8.this._6();
102          }
103    
104          public G _7() {
105            return P8.this._7();
106          }
107    
108          public H _8() {
109            return P8.this._8();
110          }
111        };
112      }
113    
114      /**
115       * Map the second element of the product.
116       *
117       * @param f The function to map with.
118       * @return A product with the given function applied.
119       */
120      public <X> P8<A, X, C, D, E, F, G, H> map2(final fj.F<B, X> f) {
121        return new P8<A, X, C, D, E, F, G, H>() {
122          public A _1() {
123            return P8.this._1();
124          }
125    
126          public X _2() {
127            return f.f(P8.this._2());
128          }
129    
130          public C _3() {
131            return P8.this._3();
132          }
133    
134          public D _4() {
135            return P8.this._4();
136          }
137    
138          public E _5() {
139            return P8.this._5();
140          }
141    
142          public F _6() {
143            return P8.this._6();
144          }
145    
146          public G _7() {
147            return P8.this._7();
148          }
149    
150          public H _8() {
151            return P8.this._8();
152          }
153        };
154      }
155    
156      /**
157       * Map the third element of the product.
158       *
159       * @param f The function to map with.
160       * @return A product with the given function applied.
161       */
162      public <X> P8<A, B, X, D, E, F, G, H> map3(final fj.F<C, X> f) {
163        return new P8<A, B, X, D, E, F, G, H>() {
164          public A _1() {
165            return P8.this._1();
166          }
167    
168          public B _2() {
169            return P8.this._2();
170          }
171    
172          public X _3() {
173            return f.f(P8.this._3());
174          }
175    
176          public D _4() {
177            return P8.this._4();
178          }
179    
180          public E _5() {
181            return P8.this._5();
182          }
183    
184          public F _6() {
185            return P8.this._6();
186          }
187    
188          public G _7() {
189            return P8.this._7();
190          }
191    
192          public H _8() {
193            return P8.this._8();
194          }
195        };
196      }
197    
198      /**
199       * Map the fourth element of the product.
200       *
201       * @param f The function to map with.
202       * @return A product with the given function applied.
203       */
204      public <X> P8<A, B, C, X, E, F, G, H> map4(final fj.F<D, X> f) {
205        return new P8<A, B, C, X, E, F, G, H>() {
206          public A _1() {
207            return P8.this._1();
208          }
209    
210          public B _2() {
211            return P8.this._2();
212          }
213    
214          public C _3() {
215            return P8.this._3();
216          }
217    
218          public X _4() {
219            return f.f(P8.this._4());
220          }
221    
222          public E _5() {
223            return P8.this._5();
224          }
225    
226          public F _6() {
227            return P8.this._6();
228          }
229    
230          public G _7() {
231            return P8.this._7();
232          }
233    
234          public H _8() {
235            return P8.this._8();
236          }
237        };
238      }
239    
240      /**
241       * Map the fifth element of the product.
242       *
243       * @param f The function to map with.
244       * @return A product with the given function applied.
245       */
246      public <X> P8<A, B, C, D, X, F, G, H> map5(final fj.F<E, X> f) {
247        return new P8<A, B, C, D, X, F, G, H>() {
248          public A _1() {
249            return P8.this._1();
250          }
251    
252          public B _2() {
253            return P8.this._2();
254          }
255    
256          public C _3() {
257            return P8.this._3();
258          }
259    
260          public D _4() {
261            return P8.this._4();
262          }
263    
264          public X _5() {
265            return f.f(P8.this._5());
266          }
267    
268          public F _6() {
269            return P8.this._6();
270          }
271    
272          public G _7() {
273            return P8.this._7();
274          }
275    
276          public H _8() {
277            return P8.this._8();
278          }
279        };
280      }
281    
282      /**
283       * Map the sixth element of the product.
284       *
285       * @param f The function to map with.
286       * @return A product with the given function applied.
287       */
288      public <X> P8<A, B, C, D, E, X, G, H> map6(final fj.F<F, X> f) {
289        return new P8<A, B, C, D, E, X, G, H>() {
290          public A _1() {
291            return P8.this._1();
292          }
293    
294          public B _2() {
295            return P8.this._2();
296          }
297    
298          public C _3() {
299            return P8.this._3();
300          }
301    
302          public D _4() {
303            return P8.this._4();
304          }
305    
306          public E _5() {
307            return P8.this._5();
308          }
309    
310          public X _6() {
311            return f.f(P8.this._6());
312          }
313    
314          public G _7() {
315            return P8.this._7();
316          }
317    
318          public H _8() {
319            return P8.this._8();
320          }
321        };
322      }
323    
324      /**
325       * Map the seventh element of the product.
326       *
327       * @param f The function to map with.
328       * @return A product with the given function applied.
329       */
330      public <X> P8<A, B, C, D, E, F, X, H> map7(final fj.F<G, X> f) {
331        return new P8<A, B, C, D, E, F, X, H>() {
332          public A _1() {
333            return P8.this._1();
334          }
335    
336          public B _2() {
337            return P8.this._2();
338          }
339    
340          public C _3() {
341            return P8.this._3();
342          }
343    
344          public D _4() {
345            return P8.this._4();
346          }
347    
348          public E _5() {
349            return P8.this._5();
350          }
351    
352          public F _6() {
353            return P8.this._6();
354          }
355    
356          public X _7() {
357            return f.f(P8.this._7());
358          }
359    
360          public H _8() {
361            return P8.this._8();
362          }
363        };
364      }
365    
366      /**
367       * Map the eighth element of the product.
368       *
369       * @param f The function to map with.
370       * @return A product with the given function applied.
371       */
372      public <X> P8<A, B, C, D, E, F, G, X> map8(final fj.F<H, X> f) {
373        return new P8<A, B, C, D, E, F, G, X>() {
374          public A _1() {
375            return P8.this._1();
376          }
377    
378          public B _2() {
379            return P8.this._2();
380          }
381    
382          public C _3() {
383            return P8.this._3();
384          }
385    
386          public D _4() {
387            return P8.this._4();
388          }
389    
390          public E _5() {
391            return P8.this._5();
392          }
393    
394          public F _6() {
395            return P8.this._6();
396          }
397    
398          public G _7() {
399            return P8.this._7();
400          }
401    
402          public X _8() {
403            return f.f(P8.this._8());
404          }
405        };
406      }
407    
408    
409      /**
410       * Returns the 1-product projection over the first element.
411       *
412       * @return the 1-product projection over the first element.
413       */
414      public P1<A> _1_() {
415        return $(P8.<A, B, C, D, E, F, G, H>__1()).lazy().f(this);
416      }
417    
418      /**
419       * Returns the 1-product projection over the second element.
420       *
421       * @return the 1-product projection over the second element.
422       */
423      public P1<B> _2_() {
424        return $(P8.<A, B, C, D, E, F, G, H>__2()).lazy().f(this);
425      }
426    
427      /**
428       * Returns the 1-product projection over the third element.
429       *
430       * @return the 1-product projection over the third element.
431       */
432      public P1<C> _3_() {
433        return $(P8.<A, B, C, D, E, F, G, H>__3()).lazy().f(this);
434      }
435    
436      /**
437       * Returns the 1-product projection over the fourth element.
438       *
439       * @return the 1-product projection over the fourth element.
440       */
441      public P1<D> _4_() {
442        return $(P8.<A, B, C, D, E, F, G, H>__4()).lazy().f(this);
443      }
444    
445      /**
446       * Returns the 1-product projection over the fifth element.
447       *
448       * @return the 1-product projection over the fifth element.
449       */
450      public P1<E> _5_() {
451        return $(P8.<A, B, C, D, E, F, G, H>__5()).lazy().f(this);
452      }
453    
454      /**
455       * Returns the 1-product projection over the sixth element.
456       *
457       * @return the 1-product projection over the sixth element.
458       */
459      public P1<F> _6_() {
460        return $(P8.<A, B, C, D, E, F, G, H>__6()).lazy().f(this);
461      }
462    
463      /**
464       * Returns the 1-product projection over the seventh element.
465       *
466       * @return the 1-product projection over the seventh element.
467       */
468      public P1<G> _7_() {
469        return $(P8.<A, B, C, D, E, F, G, H>__7()).lazy().f(this);
470      }
471    
472      /**
473       * Returns the 1-product projection over the eighth element.
474       *
475       * @return the 1-product projection over the eighth element.
476       */
477      public P1<H> _8_() {
478        return $(P8.<A, B, C, D, E, F, G, H>__8()).lazy().f(this);
479      }
480    
481      /**
482       * Provides a memoising P8 that remembers its values.
483       *
484       * @return A P8 that calls this P8 once for any given element and remembers the value for subsequent calls.
485       */
486      public P8<A, B, C, D, E, F, G, H> memo() {
487        return new P8<A, B, C, D, E, F, G, H>() {
488          private final P1<A> a = _1_().memo();
489          private final P1<B> b = _2_().memo();
490          private final P1<C> c = _3_().memo();
491          private final P1<D> d = _4_().memo();
492          private final P1<E> e = _5_().memo();
493          private final P1<F> f = _6_().memo();
494          private final P1<G> g = _7_().memo();
495          private final P1<H> h = _8_().memo();
496    
497          public A _1() {
498            return a._1();
499          }
500    
501          public B _2() {
502            return b._1();
503          }
504    
505          public C _3() {
506            return c._1();
507          }
508    
509          public D _4() {
510            return d._1();
511          }
512    
513          public E _5() {
514            return e._1();
515          }
516    
517          public F _6() {
518            return f._1();
519          }
520    
521          public G _7() {
522            return g._1();
523          }
524    
525          public H _8() {
526            return h._1();
527          }
528        };
529      }
530    
531    
532      /**
533       * Returns a function that returns the first element of a product.
534       *
535       * @return A function that returns the first element of a product.
536       */
537      public static <A, B, C, D, E, F$, G, H> fj.F<P8<A, B, C, D, E, F$, G, H>, A> __1() {
538        return new fj.F<P8<A, B, C, D, E, F$, G, H>, A>() {
539          public A f(final P8<A, B, C, D, E, F$, G, H> p) {
540            return p._1();
541          }
542        };
543      }
544    
545      /**
546       * Returns a function that returns the second element of a product.
547       *
548       * @return A function that returns the second element of a product.
549       */
550      public static <A, B, C, D, E, F$, G, H> fj.F<P8<A, B, C, D, E, F$, G, H>, B> __2() {
551        return new fj.F<P8<A, B, C, D, E, F$, G, H>, B>() {
552          public B f(final P8<A, B, C, D, E, F$, G, H> p) {
553            return p._2();
554          }
555        };
556      }
557    
558      /**
559       * Returns a function that returns the third element of a product.
560       *
561       * @return A function that returns the third element of a product.
562       */
563      public static <A, B, C, D, E, F$, G, H> fj.F<P8<A, B, C, D, E, F$, G, H>, C> __3() {
564        return new fj.F<P8<A, B, C, D, E, F$, G, H>, C>() {
565          public C f(final P8<A, B, C, D, E, F$, G, H> p) {
566            return p._3();
567          }
568        };
569      }
570    
571      /**
572       * Returns a function that returns the fourth element of a product.
573       *
574       * @return A function that returns the fourth element of a product.
575       */
576      public static <A, B, C, D, E, F$, G, H> fj.F<P8<A, B, C, D, E, F$, G, H>, D> __4() {
577        return new fj.F<P8<A, B, C, D, E, F$, G, H>, D>() {
578          public D f(final P8<A, B, C, D, E, F$, G, H> p) {
579            return p._4();
580          }
581        };
582      }
583    
584      /**
585       * Returns a function that returns the fifth element of a product.
586       *
587       * @return A function that returns the fifth element of a product.
588       */
589      public static <A, B, C, D, E, F$, G, H> fj.F<P8<A, B, C, D, E, F$, G, H>, E> __5() {
590        return new fj.F<P8<A, B, C, D, E, F$, G, H>, E>() {
591          public E f(final P8<A, B, C, D, E, F$, G, H> p) {
592            return p._5();
593          }
594        };
595      }
596    
597      /**
598       * Returns a function that returns the sixth element of a product.
599       *
600       * @return A function that returns the sixth element of a product.
601       */
602      public static <A, B, C, D, E, F$, G, H> fj.F<P8<A, B, C, D, E, F$, G, H>, F$> __6() {
603        return new fj.F<P8<A, B, C, D, E, F$, G, H>, F$>() {
604          public F$ f(final P8<A, B, C, D, E, F$, G, H> p) {
605            return p._6();
606          }
607        };
608      }
609    
610      /**
611       * Returns a function that returns the seventh element of a product.
612       *
613       * @return A function that returns the seventh element of a product.
614       */
615      public static <A, B, C, D, E, F$, G, H> fj.F<P8<A, B, C, D, E, F$, G, H>, G> __7() {
616        return new fj.F<P8<A, B, C, D, E, F$, G, H>, G>() {
617          public G f(final P8<A, B, C, D, E, F$, G, H> p) {
618            return p._7();
619          }
620        };
621      }
622    
623      /**
624       * Returns a function that returns the eighth element of a product.
625       *
626       * @return A function that returns the eighth element of a product.
627       */
628      public static <A, B, C, D, E, F$, G, H> fj.F<P8<A, B, C, D, E, F$, G, H>, H> __8() {
629        return new fj.F<P8<A, B, C, D, E, F$, G, H>, H>() {
630          public H f(final P8<A, B, C, D, E, F$, G, H> p) {
631            return p._8();
632          }
633        };
634      }
635    }