All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.decomat.Then2.kt Maven / Gradle / Ivy

There is a newer version: 0.3.0
Show newest version
package io.decomat


fun , R1, P2: Pattern0, R2, R> case(pat: Pattern2) = Then00(pat, {true})

class Then00, R1, P2: Pattern0, R2, R>(
  override val pat: Pattern2,
  override val check: (R) -> Boolean
): Stage, R> {

  inline fun  useComponents(r: R, f: (R1, R2) -> O): O =
    (r as? ProductClass<*>)?.let {
      val (r1, r2) = pat.divideIntoComponentsAny(it)
      //skip
      //skip
      f(r1, r2)
    } ?: notRightCls(r)

  inline fun  then(crossinline f: (R1, R2) -> O) =
    StageCase(pat, check) { value -> useComponents(value, f) }

  inline fun  thenThis(crossinline f: R.() -> (R1, R2) -> O) =
    StageCase(pat, check) { v -> useComponents(v, f(v)) }
}

fun , R1, P2: Pattern1, P21: Pattern, R21, R2, R> case(pat: Pattern2) = Then01(pat, {true})

class Then01, R1, P2: Pattern1, P21: Pattern, R21, R2, R>(
  override val pat: Pattern2,
  override val check: (R) -> Boolean
): Stage, R> {

  inline fun  useComponents(r: R, f: (R1, Components1) -> O): O =
    (r as? ProductClass<*>)?.let {
      val (r1, r2) = pat.divideIntoComponentsAny(it)
      //skip
      val (r21) = pat.pattern2.divideIntoComponentsAny(r2 as Any)
      f(r1, Components1(r21))
    } ?: notRightCls(r)

  inline fun  then(crossinline f: (R1, Components1) -> O) =
    StageCase(pat, check) { value -> useComponents(value, f) }

  inline fun  thenThis(crossinline f: R.() -> (R1, Components1) -> O) =
    StageCase(pat, check) { v -> useComponents(v, f(v)) }
}

fun , R1, P2: Pattern2, P21: Pattern, R21, P22: Pattern, R22, R2, R> case(pat: Pattern2) = Then02(pat, {true})

class Then02, R1, P2: Pattern2, P21: Pattern, R21, P22: Pattern, R22, R2, R>(
  override val pat: Pattern2,
  override val check: (R) -> Boolean
): Stage, R> {

  inline fun  useComponents(r: R, f: (R1, Components2) -> O): O =
    (r as? ProductClass<*>)?.let {
      val (r1, r2) = pat.divideIntoComponentsAny(it)
      //skip
      val (r21, r22) = pat.pattern2.divideIntoComponentsAny(r2 as Any)
      f(r1, Components2(r21, r22))
    } ?: notRightCls(r)

  inline fun  then(crossinline f: (R1, Components2) -> O) =
    StageCase(pat, check) { value -> useComponents(value, f) }

  inline fun  thenThis(crossinline f: R.() -> (R1, Components2) -> O) =
    StageCase(pat, check) { v -> useComponents(v, f(v)) }
}

fun , R1, P2: Pattern3, P21: Pattern, R21, P22: Pattern, R22, P23: Pattern, R23, R2, R> case(pat: Pattern2) = Then03(pat, {true})

class Then03, R1, P2: Pattern3, P21: Pattern, R21, P22: Pattern, R22, P23: Pattern, R23, R2, R>(
  override val pat: Pattern2,
  override val check: (R) -> Boolean
): Stage, R> {

  inline fun  useComponents(r: R, f: (R1, Components3) -> O): O =
    (r as? ProductClass<*>)?.let {
      val (r1, r2) = pat.divideIntoComponentsAny(it)
      //skip
      val (r21, r22, r23) = pat.pattern2.divideIntoComponentsAny(r2 as Any)
      f(r1, Components3(r21, r22, r23))
    } ?: notRightCls(r)

  inline fun  then(crossinline f: (R1, Components3) -> O) =
    StageCase(pat, check) { value -> useComponents(value, f) }

  inline fun  thenThis(crossinline f: R.() -> (R1, Components3) -> O) =
    StageCase(pat, check) { v -> useComponents(v, f(v)) }
}

fun , P11: Pattern, R11, R1, P2: Pattern0, R2, R> case(pat: Pattern2) = Then10(pat, {true})

