instruction
stringclasses
1 value
output
stringlengths
5
1M
Explain and rewrite the following Scala code:
import sbt._ import Keys._ import org.scalatra.sbt._ import org.scalatra.sbt.PluginKeys._ import com.mojolly.scalate.ScalatePlugin._ import ScalateKeys._ object Scalatrasbtg8Build extends Build { val Organization = "com.afronski" val Name = "ScalatraSbtG8" val Version = "1.0" val ScalaVersion = "2.11.4" val ...
Explain and rewrite the following Scala code:
/** * Licensed to the Minutemen Group under one or more contributor license * agreements. See the COPYRIGHT 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 complian...
Explain and rewrite the following Scala code:
package com.solidfire.examples import com.solidfire.client.ElementFactory import com.solidfire.element.api._ import com.solidfire.core.javautil.Optional.{empty, of} import com.solidfire.core.client.Attributes; class ReadmeScalaExample { // Create Connection to SF Cluster val sfe = ElementFactory.create( "mvip", ...
Explain and rewrite the following Scala code:
/* * Copyright 2016 Dennis Vriend * * 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 t...
Explain and rewrite the following Scala code:
// Copyright: 2010 - 2017 https://github.com/ensime/ensime-server/graphs // License: http://www.gnu.org/licenses/gpl-3.0.en.html /* * This file contains derivative works that require the following * header to be displayed: * * Copyright 2002-2011 EPFL. * All rights reserved. * * Permission to use, copy, modify, ...
Explain and rewrite the following Scala code:
package jp.co.septeni_original.sbt.dao.generator import org.seasar.util.lang.StringUtil import sbt.Keys._ import sbt._ import sbt.plugins.JvmPlugin /** * sbt-dao-generatorのプラグイン定義。 */ object SbtDaoGeneratorPlugin extends AutoPlugin { override def trigger = allRequirements override def requires: Plugins = Jv...
Explain and rewrite the following Scala code:
package com.pauldoo.euler.common object Summations { def sum(range: Range): BigInt = { // TODO: Replace with Range.sum(..) ? val actualLast = range.head + range.step * (range.length - 1); ((range.head + actualLast) * (range.length)) / 2; } // Sum of k^2 for k = 0 to n def sumOfSquares(n: BigInt): ...
Explain and rewrite the following Scala code:
object O { case class N() object P } object Outer { println("Outer") object Inner { println("Inner") def i { println("Inner.i") } } } object Test { def main(args: Array[String]) { Outer.Inner.i // we still don't initialize Outer here (but should we?) {println("About to reference...
Explain and rewrite the following Scala code:
package example object Main extends App { println("hello") }
Explain and rewrite the following Scala code:
package com.monsanto.arch.cloudformation.model.resource import com.monsanto.arch.cloudformation.model._ import spray.json._ import scala.annotation.implicitNotFound import scala.language.implicitConversions /** * Created by Ryan Richt on 2/28/15 */ case class `AWS::EC2::EIP` private ( name: St...
Explain and rewrite the following Scala code:
package com.twitter.finagle.builder import com.twitter.conversions.time._ import com.twitter.finagle._ import com.twitter.finagle.client.{DefaultPool, StackClient, StdStackClient, Transporter} import com.twitter.finagle.factory.{BindingFactory, TimeoutFactory} import com.twitter.finagle.filter.ExceptionSourceFilter im...
Explain and rewrite the following Scala code:
package org.kududb.spark.demo.gamer import java.util.{Random, Properties} import org.apache.kafka.clients.producer.{ProducerConfig, KafkaProducer, ProducerRecord} object KafkaProducerGenerator { val random = new Random() val averagePlayerPercentage = 40 val advancedPlayerPercentage = 80 val superStarPlayer...
Explain and rewrite the following Scala code:
import _root_.io.gatling.core.scenario.Simulation import ch.qos.logback.classic.{Level, LoggerContext} import io.gatling.core.Predef._ import io.gatling.http.Predef._ import org.slf4j.LoggerFactory import scala.concurrent.duration._ /** * Performance test for the Reaction entity. */ class ReactionGatlingTest extend...
Explain and rewrite the following Scala code:
/*********************************************************************** * Copyright (c) 2013-2020 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:
package com.stratio.ioft.util import java.util.Date import com.stratio.ioft.domain.{DroneIdType, TimestampMS} trait PresentationTools { def printDroneEvent[T](msg: String, event: (DroneIdType, (TimestampMS, T))): Unit = event match { case (did, (ts: TimestampMS, value)) => println(s"$did @ ${new Date(ts...
Explain and rewrite the following Scala code:
/* * Copyright 2010 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 t...
Explain and rewrite the following Scala code:
package pl.touk.nussknacker.openapi.http import sttp.client.{Response, ResponseError, SttpBackend} import sttp.model.StatusCode import scala.language.higherKinds object SttpUtils { def handleOptionalResponse[R[_], T](response: Response[Either[ResponseError[io.circe.Error], Option[T]]])(implicit backend: SttpBacken...
Explain and rewrite the following Scala code:
package com.datawizards.dqm.configuration.loader import java.sql.DriverManager import java.util.Properties import com.datawizards.dqm.configuration.location.HiveTableLocation import com.datawizards.dqm.configuration.{DataQualityMonitoringConfiguration, TableConfiguration} import com.datawizards.dqm.rules._ import com...
Explain and rewrite the following Scala code:
package it.agilelab.bigdata.spark.search.impl.queries import it.agilelab.bigdata.spark.search.RawQuery import it.agilelab.bigdata.spark.search.impl.LuceneConfig import org.apache.lucene.util.QueryBuilder /** * Builds standard queries using Lucene's QueryBuilder on the "text" field. */ class DefaultQueryConstructor(...
Explain and rewrite the following Scala code:
package lila.security import org.joda.time.DateTime case class FingerprintedUser(user: lila.user.User, hasFingerprint: Boolean) case class UserSession( _id: String, ip: String, ua: String, api: Option[Int], date: Option[DateTime]) { def id = _id def isMobile = api.isDefined } case class Lo...
Explain and rewrite the following Scala code:
/* * Copyright (c) 2014-2018 by The Monix Project Developers. * See the project homepage at: https://monix.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...
Explain and rewrite the following Scala code:
package com.normation.syweno.syncrepl package apacheds import org.junit.Assert._ import org.junit.{Test,AfterClass} import scala.actors.Actor class TestSyncreplConsumer { val providerConfig = ProviderConfiguration( "localhost", 389, "cn=manager, dc=example, dc=org", "secret" ) val config =...
Explain and rewrite the following Scala code:
package cwl /** * All of these classes decompose a "fully qualified" id into its constituent parts. They have unique types as * they are seen in different parts of a CWL document and they differ in content. * * The fully qualified names are created by the Schema salad preprocessing step. * * @see <a href=...
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:
package com.robin.study /** * Created by robinmac on 15-7-22. */ class FunctionCompose { def f(s: String) = "f(" + s + ")" def g(s: String) = "g(" + s + ")" def f2=f(_) def g2=g(_) // val fg= f _ compose g //fg2 val fg1=f _ compose g _ val fg2= f2 compose g2 } object FunctionCompose extends App{ va...
Explain and rewrite the following Scala code:
package org.scalatest.examples.funspec.noargtest import java.io.File import org.scalatest._ class ExampleSpec extends FunSpec { override def withFixture(test: NoArgTest) = { try super.withFixture(test) catch { case e: Exception => val currDir = new File(".") val fileNames = currDir.l...
Explain and rewrite the following Scala code:
package es.upm.oeg.epnoi.matching.metrics.aggregation /** * Created by cbadenes on 23/04/15. */ object Bernoulli { def apply (p: Array[Double], q: Array[Double]): Array[Double] ={ p.zip(q).map(x=>(x._1+x._2)/2) } }
Explain and rewrite the following Scala code:
/* Copyright (C) 2008-2016 University of Massachusetts Amherst. This file is part of "FACTORIE" (Factor graphs, Imperative, Extensible) http://factorie.cs.umass.edu, http://github.com/factorie Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with...
Explain and rewrite the following Scala code:
package io.iteratee.monix import cats.Eq import cats.laws.discipline.arbitrary.catsLawsCogenForThrowable import io.iteratee.monix.task._ import io.iteratee.testing.{ EnumerateeSuite, EnumeratorSuite, IterateeErrorSuite, ModuleSuite } import io.iteratee.testing.EqInstances.eqThrowable import monix.eval.Task import moni...
Explain and rewrite the following Scala code:
package com.komanov.serialization.converters import java.time.Instant import java.util.UUID import com.komanov.serialization.domain.SiteType import scala.pickling.Defaults._ import scala.pickling.{FastTypeTag, _} import scala.reflect.ClassTag package object pickling { implicit class RichBuilder(val builder: PBui...
Explain and rewrite the following Scala code:
package mesosphere.marathon package core.deployment.impl import java.util.concurrent.LinkedBlockingDeque import akka.Done import akka.actor.{ ActorRef, Props } import akka.event.EventStream import akka.stream.scaladsl.Source import akka.testkit.TestActor.{ AutoPilot, NoAutoPilot } import akka.testkit.{ ImplicitSender...
Explain and rewrite the following Scala code:
package org.apache.spark.sql.redis.stream import org.apache.spark.sql.redis._ import org.scalatest.{FunSuite, Matchers} /** * @author The Viet Nguyen */ class RedisSourceConfigSuite extends FunSuite with Matchers { val group: String = "group55" test("testFromMap") { val config = RedisSourceConfig.fromMa...
Explain and rewrite the following Scala code:
package com.wavesplatform.state.diffs.smart.predef import com.wavesplatform.account.Address import com.wavesplatform.db.WithDomain import com.wavesplatform.lang.directives.values.V5 import com.wavesplatform.lang.script.Script import com.wavesplatform.lang.v1.compiler.TestCompiler import com.wavesplatform.state.{Boolea...
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 com.monochromeroad.play.xwiki.rendering import macros.{XWikiMacroManager, RbMacro} import org.specs2.mutable._ import org.xwiki.rendering.syntax.Syntax /** * @author Masatoshi Hayashi */ class XWikiComponentManagerSpec extends Specification { val componentManager = new XWikiComponentManager(getClass.ge...
Explain and rewrite the following Scala code:
/* __ *\\ ** ________ ___ / / ___ Scala API ** ** / __/ __// _ | / / / _ | (c) 2005-2010, LAMP/EPFL ** ** __\\ \\/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\\___/_/...
Explain and rewrite the following Scala code:
/* *\ ** \ \ / _) \ \ / \ | ** ** \ \ / | __ \ _ \ __| \ \ / |\/ | ** ** \ \ / | | | __/ | \ \ / | | ** ** \_/ _| .__/ \___| _| \_/ _| _| ** ** _| ...
Explain and rewrite the following Scala code:
package services.auth import com.mohiva.play.silhouette.api.services.IdentityService import com.mohiva.play.silhouette.impl.providers.CommonSocialProfile import models.tenant.Crew import scala.concurrent.Future /** * Handles actions to users. */ trait UserService extends IdentityService[Crew] { /** * Save...
Explain and rewrite the following Scala code:
package com.socrata.datacoordinator.truth.loader import com.socrata.datacoordinator.id.DatasetId trait DatasetDropper { def dropDataset(datasetId: DatasetId): DatasetDropper.Result } object DatasetDropper { sealed abstract class Result case object Success extends Result sealed abstract class Failure extends ...
Explain and rewrite the following Scala code:
/* * Copyright (C) 2012 Pavel Fatin <http://pavelfatin.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * ...
Explain and rewrite the following Scala code:
case class Foo[+X[_]](will: X[Int]) { def foo[Y[_]](right: Foo[Y]) = Foo.doFoo(this, right) } class A[X] { def crash = true } class B[X] object Foo { def doFoo[X[_]](left: Foo[X], right: Foo[X]): Foo[X] = right def main(args: Array[String]): Unit = { val fooA = Foo(new A[Int]) val fooB = Foo(new B[Int]...
Explain and rewrite the following Scala code:
package debop4s.data.orm.config.servers import java.util.Properties import debop4s.data.orm.jpa.spring.AbstractJpaH2Configuration import debop4s.data.orm.mapping.ScalaEmployee import org.hibernate.cache.rediscala.SingletonRedisRegionFactory import org.hibernate.cfg.AvailableSettings._ import org.springframework.conte...
Explain and rewrite the following Scala code:
package org.bitcoins.core.p2p import org.bitcoins.core.number.UInt32 import org.bitcoins.core.serializers.p2p._ import org.bitcoins.crypto.{Factory, NetworkElement} import scodec.bits._ /** Encapsulated network IP address currently uses the following structure * @see https://bitcoin.org/en/developer-reference#addr ...
Explain and rewrite the following Scala code:
package dotty.tools package dotc package reporting import core.Contexts.Context import collection.mutable import Reporter._ /** * This class implements a Reporter that throws all errors and sends warnings and other * info to the underlying reporter. */ class ThrowingReporter(reportInfo: Reporter) extends Reporter ...
Explain and rewrite the following Scala code:
/* * Copyright 2001-2014 Artima, 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 agre...
Explain and rewrite the following Scala code:
package org.bitcoins.core.protocol.script import org.bitcoins.testkit.core.gen.ScriptGenerators import org.scalacheck.{Prop, Properties} /** * Created by tom on 8/23/16. */ class CSVScriptPubKeySpec extends Properties("CSVScriptPubKeySpec") { property("Serialization Symmetry") = Prop.forAll(ScriptGenerators...
Explain and rewrite the following Scala code:
/* * Copyright (C) FuseSource, Inc. * http://fusesource.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 required by ...
Explain and rewrite the following Scala code:
/* * Copyright (C) 2018 Lightbend Inc. <https://www.lightbend.com> * Copyright (C) 2017-2018 Alexis Seigneurin. * * 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 o...
Explain and rewrite the following Scala code:
import sbt._ import Keys._ import play.Project._ object ApplicationBuild extends Build { val appName = "diztorted" val appVersion = "1.0-SNAPSHOT" val appDependencies = Seq( javaCore, javaJdbc, javaEbean ) val main = play.Project(appName, appVersion, appDependencies).settings...
Explain and rewrite the following Scala code:
package com.twitter.server.util import com.twitter.conversions.time._ import com.twitter.finagle.stats.{StatsRegistry, StatEntry} import com.twitter.util.Time import org.junit.runner.RunWith import org.scalatest.FunSuite import org.scalatest.junit.JUnitRunner private[server] object MetricSourceTest { class Ctx { ...
Explain and rewrite the following Scala code:
package play.modules.reactivemongo class ReactiveMongoPlayJsonException(message: String, cause: Throwable = null) extends RuntimeException(message, cause)
Explain and rewrite the following Scala code:
package pw.ian.playground.shapeless import cats.implicits._ import shapeless._ trait StatsAndPopGenerator[M, S, P] { def generate(in: M): (S, P) } object StatsAndPopGenerator { case class Moments() case class Stat() case class Population() def computeStatsAndPopulation(in: Map[Int, Moments]): (Map[Int, S...
Explain and rewrite the following Scala code:
/* * Copyright 2012 Eike Kettner * * 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...
Explain and rewrite the following Scala code:
// pattern matcher crashes here trying to synthesize an uneeded outer test. // no-symbol does not have an owner // at scala.reflect.internal.SymbolTable.abort(SymbolTable.scala:49) // at scala.tools.nsc.Global.abort(Global.scala:253) // at scala.reflect.internal.Symbols$NoSymbol.owner(Symbols.scala:3248) // at scal...
Explain and rewrite the following Scala code:
package com.twitter.finagle.postgres.messages import com.twitter.finagle.postgres.values.{Strings, Convert} import org.jboss.netty.buffer.ChannelBuffer /** * Messages sent to Postgres from the client. */ trait FrontendMessage extends Message { def asPacket(): Packet } case class StartupMessage(user: String, dat...
Explain and rewrite the following Scala code:
/* * La Trobe University - Distributed Deep Learning System * Copyright 2014 Matthias Langer (t3l@threelights.de) * * 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.apa...
Explain and rewrite the following Scala code:
package ee.cone.c4actor import okio.ByteString sealed trait NamedCompressing { def name: String } trait Compressor extends NamedCompressing { def compress(data: ByteString): ByteString } trait DeCompressor extends NamedCompressing { def deCompress(data: ByteString): ByteString } trait RawCompressor extends N...
Explain and rewrite the following Scala code:
/* __ *\\ ** ________ ___ / / ___ Scala API ** ** / __/ __// _ | / / / _ | (c) 2003-2010, LAMP/EPFL ** ** __\\ \\/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\\___/_/...
Explain and rewrite the following Scala code:
package drt.server.feeds.common import akka.actor.ActorSystem import akka.http.scaladsl.Http import akka.http.scaladsl.model.{HttpRequest, HttpResponse} import scala.concurrent.Future class HttpClient { def sendRequest(httpRequest: HttpRequest)(implicit system: ActorSystem): Future[HttpResponse] = Http().singleReq...
Explain and rewrite the following Scala code:
package org.jetbrains.plugins.scala.lang.resolve.processor import com.intellij.psi._ import org.jetbrains.plugins.scala.caches.CachesUtil import org.jetbrains.plugins.scala.lang.psi.implicits.ScImplicitlyConvertible import org.jetbrains.plugins.scala.lang.psi.types.ScType import org.jetbrains.plugins.scala.lang.resolv...
Explain and rewrite the following Scala code:
package org.jetbrains.plugins.dotty.lang.parser.parsing.expressions /** * @author adkozlov */ object PostfixExpr extends org.jetbrains.plugins.scala.lang.parser.parsing.expressions.PostfixExpr { override protected val infixExpr = InfixExpr }
Explain and rewrite the following Scala code:
package net.arya.intern /** * Created by arya on 7/26/14. */ object syntax { implicit class InterningSyntax[A:Manifest](a: A) { def intern = Intern(a) def internDeep(implicit d: InternDeep[A]) = d.internDeep(a) } }
Explain and rewrite the following Scala code:
import javax.inject._ import play.api._ import play.api.http.HttpFilters import play.api.mvc._ import play.api.http.DefaultHttpFilters import play.filters.csrf.CSRFFilter import javax.inject.Inject /** * This class configures filters that run on every request. This * class is queried by Play to get a list of filter...
Explain and rewrite the following Scala code:
/* * Copyright (C) Lightbend Inc. <https://www.lightbend.com> */ package com.lightbend.lagom.scaladsl.testkit import akka.testkit.TestProbe import com.lightbend.lagom.internal.scaladsl.persistence.PersistentEntityActor import com.lightbend.lagom.scaladsl.persistence.TestEntity import com.lightbend.lagom.scaladsl.pe...
Explain and rewrite the following Scala code:
package scalatddpackt package object rational { /* * This version of Rational is based on Martin Odersky's Scala by Example. * source: http://www.scala-lang.org/docu/files/ScalaByExample.pdf * * We include a number of additions/improvements based on Harrington and Thiruvathukal's C# Book, * which inc...
Explain and rewrite the following Scala code:
package models case class TerminalBrands(id: Integer, name: String)
Explain and rewrite the following Scala code:
// Copyright: 2010 - 2017 https://github.com/ensime/ensime-server/graphs // License: http://www.gnu.org/licenses/gpl-3.0.en.html package org.ensime.server import io.netty.channel.{ Channel, ChannelHandlerContext, SimpleChannelInboundHandler } import io.netty.handler.codec.http.websocketx.WebSocketServerProtocolH...
Explain and rewrite the following Scala code:
package cn.edu.sjtu.omnilab.cobac import java.util.regex.{Matcher, Pattern} import org.apache.spark.storage.StorageLevel import org.apache.spark.{SparkContext, SparkConf} import org.apache.spark.SparkContext._ import org.omg.CORBA.PERSIST_STORE object ExtractUrlFromHttp { final val httpProtoPattern = Pattern.comp...
Explain and rewrite the following Scala code:
package fpinscala.datastructures sealed trait Tree[+A] case class Leaf[A](value: A) extends Tree[A] case class Branch[A](left: Tree[A], right: Tree[A]) extends Tree[A] object Tree { def size[A](t: Tree[A]): Int = t match { case Leaf(_) => 1 case Branch(left, right) => 1 + size(left) + size(right) } de...
Explain and rewrite the following Scala code:
package spire.benchmark import scala.{specialized => spec} import scala.annotation.tailrec import scala.util.Random import Random._ import spire.algebra._ import spire.std.any._ import spire.math.{Numeric => SpireN} import scala.math.{Numeric => ScalaN} import com.google.caliper.Runner import com.google.caliper.S...
Explain and rewrite the following Scala code:
package controllers import com.google.inject.{Inject, Singleton} import config.AppConfig import handlers.{StdHttpExceptionHandler, UserListRequestHandler} import org.apache.http.config.SocketConfig import org.apache.http.impl.bootstrap.ServerBootstrap import org.apache.http.ssl.SSLContexts @Singleton class ServerCont...
Explain and rewrite the following Scala code:
package code import org.junit.runner.RunWith import org.scalatest._ import org.scalatest.junit.JUnitRunner /** * Test class */ @RunWith(classOf[JUnitRunner]) class LinkTrackerSpec extends FlatSpec with Matchers { val res1 = LinkTracker.parseDoc(Sample1.originalDoc) "The LinkTracker" should "count the total num...
Explain and rewrite the following Scala code:
class C { @Annot(optionType=classOf[String]) val k = 0 } object Test { def main(args: Array[String]): Unit = { val xs = ( classOf[C].getDeclaredFields.toList . sortBy(f => f.getName) . map(f => f.getAnnotations.toList) . filterNot (_.isEmpty) // there are extra fields under -Xcheck...
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:
object Test { def test(xs: Any) = xs match { // test error message TooManyArgsPatternError case List(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19, x20, x21, x22, x23) => 7 } }
Explain and rewrite the following Scala code:
/*********************************************************************** * Copyright (c) 2013-2020 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:
/* * 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.softwaremill.codebrag.common case class NotEscapedJsonWrapper[T](notEscapedData: T)
Explain and rewrite the following Scala code:
// This is a verbatim copy of the old type generator. It is used to generate reference models for testing. package mesosphere.raml import treehugger.forest._ import definitions._ import org.raml.v2.api.RamlModelResult import org.raml.v2.api.model.v10.api.Library import org.raml.v2.api.model.v10.datamodel._ import tree...
Explain and rewrite the following Scala code:
import org.specs2._ import org.specs2.matcher._ import com.twitter.finagle.builder.{ ServerBuilder, ClientBuilder } import com.twitter.finagle.thrift._ import ca.stevenskelton.thrift.testservice._ import org.apache.thrift.protocol.TBinaryProtocol import com.twitter.util.Future class PostConcernFilterSpec extends mutab...
Explain and rewrite the following Scala code:
package org.odfi.indesign.core.module.stats import org.odfi.ooxoo.model.ModelBuilder import org.odfi.ooxoo.model.producer import org.odfi.ooxoo.model.producers import org.odfi.ooxoo.model.out.markdown.MDProducer import org.odfi.ooxoo.model.out.scala.ScalaProducer import org.odfi.ooxoo.core.buffers.structural.io.sax.ST...
Explain and rewrite the following Scala code:
import sbt._ import Keys._ import play.Project._ import com.typesafe.config._ import com.typesafe.sbteclipse.core.EclipsePlugin.EclipseKeys object ApplicationBuild extends Build { // override def settings = super.settings ++ Seq( // EclipseKeys.skipParents in ThisBuild := false // ) val conf ...
Explain and rewrite the following Scala code:
/* Copyright 2009-2016 EPFL, Lausanne */ object Test { def looping_isOdd(n: BigInt): Boolean = { looping_isEven(n-1) } ensuring { res => (n % 2 == 1) == res } def looping_isEven(n: BigInt): Boolean = { looping_isOdd(n-1) } ensuring { res => (n % 2 == 0) == res } }
Explain and rewrite the following Scala code:
package org.http4s package util.io import java.io.{Writer => JWriter, _} import org.http4s.util.byteVector._ import org.scalacheck._, Arbitrary._ import scalaz._ import scalaz.concurrent._ import scalaz.stream.text._ import scalaz.syntax.foldable._ import scodec.bits.ByteVector class IoSpec extends Http4sSpec { imp...
Explain and rewrite the following Scala code:
/** * Copyright: Copyright (C) 2016, ATS Advanced Telematic Systems GmbH * License: MPL-2.0 */ package org.genivi.sota.core.data import java.time.Instant import java.util.UUID import org.genivi.sota.data.{PackageId, Uuid} import org.genivi.sota.rest.GenericResponseEncoder /** * Domain object for the update opera...
Explain and rewrite the following Scala code:
package com.github.mdr.mash.ns.collections import com.github.mdr.mash.functions._ import com.github.mdr.mash.ns.core.BooleanClass import com.github.mdr.mash.runtime.MashBoolean object NonEmptyFunction extends MashFunction("collections.nonEmpty") { import IsEmptyFunction.Params._ val params = IsEmptyFunction.par...
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 Paul Bernard * * 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 t...
Explain and rewrite the following Scala code:
package util.tool object IO { def using[A <: { def close(): Unit }, B](param: A)(f: A => B): B = try { f(param) } finally { param.close() } def usingFile[B](name: String)(f: io.BufferedSource => B) = using(io.Source.fromFile(name))(file => f(file)) def readFileToString(name: Str...
Explain and rewrite the following Scala code:
package slamdata.engine import scalaz._ import scalaz.std.string._ package object fp { sealed trait Polymorphic[F[_], TC[_]] { def apply[A: TC]: TC[F[A]] } trait ShowF[F[_]] { def show[A](fa: F[A]): Cord } trait EqualF[F[_]] { def equal[A](fa1: F[A], fa2: F[A])(implicit eq: Equal[A]): Boolean ...
Explain and rewrite the following Scala code:
package tutorial.webapp import scala.scalajs.js.JSApp import org.scalajs.dom import dom.document import scala.scalajs.js.annotation.JSExport import org.scalajs.jquery.jQuery object TutorialApp extends JSApp { def appendPar(targetNode: dom.Node, text: String): Unit = { jQuery("body").append(s"<p>$text</p>") }...
Explain and rewrite the following Scala code:
/* * Copyright 2016 Mediative * * 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...
Explain and rewrite the following Scala code:
package org.jetbrains.plugins.cbt.action import com.intellij.ide.fileTemplates.actions.{AttributesDefaults, CreateFromTemplateActionBase} import com.intellij.ide.fileTemplates.{FileTemplate, FileTemplateManager} import com.intellij.openapi.actionSystem.{AnActionEvent, CommonDataKeys, DataContext} import com.intellij.o...
Explain and rewrite the following Scala code:
package index.suggest import index.{ IndexFields, NGramAnalyzer } import java.io.StringReader import java.nio.file.Path import org.apache.lucene.analysis.Analyzer import org.apache.lucene.facet.taxonomy.SearcherTaxonomyManager import org.apache.lucene.index.{ DirectoryReader, IndexWriterConfig } import org.apache.luce...
Explain and rewrite the following Scala code:
package scredis.protocol.requests import scala.language.higherKinds import scredis.protocol._ import scredis.serialization.{ Reader, Writer } import scala.collection.compat._ object HashRequests { import scredis.serialization.Implicits.stringReader import scredis.serialization.Implicits.doubleReader obje...
Explain and rewrite the following Scala code:
/** * AMH11.java * * AMH11: Java implementation of the matrix exponential method * described by Al-Mohy and Higham (2011) * * Copyright (c) 2016 Arman Bilge * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Soft...
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 com.jakway.gnucash.test.objects object BooksLiteral { val donQuixoteId = "b1615" val warAndPeaceId = "b1867" val ids: Set[String] = Set(donQuixoteId, warAndPeaceId) val numBooks = 2 //verbatim from https://github.com/scala/scala-xml/wiki/Getting-started val books = <books> <book id="b1615">D...
Explain and rewrite the following Scala code:
package org.jetbrains.plugins.scala.annotator.gutter /** * Pavel.Fatin, 21.01.2010 */ class GroupMultilineControlTest extends LineMarkerTestBase { protected override def getBasePath = super.getBasePath + "/group/multiline/control/" def testDo(): Unit = doTest() def testFor(): Unit = doTest() def testIf():...
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 ...