instruction
stringclasses
1 value
output
stringlengths
5
1M
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:
class A(s: String) { def foo(x: A) = x } class isString(s: String) class Test { def x[A](a: Any): A = ??? def test { val a = Array[A]() a.update(0, x[A]({new isString(true)})) // !!! allowed // boils down to class X { def m(p: Any) {} } implicit class XOps(x: X) { def m(p:...
Explain and rewrite the following Scala code:
package com.twitter.finatra.http.routing import com.twitter.finagle.Service import com.twitter.finagle.http.Request import com.twitter.finagle.http.Response import com.twitter.util.Await import com.twitter.util.jackson.ScalaObjectMapper import com.twitter.util.logging.Logger import javax.inject.Inject private object ...
Explain and rewrite the following Scala code:
package spark.storage import com.codahale.metrics.{Gauge,MetricRegistry} import spark.metrics.source.Source private[spark] class BlockManagerSource(val blockManager: BlockManager) extends Source { val metricRegistry = new MetricRegistry() val sourceName = "BlockManager" metricRegistry.register(MetricRegistry...
Explain and rewrite the following Scala code:
package observatory import org.junit.runner.RunWith import org.scalatest.FunSuite import org.scalatest.junit.JUnitRunner import org.scalatest.prop.Checkers trait Interaction2Test extends FunSuite with Checkers { }
Explain and rewrite the following Scala code:
package fpinscala.datastructures import fpinscala.datastructures.List._ import org.scalatest.FlatSpec import org.scalatest.matchers.ShouldMatchers class TailTest extends FlatSpec with ShouldMatchers { "Tail" should "return empty List when applied to empty list" in { tail(List()) should equal(List()) } it s...
Explain and rewrite the following Scala code:
package presentation._6 import com.twitter.finagle.Http import com.twitter.finagle.http.Method.Get import com.twitter.util.Future import io.fintrospect.RouteSpec import io.fintrospect.parameters.Path object RemoteBooks { val titlePart = Path.string("titlePart") val route = RouteSpec().at(Get) / "search" / titlePa...
Explain and rewrite the following Scala code:
/** * Created by Romain Reuillon on 28/11/16. * * 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) any later version. * * This ...
Explain and rewrite the following Scala code:
/** * Copyright (C) 2016 Hurence (support@hurence.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 a...
Explain and rewrite the following Scala code:
package lila.puzzle import org.goochjs.glicko2._ import org.joda.time.DateTime import reactivemongo.bson.{ BSONDocument, BSONInteger } import lila.db.Types.Coll import lila.rating.{ Glicko, Perf } import lila.user.{ User, UserRepo } private[puzzle] final class Finisher( api: PuzzleApi, puzzleColl: Coll) { ...
Explain and rewrite the following Scala code:
/* * Copyright 2020 Spotify AB * * 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 i...
Explain and rewrite the following Scala code:
/* * Copyright (C) 2012-2014 Typesafe Inc. <http://www.typesafe.com> */ package com.qifun.statelessFuture package test package run package ifelse0 import org.junit.Test import com.qifun.statelessFuture.test.internal.AsyncId class WhileSpec { @Test def whiling1() { import AsyncId._ val result = async ...
Explain and rewrite the following Scala code:
package io.coral.actors.transform import akka.actor.{ActorLogging, Props} import com.datastax.driver.core.{ResultSet, Session, Cluster} import io.coral.actors.{SimpleEmitTrigger, CoralActor} import scala.collection.mutable.Queue import scala.concurrent.duration._ import scala.language.postfixOps import akka.actor.Prop...
Explain and rewrite the following Scala code:
package com.sksamuel.elastic4s.searches.aggs import com.sksamuel.elastic4s.script.ScriptDefinition import com.sksamuel.exts.OptionImplicits._ case class PercentilesAggregationDefinition(name: String, field: Option[String] = None, ...
Explain and rewrite the following Scala code:
/* * Copyright © 2015 Cask Data, 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 com.sksamuel.scapegoat.inspections /** @author Stephen Samuel */ class HashcodeInspection { }
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 2016 Carlo Micieli * * 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:
/* * comma, A Code Measurement and Analysis Tool * Copyright (C) 2010-2015 Steffen Kram * * 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 op...
Explain and rewrite the following Scala code:
def f(a: Int = 1, b: Int = 2) {} /* */ f(1, 2)
Explain and rewrite the following Scala code:
package edu.berkeley.eecs.btrdb.sparkconn.quasar.types class StatRecord( val Time: Long, //This is at the start of the record val Count: Long, val Min: Double, val Mean: Double, val Max: Double ) { override def toString: String = " Time [" + this.Time.toString + "] Count (" + this.Count.toString + ") Min ...
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:
/* * 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 sbtrelease import sbt._ import java.io.File trait Vcs { val commandName: String val baseDir: File def cmd(args: Any*): ProcessBuilder def status: ProcessBuilder def currentHash: String def add(files: String*): ProcessBuilder def commit(message: String): ProcessBuilder def existsTag(name: Str...
Explain and rewrite the following Scala code:
/* * Copyright 2009-2010 WorldWide Conferencing, LLC * * 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 applica...
Explain and rewrite the following Scala code:
package com.chrisrebert.lmvtfy.server import scala.util.{Try,Success,Failure} import spray.routing.{Directive1, MalformedHeaderRejection, MalformedRequestContentRejection, ValidationRejection} import spray.routing.directives.{BasicDirectives, HeaderDirectives, RouteDirectives, MarshallingDirectives} import com.chrisre...
Explain and rewrite the following Scala code:
package org.http4s package server package middleware import scalaz._, Scalaz._ import scalaz.concurrent.Task import scalaz.stream.Process._ import org.http4s.Uri.uri import org.http4s.dsl._ class DefaultHeadSpec extends Http4sSpec { val service = DefaultHead(HttpService { case req @ GET -> Root / "hello" => ...
Explain and rewrite the following Scala code:
/* * SPDX-License-Identifier: Apache-2.0 * * Copyright 2015-2021 Andre White. * * 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 * * https://www.apache.org/licenses/LICENSE...
Explain and rewrite the following Scala code:
import akka.actor.ActorSelection._ import akka.actor.PoisonPill import play.api.Application import play.api.GlobalSettings import play.api.Logger import play.api.Play.current import play.api.libs.concurrent.Execution.Implicits._ import play.api.mvc.WithFilters import play.filters.gzip.GzipFilter import play.libs.Akka i...
Explain and rewrite the following Scala code:
package com.omearac.shared import akka.stream.scaladsl.SourceQueueWithComplete /** * EventMessages are those which are emitted throughout the application and KafkaMessages are those which * are converted to/from JSON to be published/consumed to/from Kafka. * The EventMessages are converted to ExampleAppEvents w...
Explain and rewrite the following Scala code:
/** * Copyright 2012 Jorge Aliss (jaliss at gmail dot com) - twitter: @jaliss * * 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 * * U...
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 chrome.wallpaper.bindings import scala.scalajs.js import scala.scalajs.js.annotation.JSName class WallpaperDetails extends js.Object { val binary: js.UndefOr[js.Any] = js.native val url: js.UndefOr[String] = js.native val layout: WallpaperLayout = js.native val filename: String = js.native val thumb...
Explain and rewrite the following Scala code:
/* * 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 * distribute...
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.twitter.finagle.stats import com.twitter.finagle.stats.MetricBuilder.CounterType import com.twitter.finagle.stats.MetricBuilder.CounterishGaugeType import com.twitter.finagle.stats.MetricBuilder.GaugeType import org.scalatest.funsuite.AnyFunSuite class MetricBuilderTest extends AnyFunSuite { test("meta...
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.http4s package headers import org.http4s.parser.HttpHeaderParser import org.http4s.util.Writer object `Accept-Ranges` extends HeaderKey.Internal[`Accept-Ranges`] with HeaderKey.Singleton { def apply(first: RangeUnit, more: RangeUnit*): `Accept-Ranges` = apply((first +: more).toList) def bytes: `Accept...
Explain and rewrite the following Scala code:
package com.airtonjal.poc.pchr import com.fasterxml.jackson.databind.node.{ArrayNode, TextNode, IntNode} import com.fasterxml.jackson.databind.{ObjectMapper, JsonNode} import com.airtonjal.poc.json.JsonUtils._ import PCHRSchema._ import org.slf4j.LoggerFactory import scala.collection.JavaConversions._ /** * Creates...
Explain and rewrite the following Scala code:
/** * sbt-osgi-manager - OSGi development bridge based on Bnd and Tycho. * * Copyright (c) 2013-2016 Alexey Aksenov ezh@ezh.msk.ru * * 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 * *...
Explain and rewrite the following Scala code:
package at.linuxhacker.procmetrics.tests.lib import org.junit.runner.RunWith import org.junit.Test import org.scalatest.junit.JUnitRunner import org.scalatest.FlatSpec import at.linuxhacker.procmetrics.global._ import at.linuxhacker.procmetrics.values._ import at.linuxhacker.procmetrics.lib._ import at.linuxhacker.pro...
Explain and rewrite the following Scala code:
/* * Copyright (C) Lightbend Inc. <https://www.lightbend.com> */ package com.lightbend.lagom.scaladsl.persistence /** * Commands to [[PersistentEntity]] are wrapped in this envelope * when sent via [[PersistentEntityRef]] (i.e. Cluster Sharding). * * Users should normally not use this class, but it is public ca...
Explain and rewrite the following Scala code:
/* * Copyright (C) 2012 Romain Reuillon * * 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) any later version. * * This progra...
Explain and rewrite the following Scala code:
/* * Copyright 2017 helloscala.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 applicable law or agreed ...
Explain and rewrite the following Scala code:
package mesosphere.marathon package core import mesosphere.marathon.SchedulerActions import mesosphere.marathon.core.auth.AuthModule import mesosphere.marathon.core.base.ActorsModule import mesosphere.marathon.core.deployment.DeploymentModule import mesosphere.marathon.core.election.ElectionModule import mesosphere.ma...
Explain and rewrite the following Scala code:
package com.twitter.finagle.http.codec import com.twitter.finagle.Service import com.twitter.finagle.http._ import com.twitter.finagle.stats.CategorizingExceptionStatsHandler import com.twitter.finagle.stats.StatsReceiver import com.twitter.logging.Logger import com.twitter.util.Future import com.twitter.util.Promise ...
Explain and rewrite the following Scala code:
package io.udash.web.commons.styles.components /** * Created by malchik on 2016-07-01. */ import io.udash.css.CssBase import io.udash.web.commons.styles.attributes.Attributes import io.udash.web.commons.styles.utils.{MediaQueries, StyleConstants, CommonStyleUtils} import scala.language.postfixOps object MobileMe...
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 2009 Mark Tye * * 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, * so...
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 mesosphere.marathon.integration import mesosphere.marathon.Protos import mesosphere.marathon.Protos.Constraint.Operator import mesosphere.marathon.integration.setup._ import mesosphere.marathon.state.AppDefinition import org.scalatest.{ GivenWhenThen, Matchers } import scala.concurrent.duration._ class TaskQu...
Explain and rewrite the following Scala code:
package org.shlrm.scloud import java.nio.file.{Paths, Path} import org.jclouds.blobstore.BlobStore import org.jclouds.blobstore.domain.{Blob, StorageType} class Put(localPath: Path, cloudPath: String, recursive: Boolean = false) (implicit val blobStore: BlobStore) extends BlobUtils { ...
Explain and rewrite the following Scala code:
package com.eevolution.context.dictionary.infrastructure.service import java.util.UUID import akka.NotUsed import com.eevolution.context.dictionary.domain._ import com.eevolution.context.dictionary.domain.model.RoleIncluded import com.eevolution.utils.PaginatedSequence import com.lightbend.lagom.scaladsl.api.{Service...
Explain and rewrite the following Scala code:
package org.openmole.web.cache import org.openmole.core.workflow.mole.MoleExecution import java.io.File import akka.actor.ActorSystem import org.openmole.web.db.SlickDB import org.openmole.web.db.tables.{ MoleStats, MoleData } import slick.driver.H2Driver.simple._ import slick.jdbc.meta.MTable import javax.sql.rowset...
Explain and rewrite the following Scala code:
package gapt.examples.nd import gapt.examples.Script import gapt.expr._ import gapt.expr.formula.Eq import gapt.expr.formula.fol.FOLAtom import gapt.expr.formula.fol.FOLConst import gapt.expr.formula.fol.FOLFunction import gapt.expr.formula.fol.FOLFunctionConst import gapt.expr.formula.fol.FOLVar import gapt.proofs._ i...
Explain and rewrite the following Scala code:
package org.bitcoins.util import org.slf4j.LoggerFactory /** * Created by chris on 3/11/16. */ trait BitcoinSLogger { def logger = LoggerFactory.getLogger(this.getClass().toString) }
Explain and rewrite the following Scala code:
package c02 case class Item(name: String) trait Number1 case class Number1S(tail: Number1, head: Item) extends Number1 case object Number1T extends Number1 trait Number2 { def receive0(number3: Number3, number4: Number4): Number1 } case class Number2S(tail: () => Number2, head: Item) exte...
Explain and rewrite the following Scala code:
/* * Copyright 2016 Nicolas Rinaudo * * 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 fpinscala.laziness import Stream._ trait Stream[+A] { def foldRight[B](z: => B)(f: (A, => B) => B): B = // The arrow `=>` in front of the argument type `B` means that the function `f` takes its second argument by name and may choose not to evaluate it. this match { case Cons(h,t) => f(h(), t().fol...
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 pirate import org.scalacheck.{Arbitrary, Gen}, Arbitrary.arbitrary import Pirate._ import pirate.internal._ import scalaz._, Scalaz._ sealed trait TestCommand case class TestWrapper(cmd: TestCommand) case object TestA extends TestCommand case object TestB extends TestCommand class InterpreterSpec extends spe...
Explain and rewrite the following Scala code:
package org.perftester.process import java.io.File import java.nio.file.Paths object Compiler extends App { val lib = "C:\\\\Users\\\\dev\\\\scalacBuildCache\\\\d1b745c2e97cc89e5d26b8f5a5696a2611c01af7\\\\lib\\\\" val classPath = s"${lib}jline.jar;${lib}scala-compiler-doc.jar;${lib}scala-compiler.jar;${lib}sc...
Explain and rewrite the following Scala code:
package com.rocketfuel.sdbc.sqlserver import org.scalatest.FunSuite class HierarchyIdSpec extends FunSuite { test("empty path from string") { assertResult(HierarchyId.empty)(HierarchyId.fromString("/")) } test("empty path to string") { assertResult("/")(HierarchyId().toString) } test("one node fr...
Explain and rewrite the following Scala code:
package io.eels import io.eels.util.PathIterator import org.apache.hadoop.fs.Path import org.scalatest.{Matchers, WordSpec} class PathIteratorTest extends WordSpec with Matchers { "PathIterator" should { "return all non-null parent paths" in { val path = new Path("/some/path/for/fun") PathIterator(p...
Explain and rewrite the following Scala code:
/* * Copyright (C) Pigumer Group. 2017. All rights reserved. */ package jp.pigumer.application import java.io.{ByteArrayInputStream, File, InputStream} import javax.sound.sampled._ import akka.NotUsed import akka.stream.scaladsl.Flow import org.slf4j.LoggerFactory import scala.util.Try class AudioPlay(mixerInfo: ...
Explain and rewrite the following Scala code:
/* The Computer Language Shootout http://shootout.alioth.debian.org/ contributed by Isaac Gouy (Scala novice) */ object sieve { def main(args: Array[String]) = { var n = toPositiveInt(args); val start = 2; val stop = 8192; val isPrime = new Array[Boolean](stop+1); var count: Int...
Explain and rewrite the following Scala code:
package de.fosd.typechef.parser.c import junit.framework._; import junit.framework.Assert._ import de.fosd.typechef.featureexpr._ import org.junit.Test import org.kiama.rewriting.Rewriter._ import java.util.Collections class CGramFilesTest extends TestCase with TestHelper { val p = new CParser() //XXX duplicate...
Explain and rewrite the following Scala code:
package jp.co.guru.AnalyzeWeb import javax.servlet.http.HttpServlet import java.io.IOException import javax.servlet.ServletException import javax.servlet.http.HttpServletResponse import javax.servlet.http.HttpServletRequest import java.io.IOException import javax.servlet.ServletException class ScalaServlet extends Ht...
Explain and rewrite the following Scala code:
/* Copyright (c) 2011 Toshiyuki Takahashi. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the ...
Explain and rewrite the following Scala code:
package ui import scala.util.parsing.json._ import scala.io._ import scala.util.parsing.input.StreamReader import java.io.InputStreamReader import scala.util.parsing.input.PagedSeqReader import scala.collection.immutable.PagedSeq import java.io.BufferedReader import javax.swing._ import event._ import util.Random impo...
Explain and rewrite the following Scala code:
package org.scalatra import java.net.HttpCookie import org.scalatra.test.scalatest.ScalatraFunSuite class CookieSupportServlet extends ScalatraServlet { get("/getcookie") { cookies.get("anothercookie") foreach { cookie => response.setHeader("X-Another-Cookie", cookie) } cookies.get("somecookie")...
Explain and rewrite the following Scala code:
import sbt.Def import sbt._ import sbt.Keys._ object Dependencies { type D = Seq[ModuleID] val kindProjector: D = Seq( compilerPlugin( "org.typelevel" %% "kind-projector" % "0.11.0" cross CrossVersion.full ) ) val splain: D = Seq( compilerPlugin( "io.tryp" % "splain" % "0.5.7" cross CrossVersion.patch ) ...
Explain and rewrite the following Scala code:
//make linear regression import org.apache.spark.mllib.regression.LabeledPoint import org.apache.spark.mllib.regression.LinearRegressionModel import org.apache.spark.mllib.regression.LinearRegressionWithSGD import org.apache.spark.mllib.classification.{LogisticRegressionWithLBFGS, LogisticRegressionModel} import org.ap...
Explain and rewrite the following Scala code:
package fp import fp.MonadCatch.MonadCatchLaws import fp.MonadSpecification.monadLaws import org.scalacheck.Prop.forAll import org.scalacheck.{Arbitrary, Prop, Properties} object MonadCatchSpecification extends Properties("MonadCatch") { def attempt[F[_] : MonadCatch, A](implicit eq: Equal[F[Either[Throwable, A]]]...
Explain and rewrite the following Scala code:
package com.twitter.scalding import com.twitter.algebird.Semigroup object ExecutionUtil { /** * Generate a list of executions from a date range * * @param duration Duration to split daterange * @param fn Function to run a execution given a date range * @return Sequence of Executions per Day */ 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 com.eevolution.context.dictionary.infrastructure.service.impl import java.util.UUID import com.eevolution.context.dictionary.infrastructure.repository.SequenceNoRepository import com.eevolution.context.dictionary.infrastructure.service.SequenceNoService import com.lightbend.lagom.scaladsl.api.ServiceCall impo...
Explain and rewrite the following Scala code:
package com.ubirch.avatar.core.device import com.typesafe.scalalogging.StrictLogging import com.ubirch.avatar.config.Config import com.ubirch.avatar.model.rest.device.{AvatarState, DeviceStateUpdate} import com.ubirch.avatar.util.model.DeviceUtil import com.ubirch.server.util.ServerKeys import com.ubirch.util.elastics...
Explain and rewrite the following Scala code:
package models /** * Created by mattia on 12/04/16. */ case class BulkMailAuth( partnerId: String, apiKey: String, campaignId: String )
Explain and rewrite the following Scala code:
package com.taig.tmpltr.markup import com.taig.tmpltr._ import play.api.mvc.Content trait a extends Tag.Body[a, Content] { val tag = "a" }
Explain and rewrite the following Scala code:
package ul.crc; /** Basic CRC class */ abstract class CRC { var curCRC: Int = initCRC var finalized: Boolean = false def bits: Int def bitsMask: Int def poly: Int def initCRC: Int def reset: CRC = { curCRC = initCRC finalized = false this } def set( newCRC...
Explain and rewrite the following Scala code:
package org.apache.spark.mllib.topicModeling import java.util.Random import breeze.linalg.{DenseMatrix => BDM, DenseVector => BDV, sum, max} import breeze.numerics.{abs, digamma, exp, log, lgamma} import breeze.stats.distributions.{Gamma, RandBasis} import org.apache.spark.mllib.linalg._ import org.apache.spark.rdd.R...
Explain and rewrite the following Scala code:
package taczombie.test.model import org.specs2.mutable.Specification import taczombie.model.GameFactory import taczombie.model.GameState import taczombie.model.Game import taczombie.model.Human class GameFactorySpec extends Specification { "GameFactory" should { "produce unique ids" in { var idSet ...
Explain and rewrite the following Scala code:
package com.monsanto.arch.kamon.spray.can.server import akka.actor.Cancellable import kamon.com.monsanto.arch.kamon.spray.can.counterKey import kamon.metric.instrument.Histogram.DynamicRange import kamon.metric.instrument._ import kamon.metric.{EntitySnapshot, MetricKey} import org.scalatest.{Matchers, WordSpec} impor...
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 provingground.learning import provingground.HoTT._ import provingground.{FiniteDistribution => _, _} import shapeless._ import induction._ import provingground.learning.GeneratorNode.Map import GeneratorNode._ import scala.util._ import TermGeneratorNodes._ import provingground.learning.Sort.All import provin...
Explain and rewrite the following Scala code:
object desugar { // variables var x: Int = 2 var y = x * x val list = List(1, 2, 3) { var z: Int = y } def foo0(first: Int, second: Int = 2, third: Int = 3) = first + second def foo1(first: Int, second: Int = 2)(third: Int = 3) = first + second def foo2(first: Int)(second: Int = 2)(third: Int = 3) = ...
Explain and rewrite the following Scala code:
/* * The MIT License (MIT) * * Copyright (c) 2016 Ian McIntosh * * 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,...
Explain and rewrite the following Scala code:
/* * Copyright (c) 2014-2021 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:
import java.nio.file.Path import io.gatling.commons.util.PathHelper._ object IDEPathHelper { val gatlingConfUrl: Path = getClass.getClassLoader.getResource("gatling.conf").toURI val projectRootDir = gatlingConfUrl.ancestor(3) val mavenSourcesDirectory = projectRootDir / "src" / "test" / "scala" val ...
Explain and rewrite the following Scala code:
/* * This file is part of Kiama. * * Copyright (C) 2011-2015 Anthony M Sloane, Macquarie University. * * Kiama is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the * Free Software Foundation, either version 3 of the License, or ...
Explain and rewrite the following Scala code:
package org.codersunit.tn.input import twitter4j._ import scala.collection.mutable.ArrayBuilder import collection.JavaConversions._ import scalax.file.Path import scalax.io.StandardOpenOption.WriteAppend import scalax.io._ import org.apache.commons.lang3.StringEscapeUtils.escapeJava /** Input that provides strings by...
Explain and rewrite the following Scala code:
/* * Copyright 2017 LinkedIn Corp. Licensed under the BSD 2-Clause License (the "License").
 See License in the project root for license information. */ package com.linkedin.kafka.clients.utils.tests import javax.security.auth.login.Configuration import kafka.utils.{ZkUtils, Logging, CoreUtils} import kafka.zk.ZkFo...
Explain and rewrite the following Scala code:
package fpinscala.laziness import Stream._ trait Stream[+A] { // The natural recursive solution def toListRecursive: List[A] = this match { case Cons(h,t) => h() :: t().toListRecursive case _ => List() } /* The above solution will stack overflow for large streams, since it's not tail-recursive....
Explain and rewrite the following Scala code:
package scalashop import common._ import org.scalameter._ object HorizontalBoxBlurRunner { val standardConfig = config( Key.exec.minWarmupRuns -> 5, Key.exec.maxWarmupRuns -> 10, Key.exec.benchRuns -> 10, Key.verbose -> true ) withWarmer (new Warmer.Default) def main(args: Array[String]): Unit...
Explain and rewrite the following Scala code:
/* * Copyright 2001-2015 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.embulk.input import org.slf4j.{Logger, LoggerFactory} package object dynamodb { val logger: Logger = LoggerFactory.getLogger(classOf[DynamodbInputPlugin]) }
Explain and rewrite the following Scala code:
/* Copyright 2014 Juha Heljoranta * * 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:
/** * 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:
/** * This file is part of the TA Buddy project. * Copyright (c) 2014 Alexey Aksenov ezh@ezh.msk.ru * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Affero General Global License version 3 * as published by the Free Software Foundation with the addition of t...