class Then10, P11: Pattern, R11, R1, P2: Pattern0, R2, R>(
  override val pat: Pattern2,
  override val check: (R) -> Boolean
): Stage, R> {

  inline fun  useComponents(r: R, f: (Components1, R2) -> O): O =
    (r as? ProductClass<*>)?.let {
      val (r1, r2) = pat.divideIntoComponentsAny(it)
      val (r11) = pat.pattern1.divideIntoComponentsAny(r1 as Any)
      //skip
      f(Components1(r11), r2)
    } ?: notRightCls(r)

  inline fun  then(crossinline f: (Components1, R2) -> O) =
    StageCase(pat, check) { value -> useComponents(value, f) }

  inline fun  thenThis(crossinline f: R.() -> (Components1, R2) -> O) =
    StageCase(pat, check) { v -> useComponents(v, f(v)) }
}

fun , P11: Pattern, R11, R1, P2: Pattern1, P21: Pattern, R21, R2, R> case(pat: Pattern2) = Then11(pat, {true})

class Then11, P11: Pattern, R11, R1, P2: Pattern1, P21: Pattern, R21, R2, R>(
  override val pat: Pattern2,
  override val check: (R) -> Boolean
): Stage, R> {

  inline fun  useComponents(r: R, f: (Components1, Components1) -> O): O =
    (r as? ProductClass<*>)?.let {
      val (r1, r2) = pat.divideIntoComponentsAny(it)
      val (r11) = pat.pattern1.divideIntoComponentsAny(r1 as Any)
      val (r21) = pat.pattern2.divideIntoComponentsAny(r2 as Any)
      f(Components1(r11), Components1(r21))
    } ?: notRightCls(r)

  inline fun  then(crossinline f: (Components1, Components1) -> O) =
    StageCase(pat, check) { value -> useComponents(value, f) }

  inline fun  thenThis(crossinline f: R.() -> (Components1, Components1) -> O) =
    StageCase(pat, check) { v -> useComponents(v, f(v)) }
}

fun , P11: Pattern, R11, R1, P2: Pattern2, P21: Pattern, R21, P22: Pattern, R22, R2, R> case(pat: Pattern2) = Then12(pat, {true})

class Then12, P11: Pattern, R11, R1, P2: Pattern2, P21: Pattern, R21, P22: Pattern, R22, R2, R>(
  override val pat: Pattern2,
  override val check: (R) -> Boolean
): Stage, R> {

  inline fun  useComponents(r: R, f: (Components1, Components2) -> O): O =
    (r as? ProductClass<*>)?.let {
      val (r1, r2) = pat.divideIntoComponentsAny(it)
      val (r11) = pat.pattern1.divideIntoComponentsAny(r1 as Any)
      val (r21, r22) = pat.pattern2.divideIntoComponentsAny(r2 as Any)
      f(Components1(r11), Components2(r21, r22))
    } ?: notRightCls(r)

  inline fun  then(crossinline f: (Components1, Components2) -> O) =
    StageCase(pat, check) { value -> useComponents(value, f) }

  inline fun  thenThis(crossinline f: R.() -> (Components1, Components2) -> O) =
    StageCase(pat, check) { v -> useComponents(v, f(v)) }
}

fun , P11: Pattern, R11, R1, P2: Pattern3, P21: Pattern, R21, P22: Pattern, R22, P23: Pattern, R23, R2, R> case(pat: Pattern2) = Then13(pat, {true})

class Then13, P11: Pattern, R11, R1, P2: Pattern3, P21: Pattern, R21, P22: Pattern, R22, P23: Pattern, R23, R2, R>(
  override val pat: Pattern2,
  override val check: (R) -> Boolean
): Stage, R> {

  inline fun  useComponents(r: R, f: (Components1, Components3) -> O): O =
    (r as? ProductClass<*>)?.let {
      val (r1, r2) = pat.divideIntoComponentsAny(it)
      val (r11) = pat.pattern1.divideIntoComponentsAny(r1 as Any)
      val (r21, r22, r23) = pat.pattern2.divideIntoComponentsAny(r2 as Any)
      f(Components1(r11), Components3(r21, r22, r23))
    } ?: notRightCls(r)

  inline fun  then(crossinline f: (Components1, Components3) -> O) =
    StageCase(pat, check) { value -> useComponents(value, f) }

  inline fun  thenThis(crossinline f: R.() -> (Components1, Components3) -> O) =
    StageCase(pat, check) { v -> useComponents(v, f(v)) }
}

fun , P11: Pattern, R11, P12: Pattern, R12, R1, P2: Pattern0, R2, R> case(pat: Pattern2) = Then20(pat, {true})

class Then20, P11: Pattern, R11, P12: Pattern, R12, R1, P2: Pattern0, R2, R>(
  override val pat: Pattern2,
  override val check: (R) -> Boolean
): Stage, R> {

  inline fun  useComponents(r: R, f: (Components2, R2) -> O): O =
    (r as? ProductClass<*>)?.let {
      val (r1, r2) = pat.divideIntoComponentsAny(it)
      val (r11, r12) = pat.pattern1.divideIntoComponentsAny(r1 as Any)
      //skip
      f(Components2(r11, r12), r2)
    } ?: notRightCls(r)

  inline fun  then(crossinline f: (Components2, R2) -> O) =
    StageCase(pat, check) { value -> useComponents(value, f) }

  inline fun  thenThis(crossinline f: R.() -> (Components2, R2) -> O) =
    StageCase(pat, check) { v -> useComponents(v, f(v)) }
}

