instruction
stringclasses
1 value
output
stringlengths
5
1M
Explain and rewrite the following Scala code:
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: /** @author John Miller * @version 1.3 * @date Sat May 30 13:51:12 EDT 2015 * @see LICENSE (MIT style license file). */ package scalation.linalgebra.bld import java.io.{File, PrintWriter} //::::::::::::::::::::::::::::::...
Explain and rewrite the following Scala code:
package com.anchortab.snippet import net.liftweb._ import sitemap._ import Loc._ import common._ import http._ import SHtml._ import util._ import Helpers._ import com.stripe import com.anchortab.model._ import com.anchortab.util._ import org.joda.time._ object Invoice { val menu = Menu.param[...
Explain and rewrite the following Scala code:
package drainreceiver import com.github.vonnagy.service.container.ContainerBuilder import drainreceiver.routes.DrainEndpoints /** * Created by ivannagy on 4/8/15. */ object Service extends App { // Here we establish the container and build it while // applying extras. val service = new ContainerBuilder() ...
Explain and rewrite the following Scala code:
package controllers import javax.inject.{Inject, Singleton} import org.webjars.play.{RequireJS, WebJarAssets, WebJarsUtil} import play.api.mvc.{Action, InjectedController} @Singleton class Application @Inject() (indexTemplate: views.html.index) extends InjectedController { def index = Action { Ok(indexTemplat...
Explain and rewrite the following Scala code:
package com.scalaAsm.x86 package Instructions package General // Description: Move // Category: general/datamov trait MOV extends InstructionDefinition { val mnemonic = "MOV" } object MOV extends OneOperand[MOV] with TwoOperands[MOV] with MOVImpl trait MOVLow extends MOV { implicit object _0 extends TwoOp[rm8, ...
Explain and rewrite the following Scala code:
package com.github.xubo245.gcdss.adam.postProcessing import com.github.xubo245.gcdss.utils.GcdssAlignmentFunSuite import org.bdgenomics.adam.rdd.ADAMContext._ /** * Created by xubo on 2017/4/5. */ class AdamMarkDuplicatesSuite extends GcdssAlignmentFunSuite { test("test artificial") { val fqFile = "file/ca...
Explain and rewrite the following Scala code:
package ilc package feature package maybe trait Reification extends base.Reification with Evaluation { override def reify(value: Value, valueType: Type): Term = (value, valueType) match { case (MaybeValue(None), MaybeType(contentType)) => Nope.tapply(contentType) case (MaybeValue(Some(conten...
Explain and rewrite the following Scala code:
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may...
Explain and rewrite the following Scala code:
package info.fotm.aether import com.typesafe.config.{Config, ConfigFactory} object AetherConfig { val baseConfig: Config = ConfigFactory.load() val configOverrideName = baseConfig.getString("config-override") println(s">>> Using config override: $configOverrideName") val config: Config = baseConfig.getConfi...
Explain and rewrite the following Scala code:
/* __ *\\ ** ________ ___ / / ___ __ ____ Scala.js tools ** ** / __/ __// _ | / / / _ | __ / // __/ (c) 2013-2014, LAMP/EPFL ** ** __\\ \\/ /__/ __ |/ /__/ __ |/_// /_\\ \\ http://scala-js.org/ ** ** /____/\\___/...
Explain and rewrite the following Scala code:
import sbt._ import Keys._ import play.twirl.sbt.Import._ object ApplicationBuild extends Build { val appName = "collins" val appVersion = "2.0-SNAPSHOT" val main = Project(appName, file(".")).enablePlugins(play.PlayScala).settings( version := appVersion, TwirlKeys.templateImport...
Explain and rewrite the following Scala code:
package info.pot420.jsoup import org.jsoup.Jsoup object Spoon extends App { val url = "http://en.wikipedia.org/wiki/Eugene,_Oregon" val doc = Jsoup.connect(url).get() val text = doc.getElementsByTag("p").text() println(text) println("Drinking soup with a SPOON!") }
Explain and rewrite the following Scala code:
package com.todesking.platebuilder import scala.language.higherKinds import scala.language.implicitConversions class DSL extends AnyRef with Distributions { import DSL.{ Namer, VarDef } private[this] def opt(s: String): Option[String] = if (s.isEmpty) None else Some(s) implicit def generatorSyntax(sc: StringCo...
Explain and rewrite the following Scala code:
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: /** @author John Miller * @version 1.3 * @date Fri Jul 29 14:33:21 EDT 2011 * @see LICENSE (MIT style license file). */ package apps.dynamics import scala.util.control.Breaks.{breakable, break} import scalation.dynamics.{...
Explain and rewrite the following Scala code:
/* * Copyright (C) 2016-2019 Lightbend Inc. <https://www.lightbend.com> */ package com.lightbend.lagom.internal.cluster import akka.remote.testkit.MultiNodeSpecCallbacks import org.scalatest.BeforeAndAfterAll import org.scalatest.Matchers import org.scalatest.WordSpecLike /** * Hooks up MultiNodeSpec with ScalaTe...
Explain and rewrite the following Scala code:
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may ...
Explain and rewrite the following Scala code:
package com.danielasfregola.twitter4s.entities final case class Symbol(text: String, indices: Seq[Int])
Explain and rewrite the following Scala code:
package com.criteo.cuttle.cron import java.time.Instant import cats._ import cats.implicits._ import com.criteo.cuttle.utils import com.criteo.cuttle.Database.JsonMeta import doobie._ import doobie.implicits._ import io.circe._ import io.circe.parser._ import io.circe.java8.time._ private[cron] object Database { ...
Explain and rewrite the following Scala code:
package org.apache.spark.sql.internal import org.apache.spark.sql.SanSession import org.apache.spark.sql.parser.SanSparkSqlParser import org.apache.spark.sql.catalyst.parser.ParserInterface import org.apache.spark.sql.execution.command.DDLStrategy /** * Created by sandeep on 4/8/17. */ class SanSessionState(sanSe...
Explain and rewrite the following Scala code:
// Copyright 2014,2015,2016,2017,2018,2019,2020 Commonwealth Bank of Australia // // 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 // // Unles...
Explain and rewrite the following Scala code:
package io.flow.delta.lib import io.flow.delta.v0.models.ItemSummaryUndefinedType import io.flow.play.util.Config import org.scalatestplus.play.PlaySpec class UrlsSpec extends PlaySpec with Factories { private[this] lazy val mockConfig = new Config { override def optionalString(name: String): Option[String] = ...
Explain and rewrite the following Scala code:
package is.hail.types.virtual import is.hail.annotations._ import is.hail.backend.BroadcastValue import is.hail.check._ import is.hail.types.physical.PLocus import is.hail.utils._ import is.hail.variant._ import scala.reflect.{ClassTag, classTag} object TLocus { def apply(rg: ReferenceGenome): TLocus = TLocus(rg.b...
Explain and rewrite the following Scala code:
package controllers import db.scalikejdbc.{TestDb, User} import org.specs2.mock.Mockito import play.api.mvc._ import play.api.test.CSRFTokenHelper._ import play.api.test._ class LoginControllerSpec extends PlaySpecification with Results with TestDb with Mockito { sequential val admin = new UsersController(mock[...
Explain and rewrite the following Scala code:
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may ...
Explain and rewrite the following Scala code:
package charles class Random extends scala.util.Random { /** Generated a random Double, based on [[scala.util.Random]], only the number wiil * be in the range (0,1] rather than [0,1). * * @return a random Double */ def nextPositiveDouble(): Double = { val nextDouble = this.nextDouble() if (...
Explain and rewrite the following Scala code:
package spark.deploy.master import akka.actor.{ActorRef, ActorSystem} import akka.dispatch.Await import akka.pattern.ask import akka.util.Timeout import akka.util.duration._ import cc.spray.Directives import cc.spray.directives._ import cc.spray.typeconversion.TwirlSupport._ import spark.deploy._ private[spark] class...
Explain and rewrite the following Scala code:
// ================================================================================================= // Copyright 2011 Twitter, Inc. // ------------------------------------------------------------------------------------------------- // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use ...
Explain and rewrite the following Scala code:
package ca.hyperreal.sscheme object TypePrimitives extends Primitives { val list = Seq( new Primitive( "eq?" )( {case SList(first: AnyRef, second: AnyRef) => (first eq second)} ), new Primitive( "integer?" )( { case SList(_: Int | _: BigInt) => true case SList( _ ) => false } ), new Primitive( "p...
Explain and rewrite the following Scala code:
package io.getquill.idiom import io.getquill.ast._ import io.getquill.util.Interleave import io.getquill.idiom.StatementInterpolator._ import scala.annotation.tailrec object ReifyStatement { def apply( liftingPlaceholder: Int => String, emptySetContainsToken: Token => Token, statement: ...
Explain and rewrite the following Scala code:
package scala.sprinter.printers import scala.tools.nsc.interactive.Global import scala.tools.nsc import java.io.{StringWriter, PrintWriter} object TypePrinters { def apply(compiler: Global) = { new TypePrinters { val global: Global = compiler } } def showType(compiler: Global, what: Global#Tree, ...
Explain and rewrite the following Scala code:
/* * The MIT License (MIT) * * Copyright (c) 2016 Algolia * http://www.algolia.com/ * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation...
Explain and rewrite the following Scala code:
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may ...
Explain and rewrite the following Scala code:
package split.petstore.api.yaml import play.api.mvc.{Action, Controller} import play.api.data.validation.Constraint import de.zalando.play.controllers._ import PlayBodyParsing._ import PlayValidations._ import de.zalando.play.controllers.ArrayWrapper import org.joda.time.DateTime // ----- constraints and wrapper valid...
Explain and rewrite the following Scala code:
package com.spann.utils import com.spann.models.Station case class StationStatus(station: Station, vehiclesApproaching: scala.collection.mutable.MutableList[Int], vehiclesPassed: scala.collection.mutable.MutableList[Int])
Explain and rewrite the following Scala code:
package au.com.agiledigital.toolform.plugin import au.com.agiledigital.toolform.app.ToolFormError import cats.data.NonEmptyList import com.monovore.decline._ /** * Extension point to add new generate commands to toolform. * Uses Java SPI - See [[java.util.ServiceLoader]] for details. * Implement the trait and r...
Explain and rewrite the following Scala code:
package de.tu_berlin.impro3.flink.spatio_temporal_dynamics.io import de.tu_berlin.impro3.flink.spatio_temporal_dynamics._ import model.Tweet import parsers.TabularParser import org.apache.flink.api.common.io.DelimitedInputFormat import annotation.tailrec class TabularInputFormat extends DelimitedInputFormat[Tweet] ...
Explain and rewrite the following Scala code:
/* * Copyright (C) 2009-2017 Lightbend Inc. <https://www.lightbend.com> */ package controllers import java.time._ import java.time.format.DateTimeFormatter import java.util.Date import org.specs2.mutable.Specification class AssetsDateParsingSpec extends Specification { "Assets.parseModifiedDate" should { d...
Explain and rewrite the following Scala code:
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may ...
Explain and rewrite the following Scala code:
package org.scalaide.core.internal.builder.zinc import scala.collection.mutable import scala.reflect.internal.Chars import org.eclipse.core.resources.IMarker import org.eclipse.core.runtime.Path import org.scalaide.core.IScalaProject import org.scalaide.core.internal.builder.BuildProblemMarker import org.scalaide.cor...
Explain and rewrite the following Scala code:
/* * * * Copyright (c) 2014-2016. National Institute of Advanced Industrial Science and Technology (AIST) * * All rights reserved. * */ package jp.go.aist.cspe import java.util.{Calendar, Date} /** * Created by yoriyuki on 2016/08/10. */ private[cspe] class ExampleDriver(example: ExampleTrait) { private[cs...
Explain and rewrite the following Scala code:
object Types { abstract sealed class Type case object AnyType extends Type case object NothingType extends Type case object UndefType extends Type case object BooleanType extends Type case object IntType extends Type case object LongType extends Type case object FloatType extends Type case ob...
Explain and rewrite the following Scala code:
package ro.redeul import ro.redeul.detector.fs.{File, FileSystem} object Groupers { import FileUtilities._ type Grouper = (Seq[File]) => Seq[Seq[File]] private def groupBy[T](files: Seq[File])(groupKey: (File) => T): Seq[Seq[File]] = (files.foldLeft(Map.empty[T, Seq[File]]) { case (m, f) => ...
Explain and rewrite the following Scala code:
package org.bitcoins.spvnode.serializers.messages.control import org.bitcoins.core.number.UInt64 import org.bitcoins.core.protocol.CompactSizeUInt import org.bitcoins.core.util.BitcoinSUtil import org.scalatest.{FlatSpec, MustMatchers} /** * Created by chris on 6/3/16. */ class RawAddrMessageSerializerTest extend...
Explain and rewrite the following Scala code:
package org.infinispan.spark.test import org.apache.spark.Partition import org.infinispan.client.hotrod.CacheTopologyInfo import org.infinispan.spark.config.ConnectorConfiguration import org.infinispan.spark.rdd.{InfinispanPartition, Location, Splitter} import scala.collection.JavaConversions._ /** * Creates a fi...
Explain and rewrite the following Scala code:
package de.uniulm.iai.comma.measurement.ast import com.buschmais.jqassistant.core.scanner.api.ScannerContext import de.uniulm.iai.comma.lib.ast.javasource.EnhancedCommonTree import de.uniulm.iai.comma.lib.ast.javasource.JavaParser._ import de.uniulm.iai.jqassistant.javasrc.plugin.model.{DependentDescriptor, Incomplete...
Explain and rewrite the following Scala code:
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may ...
Explain and rewrite the following Scala code:
package com.example.http4s package ssl import java.nio.file.Paths import cats.syntax.option._ import fs2._ import org.http4s.server._ import org.http4s.dsl._ import org.http4s.{HttpService, Uri} import org.http4s.Uri.{Authority, RegName} import org.http4s.headers.Host import org.http4s.server.SSLKeyStoreSupport.Store...
Explain and rewrite the following Scala code:
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may ...
Explain and rewrite the following Scala code:
/** * Copyright (c) 2011 ScalaStuff.org (joint venture of Alexander Dvorkovyy and Ruud Diterwich) * * 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....
Explain and rewrite the following Scala code:
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may ...
Explain and rewrite the following Scala code:
package org.jetbrains.plugins.scala package codeInsight package intention package types import com.intellij.openapi.editor.Editor import org.jetbrains.plugins.scala.ScalaBundle.message import org.jetbrains.plugins.scala.lang.psi.api.base.patterns._ import org.jetbrains.plugins.scala.lang.psi.api.base.types.ScTypeEleme...
Explain and rewrite the following Scala code:
package at.ac.tuwien.ifs.ir.model /** * Created by aldo on 24/11/14. */ class Document(val id: String) extends Comparable[Document] { override def equals(obj: scala.Any): Boolean = obj.asInstanceOf[Document].id == id override def hashCode = classOf[Document].hashCode + this.id.hashCode override def compareTo...
Explain and rewrite the following Scala code:
import leon.annotation._ import leon.collection._ import leon.lang._ import leon.proof._ object SparkCombinatorSpec extends App { @library def foldl[A, B] (zero: B, op: (B, A) => B, list: List[A]): B = list match { case Nil() => zero case Cons(h, t) => foldl(op(zero, h), op, t) ...
Explain and rewrite the following Scala code:
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may ...
Explain and rewrite the following Scala code:
/* * Copyright 2010 Michael Fortin <mike@brzy.org> * * 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 la...
Explain and rewrite the following Scala code:
/* * Copyright 2021 HM Revenue & Customs * * 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 a...
Explain and rewrite the following Scala code:
package com.chaseornot.web.utils import java.io.FileInputStream import java.util.Properties /** * Created by zhuhao on 16-10-18. */ object PropertiesUtils { lazy val properties = new Properties() def getProperties(relativePath: String, keys: List[String], defaultValue: String = null): List[String] = { ...
Explain and rewrite the following Scala code:
package pl.touk.nussknacker.ui.process.processingtypedata import com.typesafe import com.typesafe.config.{Config, ConfigFactory, ConfigValueFactory} import org.scalatest.FunSuite import org.scalatest.Matchers.{convertToAnyShouldWrapper, include} class ProcessingTypeDataConfigurationReaderSpec extends FunSuite { pr...
Explain and rewrite the following Scala code:
package io.github.shogowada.statictags import io.github.shogowada.statictags.AttributeValueType._ object AttributeValueType { trait AttributeValueType case object DEFAULT extends AttributeValueType case object COMMA_SEPARATED extends AttributeValueType case object SPACE_SEPARATED extends AttributeValueType ...
Explain and rewrite the following Scala code:
package org.nlogo.extensions.webview import javafx.application.Platform import netscape.javascript.JSObject import org.nlogo.agent.Observer import org.nlogo.api.SimpleJobOwner import org.nlogo.app.App import org.nlogo.nvm.Procedure trait JavascriptBridge { def evaluateCommand(commands: String, onFinish: JSObject, o...
Explain and rewrite the following Scala code:
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may ...
Explain and rewrite the following Scala code:
/* * Copyright (C) 2014 - 2017 Contributors as noted in the AUTHORS.md file * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option)...
Explain and rewrite the following Scala code:
package fibs import leon._ import lang._ import annotation._ import instrumentation._ import mem._ import higherorder._ import collection._ import invariant._ /** * A implementation of a cyclic, infinite stream of fibonacci numbers. * Implementation obtained from ESOP 2015 paper type-based allocation analysis for ...
Explain and rewrite the following Scala code:
package org.lau.tlv.ber import scodec.bits.ByteVector import org.lau.tlv._ case class BerTag(value: ByteVector) extends Tag { require(Option(value).map(!_.isEmpty) == Option(true), "value is null or empty") private val hasNextByte: Seq[Boolean] = value.toArray.zipWithIndex.map { case (x, index) => shouldHave...
Explain and rewrite the following Scala code:
/* * Copyright (c) 2014 Takayuki Usui * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publi...
Explain and rewrite the following Scala code:
package GDAX.util import scala.collection.mutable.ListBuffer object JsonConverter { def toJson(o: Any) : String = { var json = new ListBuffer[String]() o match { case m: Map[_,_] => { for ( (k,v) <- m ) { var key = escape(k.asInstanceOf[String]) v match { case a:...
Explain and rewrite the following Scala code:
/* * ****************************************************************************** * * Copyright (C) 2013 Christopher Harris (Itszuvalex) * * Itszuvalex@gmail.com * * * * This program is free software; you can redistribute it and/or * * modify it under the terms of the GNU General Public License * * as p...
Explain and rewrite the following Scala code:
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you...
Explain and rewrite the following Scala code:
package lila.swiss import reactivemongo.api.bson._ import scala.concurrent.duration._ import lila.db.dsl._ final private class SwissScoring( colls: SwissColls )(implicit system: akka.actor.ActorSystem, ec: scala.concurrent.ExecutionContext, mode: play.api.Mode) { import BsonHandlers._ def apply(id: Swiss.I...
Explain and rewrite the following Scala code:
/** * Copyright (c) 2013-2015 Patrick Nicolas - Scala for Machine Learning - All rights reserved * * The source code in this file is provided by the author for the sole purpose of illustrating the * concepts and algorithms presented in "Scala for Machine Learning". It should not be used to * build commercial ap...
Explain and rewrite the following Scala code:
package org.camunda.feel.interpreter.impl import org.scalatest.{FlatSpec, Matchers} import org.camunda.feel.syntaxtree._ /** * @author Philipp Ossler */ class InterpreterListExpressionTest extends FlatSpec with Matchers with FeelIntegrationTest { "A list" should "be checked with 'some'" in { e...
Explain and rewrite the following Scala code:
package HackerRank.Training.Regex import java.io.{ByteArrayInputStream, IOException, InputStream, PrintWriter} import java.util.InputMismatchException import scala.collection.generic.CanBuildFrom import scala.language.higherKinds import scala.reflect.ClassTag /** * Copyright (c) 2017 A. Roberto Fischer * * @au...
Explain and rewrite the following Scala code:
package is.hail.utils.richUtils import java.io.OutputStream class ByteTrackingOutputStream(base: OutputStream) extends OutputStream { var bytesWritten = 0L def write(c: Int) { bytesWritten += 1 base.write(c) } override def write(b: Array[Byte]) { base.write(b) bytesWritten += b.length } ...
Explain and rewrite the following Scala code:
package org.bitcoins.feeprovider import akka.actor.ActorSystem import akka.http.scaladsl.model.Uri import org.bitcoins.commons.jsonmodels.wallet.BitGoResult import org.bitcoins.commons.serializers.JsonSerializers._ import org.bitcoins.core.wallet.fee.SatoshisPerKiloByte import org.bitcoins.tor.Socks5ProxyParams import...
Explain and rewrite the following Scala code:
package pl.writeonly.son2.funs.glue import pl.writeonly.son2.apis.config.RStyle.{RAll, RStream} import pl.writeonly.son2.funs.streamers.{ StreamerPipeAll, StreamerPipeForeach, StreamerSourceAll, StreamerSourceForeach } import pl.writeonly.scalaops.specs.WhiteAssertSpec class StreamersAssertSpec extends WhiteA...
Explain and rewrite the following Scala code:
// Copyright 2016, Martin Pokorny <martin@truffulatree.org> // // This Source Code Form is subject to the terms of the Mozilla Public License, // v. 2.0. If a copy of the MPL was not distributed with this file, You can // obtain one at http://mozilla.org/MPL/2.0/. // package org.truffulatree.h2odb.sql import java.sql....
Explain and rewrite the following Scala code:
package spoiwo.natures.xlsx import org.apache.poi.xssf.usermodel.{XSSFSheet, XSSFWorkbook} import org.scalatest.flatspec.AnyFlatSpec import org.scalatest.matchers.should.Matchers import spoiwo.model.SheetLocking class Model2XlsxConversionsForSheetLockingSpec extends AnyFlatSpec with Matchers { private def apply(lo...
Explain and rewrite the following Scala code:
package com.informer.taxi import org.joda.time.DateTime import org.scalatest.{FlatSpec, Matchers} import scala.concurrent.duration._ class JourneyTest extends FlatSpec with Matchers { it should "compute the total of 9.75 for the default journey" in { val sample = Journey( new DateTime(2010, 10, 8, 17, ...
Explain and rewrite the following Scala code:
/* * Copyright (C) 2011 Mathias Doenitz * * 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...
Explain and rewrite the following Scala code:
package sri.universal.components import chandu0101.macros.tojs.JSMacro import sri.core.{React, ReactNode} import sri.universal.apis.LayoutEvent import sri.universal.ReactUniversal import scala.scalajs.js import scala.scalajs.js.Dynamic.{global => g} case class View(onResponderReject: js.UndefOr[js.Function] = js.un...
Explain and rewrite the following Scala code:
package com.arcusys.learn.liferay.services import java.util.Date import com.arcusys.learn.liferay.model.Activity import com.liferay.portal.kernel.dao.orm.RestrictionsFactoryUtil import com.liferay.portlet.social.service.SocialActivityLocalServiceUtil import com.liferay.portlet.social.model.SocialActivity import org.jo...
Explain and rewrite the following Scala code:
package com.peim.service import java.time.OffsetDateTime import java.util.concurrent.locks.ReentrantLock import com.peim.model.Transfer import com.peim.repository.TransfersRepository import scaldi.{Injectable, Injector} import scala.concurrent.duration._ import scala.concurrent.{Await, ExecutionContext} import scala...
Explain and rewrite the following Scala code:
package com.raquo.domtypes.generic.defs.styles.keywords import com.raquo.domtypes.generic.builders.StyleStringValueBuilder trait AutoStyle[T] extends StyleStringValueBuilder[T] { lazy val auto: T = buildStringValue("auto") }
Explain and rewrite the following Scala code:
/* * Copyright 2017-2018 47 Degrees, LLC. <http://www.47deg.com> * * 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 require...
Explain and rewrite the following Scala code:
package com.sksamuel.elastic4s.indexes import com.sksamuel.elastic4s.ElasticDsl._ import com.sksamuel.elastic4s.JsonSugar import com.sksamuel.elastic4s.analyzers._ import com.sksamuel.elastic4s.mappings.FieldType._ import com.sksamuel.elastic4s.mappings.{DynamicMapping, PrefixTree} import org.scalatest.mockito.Mockito...
Explain and rewrite the following Scala code:
package dsentric.schema import com.github.ghik.silencer.silent import scala.collection.mutable @silent class MsonSchema(tab: String, newLine: String) { def convertObjectDefinition(objectDefinition: ObjectDefinition): String = { val sb = new mutable.StringBuilder() objectStructure(sb, objectDefinition) ...
Explain and rewrite the following Scala code:
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may ...
Explain and rewrite the following Scala code:
package org.automanlang.core.question import org.automanlang.core.answer._ import org.automanlang.core.info.QuestionType abstract class RadioButtonVectorQuestion extends VectorQuestion { type A = Symbol type AA = Answers[A] type O = VectorOutcome[A] type QuestionOptionType <: QuestionOption protected var _...
Explain and rewrite the following Scala code:
package athena.connector import athena._ import akka.util.ByteString import athena.data.{PreparedStatementDef, Metadata} private object CommandConverters { import CassandraRequests._ import CassandraResponses._ import Requests._ import Responses._ //a bunch of stuff to convert from Athena - this is lame ...
Explain and rewrite the following Scala code:
package controllers import javax.inject._ import play.api.mvc._ /** * This controller creates an `Action` to handle HTTP requests to the * application's home page. */ @Singleton class Guide @Inject() extends Controller { /** * Create an Action to render an HTML page with the main guiding message. */...
Explain and rewrite the following Scala code:
/*********************************************************************** * Copyright (c) 2013-2017 Commonwealth Computer Research, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Apache License, Version 2.0 * which accompanies this distribution and...
Explain and rewrite the following Scala code:
/** * Copyright 2015, deepsense.io * * 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 ...
Explain and rewrite the following Scala code:
/* Copyright 2012 Twitter, Inc. 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 distr...
Explain and rewrite the following Scala code:
package com.lynbrookrobotics.potassium.config import argonaut.Argonaut._ import argonaut._ import com.lynbrookrobotics.potassium.units.{GenericDerivative, GenericIntegral} import squants.{Dimension, Quantity} import scala.language.experimental.macros import scala.reflect.macros.blackbox object SquantsPickling { im...
Explain and rewrite the following Scala code:
/*********************************************************************** * Copyright (c) 2013-2016 Commonwealth Computer Research, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Apache License, Version 2.0 * which accompanies this distribution and is ...
Explain and rewrite the following Scala code:
package org.jetbrains.plugins.scala package annotator import com.intellij.lang.annotation.AnnotationHolder import org.jetbrains.plugins.scala.extensions.{PsiMethodExt, ResolvesTo} import org.jetbrains.plugins.scala.lang.psi.ScalaPsiUtil import org.jetbrains.plugins.scala.lang.psi.api.base.ScStableCodeReferenceElement ...
Explain and rewrite the following Scala code:
/* ___ _ ___ _ _ *\\ ** / __| |/ (_) | | The SKilL Generator ** ** \\__ \\ ' <| | | |__ (c) 2013-16 University of Stuttgart ** ** |___/_|\\_\\_|_|____| see LICENSE ...
Explain and rewrite the following Scala code:
package com.countrygamer.attackdummy.common.entity import com.countrygamer.cgo.common.lib.util.Player import net.minecraft.entity.Entity import net.minecraft.entity.player.EntityPlayer import net.minecraft.util.DamageSource import net.minecraft.world.World /** * * * @author CountryGamer */ class EntityAttackDummy...
Explain and rewrite the following Scala code:
// Copyright (C) 2011-2012 the original author or authors. // See the LICENCE.txt file distributed with this work for additional // information regarding copyright ownership. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You ...
Explain and rewrite the following Scala code:
// Project: angulate2-examples // Module: 07 Router // Description: Data class for heroes // Copyright (c) 2016. Distributed under the MIT License (see included LICENSE file). package router.heroes import angulate2.Data @Data case class Hero(id: Int, name: String)