#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright © 2014 <NAME> (<EMAIL>)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

import os
import textwrap

rootDir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
fileNme = os.path.basename(os.path.realpath(__file__))
fileDir = os.path.join(rootDir, "emma-language", "src", "main", "scala", "org", "emmalanguage", "api", "alg")


for i in range(2, 23):
    fh = open(os.path.join(fileDir, "Alg%(i)d.scala" % locals()), 'w+')

    print >> fh, textwrap.dedent("""\
        /*
         * Copyright © 2014 <NAME> (<EMAIL>)
         *
         * Licensed under the Apache License, Version 2.0 (the "License");
         * you may not use this file except in compliance with the License.
         * You may obtain a copy of the License at
         *
         *     http://www.apache.org/licenses/LICENSE-2.0
         *
         * Unless required by applicable law or agreed to in writing, software
         * distributed under the License is distributed on an "AS IS" BASIS,
         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
         * See the License for the specific language governing permissions and
         * limitations under the License.
         */
        package org.emmalanguage
        package api.alg
    
        // !!! DO NOT MODIFY - SOURCE FILE GENERATED BY `tools/%(fileNme)s` !!!
        """ % locals())

    print >> fh, "//@formatter:off\n"

    Bs = ",".join(["B%d" % j for j in range(1, i + 1)])
    paras = ",\n  ".join(["alg%(j)i: Alg[A,B%(j)i]" % {"j": j} for j in range(1, i + 1)])
    zeros = ",\n    ".join(["alg%d.zero" % j for j in range(1, i + 1)])
    inits = ",\n    ".join(["alg%d.init(x)" % j for j in range(1, i + 1)])
    pluss = ",\n    ".join(["alg%(j)i.plus(x._%(j)i, y._%(j)i)" % {"j": j} for j in range(1, i + 1)])

    print >> fh, textwrap.dedent("""\
        case class Alg%(i)i[A,%(Bs)s]
        (
          %(paras)s
        ) extends Alg[A,(%(Bs)s)] {
          type B = (%(Bs)s)
          val zero: B = (
            %(zeros)s
          )
          val init: A => B = (x: A) => (
            %(inits)s
          )
          val plus: (B,B) => B = (x: B, y: B) => (
            %(pluss)s
          )
        }
        """) % locals()

    print >> fh, "//@formatter:on"

    fh.close()

#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright © 2014 <NAME> (<EMAIL>)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

import os
import textwrap

rootDir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
fileNme = os.path.basename(os.path.realpath(__file__))
fileDir = os.path.join(rootDir, "emma-language", "src", "main", "scala", "org", "emmalanguage", "api", "alg")


for i in range(2, 23):
    fh = open(os.path.join(fileDir, "Alg%(i)d.scala" % locals()), 'w+')

    print >> fh, textwrap.dedent("""\
        /*
         * Copyright © 2014 <NAME> (<EMAIL>)
         *
         * Licensed under the Apache License, Version 2.0 (the "License");
         * you may not use this file except in compliance with the License.
         * You may obtain a copy of the License at
         *
         *     http://www.apache.org/licenses/LICENSE-2.0
         *
         * Unless required by applicable law or agreed to in writing, software
         * distributed under the License is distributed on an "AS IS" BASIS,
         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
         * See the License for the specific language governing permissions and
         * limitations under the License.
         */
        package org.emmalanguage
        package api.alg
    
        // !!! DO NOT MODIFY - SOURCE FILE GENERATED BY `tools/%(fileNme)s` !!!
        """ % locals())

    print >> fh, "//@formatter:off\n"

    Bs = ",".join(["B%d" % j for j in range(1, i + 1)])
    paras = ",\n  ".join(["alg%(j)i: Alg[A,B%(j)i]" % {"j": j} for j in range(1, i + 1)])
    zeros = ",\n    ".join(["alg%d.zero" % j for j in range(1, i + 1)])
    inits = ",\n    ".join(["alg%d.init(x)" % j for j in range(1, i + 1)])
    pluss = ",\n    ".join(["alg%(j)i.plus(x._%(j)i, y._%(j)i)" % {"j": j} for j in range(1, i + 1)])

    print >> fh, textwrap.dedent("""\
        case class Alg%(i)i[A,%(Bs)s]
        (
          %(paras)s
        ) extends Alg[A,(%(Bs)s)] {
          type B = (%(Bs)s)
          val zero: B = (
            %(zeros)s
          )
          val init: A => B = (x: A) => (
            %(inits)s
          )
          val plus: (B,B) => B = (x: B, y: B) => (
            %(pluss)s
          )
        }
        """) % locals()

    print >> fh, "//@formatter:on"

    fh.close()

#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright © 2014 <NAME> (<EMAIL>) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # #     http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # \         /*          * Copyright © 2014 <NAME> (<EMAIL>)          *          * Licensed under the Apache License, Version 2.0 (the "License");          * you may not use this file except in compliance with the License.          * You may obtain a copy of the License at          *          *     http://www.apache.org/licenses/LICENSE-2.0          *          * Unless required by applicable law or agreed to in writing, software          * distributed under the License is distributed on an "AS IS" BASIS,          * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.          * See the License for the specific language governing permissions and          * limitations under the License.          */         package org.emmalanguage         package api.alg              // !!! DO NOT MODIFY - SOURCE FILE GENERATED BY `tools/%(fileNme)s` !!! \         case class Alg%(i)i[A,%(Bs)s]         (           %(paras)s         ) extends Alg[A,(%(Bs)s)] {           type B = (%(Bs)s)           val zero: B = (             %(zeros)s           )           val init: A => B = (x: A) => (             %(inits)s           )           val plus: (B,B) => B = (x: B, y: B) => (             %(pluss)s           )         }