fun , P11: Pattern, R11, P12: Pattern, R12, R1, P2: Pattern1, P21: Pattern, R21, R2, R> case(pat: Pattern2) = Then21(pat, {true})

class Then21, P11: Pattern, R11, P12: Pattern, R12, R1, P2: Pattern1, P21: Pattern, R21, R2, R>(
  override val pat: Pattern2,
  override val check: (R) -> Boolean
): Stage, R> {

  inline fun  useComponents(r: R, f: (Components2, Components1) -> O): O =
    (r as? ProductClass<*>)?.let {
      val (r1, r2) = pat.divideIntoComponentsAny(it)
      val (r11, r12) = pat.pattern1.divideIntoComponentsAny(r1 as Any)
      val (r21) = pat.pattern2.divideIntoComponentsAny(r2 as Any)
      f(Components2(r11, r12), Components1(r21))
    } ?: notRightCls(r)

  inline fun  then(crossinline f: (Components2, Components1) -> O) =
    StageCase(pat, check) { value -> useComponents(value, f) }

  inline fun  thenThis(crossinline f: R.() -> (Components2, Components1) -> O) =
    StageCase(pat, check) { v -> useComponents(v, f(v)) }
}

fun , P11: Pattern, R11, P12: Pattern, R12, R1, P2: Pattern2, P21: Pattern, R21, P22: Pattern, R22, R2, R> case(pat: Pattern2) = Then22(pat, {true})

class Then22, P11: Pattern, R11, P12: Pattern, R12, R1, P2: Pattern2, P21: Pattern, R21, P22: Pattern, R22, R2, R>(
  override val pat: Pattern2,
  override val check: (R) -> Boolean
): Stage, R> {

  inline fun  useComponents(r: R, f: (Components2, Components2) -> O): O =
    (r as? ProductClass<*>)?.let {
      val (r1, r2) = pat.divideIntoComponentsAny(it)
      val (r11, r12) = pat.pattern1.divideIntoComponentsAny(r1 as Any)
      val (r21, r22) = pat.pattern2.divideIntoComponentsAny(r2 as Any)
      f(Components2(r11, r12), Components2(r21, r22))
    } ?: notRightCls(r)

  inline fun  then(crossinline f: (Components2, Components2) -> O) =
    StageCase(pat, check) { value -> useComponents(value, f) }

  inline fun  thenThis(crossinline f: R.() -> (Components2, Components2) -> O) =
    StageCase(pat, check) { v -> useComponents(v, f(v)) }
}

fun , P11: Pattern, R11, P12: Pattern, R12, R1, P2: Pattern3, P21: Pattern, R21, P22: Pattern, R22, P23: Pattern, R23, R2, R> case(pat: Pattern2) = Then23(pat, {true})

class Then23, P11: Pattern, R11, P12: Pattern, R12, R1, P2: Pattern3, P21: Pattern, R21, P22: Pattern, R22, P23: Pattern, R23, R2, R>(
  override val pat: Pattern2,
  override val check: (R) -> Boolean
): Stage, R> {

  inline fun  useComponents(r: R, f: (Components2, Components3) -> O): O =
    (r as? ProductClass<*>)?.let {
      val (r1, r2) = pat.divideIntoComponentsAny(it)
      val (r11, r12) = pat.pattern1.divideIntoComponentsAny(r1 as Any)
      val (r21, r22, r23) = pat.pattern2.divideIntoComponentsAny(r2 as Any)
      f(Components2(r11, r12), Components3(r21, r22, r23))
    } ?: notRightCls(r)

  inline fun  then(crossinline f: (Components2, Components3) -> O) =
    StageCase(pat, check) { value -> useComponents(value, f) }

  inline fun  thenThis(crossinline f: R.() -> (Components2, Components3) -> O) =
    StageCase(pat, check) { v -> useComponents(v, f(v)) }
}

fun , P11: Pattern, R11, P12: Pattern, R12, P13: Pattern, R13, R1, P2: Pattern0, R2, R> case(pat: Pattern2) = Then30(pat, {true})

