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

raw.compiler.rql2.builtin.IntervalPackageBuilder.scala Maven / Gradle / Ivy

There is a newer version: 0.33.11
Show newest version
/*
 * Copyright 2023 RAW Labs S.A.
 *
 * Use of this software is governed by the Business Source License
 * included in the file licenses/BSL.txt.
 *
 * As of the Change Date specified in that file, in accordance with
 * the Business Source License, use of this software will be governed
 * by the Apache License, Version 2.0, included in the file
 * licenses/APL.txt.
 */

package raw.compiler.rql2.builtin

import raw.compiler.common.source._
import raw.compiler.rql2.source._

object IntervalPackageBuilder {

  object Build {
    def apply(e: Exp): Exp = {
      FunApp(Proj(PackageIdnExp("Interval"), "Build"), Vector(FunAppArg(e, None)))
    }
  }

  object FromRawInterval {
    def apply(years: Int, months: Int, weeks: Int, days: Int, hours: Int, minutes: Int, seconds: Int, millis: Int)
        : Exp = {
      FunApp(
        Proj(PackageIdnExp("Interval"), "Build"),
        Vector(
          FunAppArg(IntConst(years.toString), Some("years")),
          FunAppArg(IntConst(months.toString), Some("months")),
          FunAppArg(IntConst(days.toString), Some("days")),
          FunAppArg(IntConst(hours.toString), Some("hours")),
          FunAppArg(IntConst(minutes.toString), Some("minutes")),
          FunAppArg(IntConst(seconds.toString), Some("seconds")),
          FunAppArg(IntConst(millis.toString), Some("millis"))
        )
      )

    }
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy