001 package fj; 002 003 import static fj.FW.$; 004 005 /** 006 * A product-7. 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 P7<A, B, C, D, E, F, G> { 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 * Map the first element of the product. 067 * 068 * @param f The function to map with. 069 * @return A product with the given function applied. 070 */ 071 public <X> P7<X, B, C, D, E, F, G> map1(final fj.F<A, X> f) { 072 return new P7<X, B, C, D, E, F, G>() { 073 public X _1() { 074 return f.f(P7.this._1()); 075 } 076 077 public B _2() { 078 return P7.this._2(); 079 } 080 081 public C _3() { 082 return P7.this._3(); 083 } 084 085 public D _4() { 086 return P7.this._4(); 087 } 088 089 public E _5() { 090 return P7.this._5(); 091 } 092 093 public F _6() { 094 return P7.this._6(); 095 } 096 097 public G _7() { 098 return P7.this._7(); 099 } 100 }; 101 } 102 103 /** 104 * Map the second element of the product. 105 * 106 * @param f The function to map with. 107 * @return A product with the given function applied. 108 */ 109 public <X> P7<A, X, C, D, E, F, G> map2(final fj.F<B, X> f) { 110 return new P7<A, X, C, D, E, F, G>() { 111 public A _1() { 112 return P7.this._1(); 113 } 114 115 public X _2() { 116 return f.f(P7.this._2()); 117 } 118 119 public C _3() { 120 return P7.this._3(); 121 } 122 123 public D _4() { 124 return P7.this._4(); 125 } 126 127 public E _5() { 128 return P7.this._5(); 129 } 130 131 public F _6() { 132 return P7.this._6(); 133 } 134 135 public G _7() { 136 return P7.this._7(); 137 } 138 }; 139 } 140 141 /** 142 * Map the third element of the product. 143 * 144 * @param f The function to map with. 145 * @return A product with the given function applied. 146 */ 147 public <X> P7<A, B, X, D, E, F, G> map3(final fj.F<C, X> f) { 148 return new P7<A, B, X, D, E, F, G>() { 149 public A _1() { 150 return P7.this._1(); 151 } 152 153 public B _2() { 154 return P7.this._2(); 155 } 156 157 public X _3() { 158 return f.f(P7.this._3()); 159 } 160 161 public D _4() { 162 return P7.this._4(); 163 } 164 165 public E _5() { 166 return P7.this._5(); 167 } 168 169 public F _6() { 170 return P7.this._6(); 171 } 172 173 public G _7() { 174 return P7.this._7(); 175 } 176 }; 177 } 178 179 /** 180 * Map the fourth element of the product. 181 * 182 * @param f The function to map with. 183 * @return A product with the given function applied. 184 */ 185 public <X> P7<A, B, C, X, E, F, G> map4(final fj.F<D, X> f) { 186 return new P7<A, B, C, X, E, F, G>() { 187 public A _1() { 188 return P7.this._1(); 189 } 190 191 public B _2() { 192 return P7.this._2(); 193 } 194 195 public C _3() { 196 return P7.this._3(); 197 } 198 199 public X _4() { 200 return f.f(P7.this._4()); 201 } 202 203 public E _5() { 204 return P7.this._5(); 205 } 206 207 public F _6() { 208 return P7.this._6(); 209 } 210 211 public G _7() { 212 return P7.this._7(); 213 } 214 }; 215 } 216 217 /** 218 * Map the fifth element of the product. 219 * 220 * @param f The function to map with. 221 * @return A product with the given function applied. 222 */ 223 public <X> P7<A, B, C, D, X, F, G> map5(final fj.F<E, X> f) { 224 return new P7<A, B, C, D, X, F, G>() { 225 public A _1() { 226 return P7.this._1(); 227 } 228 229 public B _2() { 230 return P7.this._2(); 231 } 232 233 public C _3() { 234 return P7.this._3(); 235 } 236 237 public D _4() { 238 return P7.this._4(); 239 } 240 241 public X _5() { 242 return f.f(P7.this._5()); 243 } 244 245 public F _6() { 246 return P7.this._6(); 247 } 248 249 public G _7() { 250 return P7.this._7(); 251 } 252 }; 253 } 254 255 /** 256 * Map the sixth element of the product. 257 * 258 * @param f The function to map with. 259 * @return A product with the given function applied. 260 */ 261 public <X> P7<A, B, C, D, E, X, G> map6(final fj.F<F, X> f) { 262 return new P7<A, B, C, D, E, X, G>() { 263 public A _1() { 264 return P7.this._1(); 265 } 266 267 public B _2() { 268 return P7.this._2(); 269 } 270 271 public C _3() { 272 return P7.this._3(); 273 } 274 275 public D _4() { 276 return P7.this._4(); 277 } 278 279 public E _5() { 280 return P7.this._5(); 281 } 282 283 public X _6() { 284 return f.f(P7.this._6()); 285 } 286 287 public G _7() { 288 return P7.this._7(); 289 } 290 }; 291 } 292 293 /** 294 * Map the seventh element of the product. 295 * 296 * @param f The function to map with. 297 * @return A product with the given function applied. 298 */ 299 public <X> P7<A, B, C, D, E, F, X> map7(final fj.F<G, X> f) { 300 return new P7<A, B, C, D, E, F, X>() { 301 public A _1() { 302 return P7.this._1(); 303 } 304 305 public B _2() { 306 return P7.this._2(); 307 } 308 309 public C _3() { 310 return P7.this._3(); 311 } 312 313 public D _4() { 314 return P7.this._4(); 315 } 316 317 public E _5() { 318 return P7.this._5(); 319 } 320 321 public F _6() { 322 return P7.this._6(); 323 } 324 325 public X _7() { 326 return f.f(P7.this._7()); 327 } 328 }; 329 } 330 331 /** 332 * Returns the 1-product projection over the first element. 333 * 334 * @return the 1-product projection over the first element. 335 */ 336 public P1<A> _1_() { 337 return $(P7.<A, B, C, D, E, F, G>__1()).lazy().f(this); 338 } 339 340 /** 341 * Returns the 1-product projection over the second element. 342 * 343 * @return the 1-product projection over the second element. 344 */ 345 public P1<B> _2_() { 346 return $(P7.<A, B, C, D, E, F, G>__2()).lazy().f(this); 347 } 348 349 /** 350 * Returns the 1-product projection over the third element. 351 * 352 * @return the 1-product projection over the third element. 353 */ 354 public P1<C> _3_() { 355 return $(P7.<A, B, C, D, E, F, G>__3()).lazy().f(this); 356 } 357 358 /** 359 * Returns the 1-product projection over the fourth element. 360 * 361 * @return the 1-product projection over the fourth element. 362 */ 363 public P1<D> _4_() { 364 return $(P7.<A, B, C, D, E, F, G>__4()).lazy().f(this); 365 } 366 367 /** 368 * Returns the 1-product projection over the fifth element. 369 * 370 * @return the 1-product projection over the fifth element. 371 */ 372 public P1<E> _5_() { 373 return $(P7.<A, B, C, D, E, F, G>__5()).lazy().f(this); 374 } 375 376 /** 377 * Returns the 1-product projection over the sixth element. 378 * 379 * @return the 1-product projection over the sixth element. 380 */ 381 public P1<F> _6_() { 382 return $(P7.<A, B, C, D, E, F, G>__6()).lazy().f(this); 383 } 384 385 /** 386 * Returns the 1-product projection over the seventh element. 387 * 388 * @return the 1-product projection over the seventh element. 389 */ 390 public P1<G> _7_() { 391 return $(P7.<A, B, C, D, E, F, G>__7()).lazy().f(this); 392 } 393 394 /** 395 * Provides a memoising P7 that remembers its values. 396 * 397 * @return A P7 that calls this P7 once for any given element and remembers the value for subsequent calls. 398 */ 399 public P7<A, B, C, D, E, F, G> memo() { 400 return new P7<A, B, C, D, E, F, G>() { 401 private final P1<A> a = _1_().memo(); 402 private final P1<B> b = _2_().memo(); 403 private final P1<C> c = _3_().memo(); 404 private final P1<D> d = _4_().memo(); 405 private final P1<E> e = _5_().memo(); 406 private final P1<F> f = _6_().memo(); 407 private final P1<G> g = _7_().memo(); 408 409 public A _1() { 410 return a._1(); 411 } 412 413 public B _2() { 414 return b._1(); 415 } 416 417 public C _3() { 418 return c._1(); 419 } 420 421 public D _4() { 422 return d._1(); 423 } 424 425 public E _5() { 426 return e._1(); 427 } 428 429 public F _6() { 430 return f._1(); 431 } 432 433 public G _7() { 434 return g._1(); 435 } 436 }; 437 } 438 439 /** 440 * Returns a function that returns the first element of a product. 441 * 442 * @return A function that returns the first element of a product. 443 */ 444 public static <A, B, C, D, E, F$, G> fj.F<P7<A, B, C, D, E, F$, G>, A> __1() { 445 return new fj.F<P7<A, B, C, D, E, F$, G>, A>() { 446 public A f(final P7<A, B, C, D, E, F$, G> p) { 447 return p._1(); 448 } 449 }; 450 } 451 452 /** 453 * Returns a function that returns the second element of a product. 454 * 455 * @return A function that returns the second element of a product. 456 */ 457 public static <A, B, C, D, E, F$, G> fj.F<P7<A, B, C, D, E, F$, G>, B> __2() { 458 return new fj.F<P7<A, B, C, D, E, F$, G>, B>() { 459 public B f(final P7<A, B, C, D, E, F$, G> p) { 460 return p._2(); 461 } 462 }; 463 } 464 465 /** 466 * Returns a function that returns the third element of a product. 467 * 468 * @return A function that returns the third element of a product. 469 */ 470 public static <A, B, C, D, E, F$, G> fj.F<P7<A, B, C, D, E, F$, G>, C> __3() { 471 return new fj.F<P7<A, B, C, D, E, F$, G>, C>() { 472 public C f(final P7<A, B, C, D, E, F$, G> p) { 473 return p._3(); 474 } 475 }; 476 } 477 478 /** 479 * Returns a function that returns the fourth element of a product. 480 * 481 * @return A function that returns the fourth element of a product. 482 */ 483 public static <A, B, C, D, E, F$, G> fj.F<P7<A, B, C, D, E, F$, G>, D> __4() { 484 return new fj.F<P7<A, B, C, D, E, F$, G>, D>() { 485 public D f(final P7<A, B, C, D, E, F$, G> p) { 486 return p._4(); 487 } 488 }; 489 } 490 491 /** 492 * Returns a function that returns the fifth element of a product. 493 * 494 * @return A function that returns the fifth element of a product. 495 */ 496 public static <A, B, C, D, E, F$, G> fj.F<P7<A, B, C, D, E, F$, G>, E> __5() { 497 return new fj.F<P7<A, B, C, D, E, F$, G>, E>() { 498 public E f(final P7<A, B, C, D, E, F$, G> p) { 499 return p._5(); 500 } 501 }; 502 } 503 504 /** 505 * Returns a function that returns the sixth element of a product. 506 * 507 * @return A function that returns the sixth element of a product. 508 */ 509 public static <A, B, C, D, E, F$, G> fj.F<P7<A, B, C, D, E, F$, G>, F$> __6() { 510 return new fj.F<P7<A, B, C, D, E, F$, G>, F$>() { 511 public F$ f(final P7<A, B, C, D, E, F$, G> p) { 512 return p._6(); 513 } 514 }; 515 } 516 517 /** 518 * Returns a function that returns the seventh element of a product. 519 * 520 * @return A function that returns the seventh element of a product. 521 */ 522 public static <A, B, C, D, E, F$, G> fj.F<P7<A, B, C, D, E, F$, G>, G> __7() { 523 return new fj.F<P7<A, B, C, D, E, F$, G>, G>() { 524 public G f(final P7<A, B, C, D, E, F$, G> p) { 525 return p._7(); 526 } 527 }; 528 } 529 }