class Then30, P11: Pattern, R11, P12: Pattern, R12, P13: Pattern, R13, R1, P2: Pattern0, R2, R>(
  override val pat: Pattern2,
  override val check: (R) -> Boolean
): Stage, R> {

  inline fun  useComponents(r: R, f: (Components3, R2) -> O): O =
    (r as? ProductClass<*>)?.let {
      val (r1, r2) = pat.divideIntoComponentsAny(it)
      val (r11, r12, r13) = pat.pattern1.divideIntoComponentsAny(r1 as Any)
      //skip
      f(Components3(r11, r12, r13), r2)
    } ?: notRightCls(r)

  inline fun  then(crossinline f: (Components3, R2) -> O) =
    StageCase(pat, check) { value -> useComponents(value, f) }

  inline fun  thenThis(crossinline f: R.() -> (Components3, R2) -> O) =
    StageCase(pat, check) { v -> useComponents(v, f(v)) }
}

fun , P11: Pattern, R11, P12: Pattern, R12, P13: Pattern, R13, R1, P2: Pattern1, P21: Pattern, R21, R2, R> case(pat: Pattern2) = Then31(pat, {true})

class Then31, P11: Pattern, R11, P12: Pattern, R12, P13: Pattern, R13, R1, P2: Pattern1, P21: Pattern, R21, R2, R>(
  override val pat: Pattern2,
  override val check: (R) -> Boolean
): Stage, R> {

  inline fun  useComponents(r: R, f: (Components3, Components1) -> O): O =
    (r as? ProductClass<*>)?.let {
      val (r1, r2) = pat.divideIntoComponentsAny(it)
      val (r11, r12, r13) = pat.pattern1.divideIntoComponentsAny(r1 as Any)
      val (r21) = pat.pattern2.divideIntoComponentsAny(r2 as Any)
      f(Components3(r11, r12, r13), Components1(r21))
    } ?: notRightCls(r)

  inline fun  then(crossinline f: (Components3, Components1) -> O) =
    StageCase(pat, check) { value -> useComponents(value, f) }

  inline fun  thenThis(crossinline f: R.() -> (Components3, Components1) -> O) =
    StageCase(pat, check) { v -> useComponents(v, f(v)) }
}

fun , P11: Pattern, R11, P12: Pattern, R12, P13: Pattern, R13, R1, P2: Pattern2, P21: Pattern, R21, P22: Pattern, R22, R2, R> case(pat: Pattern2) = Then32(pat, {true})

class Then32, P11: Pattern, R11, P12: Pattern, R12, P13: Pattern, R13, R1, P2: Pattern2, P21: Pattern, R21, P22: Pattern, R22, R2, R>(
  override val pat: Pattern2,
  override val check: (R) -> Boolean
): Stage, R> {

  inline fun  useComponents(r: R, f: (Components3, Components2) -> O): O =
    (r as? ProductClass<*>)?.let {
      val (r1, r2) = pat.divideIntoComponentsAny(it)
      val (r11, r12, r13) = pat.pattern1.divideIntoComponentsAny(r1 as Any)
      val (r21, r22) = pat.pattern2.divideIntoComponentsAny(r2 as Any)
      f(Components3(r11, r12, r13), Components2(r21, r22))
    } ?: notRightCls(r)

  inline fun  then(crossinline f: (Components3, Components2) -> O) =
    StageCase(pat, check) { value -> useComponents(value, f) }

  inline fun  thenThis(crossinline f: R.() -> (Components3, Components2) -> O) =
    StageCase(pat, check) { v -> useComponents(v, f(v)) }
}

fun , P11: Pattern, R11, P12: Pattern, R12, P13: Pattern, R13, R1, P2: Pattern3, P21: Pattern, R21, P22: Pattern, R22, P23: Pattern, R23, R2, R> case(pat: Pattern2) = Then33(pat, {true})

class Then33, P11: Pattern, R11, P12: Pattern, R12, P13: Pattern, R13, R1, P2: Pattern3, P21: Pattern, R21, P22: Pattern, R22, P23: Pattern, R23, R2, R>(
  override val pat: Pattern2,
  override val check: (R) -> Boolean
): Stage, R> {

  inline fun  useComponents(r: R, f: (Components3, Components3) -> O): O =
    (r as? ProductClass<*>)?.let {
      val (r1, r2) = pat.divideIntoComponentsAny(it)
      val (r11, r12, r13) = pat.pattern1.divideIntoComponentsAny(r1 as Any)
      val (r21, r22, r23) = pat.pattern2.divideIntoComponentsAny(r2 as Any)
      f(Components3(r11, r12, r13), Components3(r21, r22, r23))
    } ?: notRightCls(r)

  inline fun  then(crossinline f: (Components3, Components3) -> O) =
    StageCase(pat, check) { value -> useComponents(value, f) }

  inline fun  thenThis(crossinline f: R.() -> (Components3, Components3) -> O) =
    StageCase(pat, check) { v -> useComponents(v, f(v)) }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy