instruction stringclasses 1
value | output stringlengths 5 1M |
|---|---|
Explain and rewrite the following Scala code: | /**
* Copyright (C) 2010-2011 LShift Ltd.
*
* 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... |
Explain and rewrite the following Scala code: | /*
* Copyright 2014 Commonwealth Computer Research, 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 applicabl... |
Explain and rewrite the following Scala code: | /*
* Copyright (C) 2014 - 2019 Dennis Vriend <https://github.com/dnvriend>
* Copyright (C) 2019 - 2021 Lightbend Inc. <https://www.lightbend.com>
*/
package akka.persistence.jdbc.journal.dao.legacy
import akka.persistence.jdbc.TablesTestSpec
import slick.jdbc.JdbcProfile
class JournalTablesTest extends TablesTest... |
Explain and rewrite the following Scala code: | package worker
import scala.concurrent.duration._
import akka.actor.Actor
import akka.pattern._
import akka.util.Timeout
import akka.contrib.pattern.ClusterSingletonProxy
object Frontend {
case object Ok
case object NotOk
}
class Frontend extends Actor {
import Frontend._
import context.dispatcher
val mast... |
Explain and rewrite the following Scala code: | package artisanal.pickle.maker
import models._
import parser._
import org.specs2._
import mutable._
import specification._
import scala.reflect.internal.pickling.ByteCodecs
import scala.tools.scalap.scalax.rules.scalasig._
import com.novus.salat.annotations.util._
import scala.reflect.ScalaSignature
class ListOp... |
Explain and rewrite the following Scala code: | /*
* Copyright (C) 2005, The OpenURP Software.
*
* This program 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
* (at your option) any later version.
*
* This... |
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 not u... |
Explain and rewrite the following Scala code: | package org.jetbrains.plugins.scala.lang.psi.uast.expressions
import com.intellij.psi.PsiElement
import org.jetbrains.annotations.Nullable
import org.jetbrains.plugins.scala.lang.psi.api.expr.ScReturn
import org.jetbrains.plugins.scala.lang.psi.uast.baseAdapters.{ScUAnnotated, ScUElement, ScUExpression}
import org.jet... |
Explain and rewrite the following Scala code: | package com.twitter.finagle.client
import com.twitter.finagle.Addr.Metadata
import com.twitter.finagle.client.AddrMetadataExtraction.AddrMetadata
import com.twitter.finagle.{Addr, ServiceFactory, Stack, Stackable}
import com.twitter.util.Duration
import java.util.concurrent.atomic.AtomicReference
/**
* Latency compe... |
Explain and rewrite the following Scala code: | /**
* Copyright 2014 Dropbox, 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... |
Explain and rewrite the following Scala code: | //############################################################################
// Test Scala interaction with Java nested classes and static members.
//############################################################################
import nestpkg._;
object Test extends App {
val x = nest_1.best.rest.test
Console.pri... |
Explain and rewrite the following Scala code: | package com.idyria.osi.ooxoo.core.buffers.datatypes
import com.idyria.osi.ooxoo.core.buffers.structural.AbstractDataBuffer
import javax.json.{Json, JsonObject}
import java.io.StringReader
import java.net.URI
class JSONBuffer extends AbstractDataBuffer[JsonObject]{
// Constructors
//-------------------
def t... |
Explain and rewrite the following Scala code: | /*
* Copyright 2011-2018 GatlingCorp (http://gatling.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 applic... |
Explain and rewrite the following Scala code: | /*
* 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 viper.silicon.supporters
import org.slf4s.{LoggerFactory, Logging}
import viper.silver.ast
import vip... |
Explain and rewrite the following Scala code: | package is.hail.utils.prettyPrint
import java.io.{ByteArrayInputStream, InputStream}
class ArrayOfByteArrayInputStream(bytes: Array[Array[Byte]]) extends InputStream {
val byteInputStreams = bytes.map(new ByteArrayInputStream(_))
var currentInputStreamIdx = 0
override def read(): Int = {
var foundByte = f... |
Explain and rewrite the following Scala code: | package kami.commons
import com.typesafe.scalalogging.Logger
import org.slf4j.LoggerFactory
trait Logging {
protected lazy val logger = Logger(LoggerFactory.getLogger(getClass.getName))
}
|
Explain and rewrite the following Scala code: | package v1.post.command
import akka.actor.Props
import akka.util.Timeout
import pl.why.common.PersistentEntity.GetState
import pl.why.common._
import v1.post.AddPostInput
import v1.post.command.PostEntity.Command._
import scala.concurrent.duration._
object PostManager {
val Name = "post-manager"
case class Fin... |
Explain and rewrite the following Scala code: | /**
* Copyright (C) 2012 LShift Ltd.
*
* 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: | /*
Copyright 2016 Marco Draeger
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, soft... |
Explain and rewrite the following Scala code: | /* Title: Pure/Concurrent/mailbox.scala
Module: PIDE
Author: Makarius
Message exchange via mailbox, with multiple senders (non-blocking,
unbounded buffering) and single receiver (bulk messages).
*/
package isabelle
object Mailbox
{
def apply[A]: Mailbox[A] = new Mailbox[A]()
}
class Mailbo... |
Explain and rewrite the following Scala code: | package org.sisioh.aws4s.dynamodb.document
import com.amazonaws.services.dynamodbv2.document.{ Item, UpdateItemOutcome }
import com.amazonaws.services.dynamodbv2.model.UpdateItemResult
import org.sisioh.aws4s.PimpedType
object UpdateItemOutcomeFactory {
def apply(result: UpdateItemResult): UpdateItemOutcome =
... |
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: | /*
* 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.github.mrmechko.strips.json
/**
* Created by mechko on 6/22/15.
*/
import com.github.mrmechko.strips.model._
import com.github.mrmechko.strips.modify._
import com.github.mrmechko.swordnet.structures.SPos
import play.api.libs.json._
import play.api.libs.functional.syntax._
object Implicits {
implicit... |
Explain and rewrite the following Scala code: | package spire
package algebra
/**
* A Torsor[V, R] requires an AbGroup[R] and provides Action[V, R],
* plus a `diff` operator, `<->` in additive notation, such that:
*
* 1. `(g <-> g) === scalar.id` for all `g` in `G`.
*
* 2. `(g <-> h) +> h === g` for all `g`, `h` in `G`.
*
* 3. `(g <-> h) +> i === (i <-> h) ... |
Explain and rewrite the following Scala code: | package lila.tournament
import chess.StartingPosition
import chess.variant.Variant
import org.joda.time.DateTime
case class Schedule(
freq: Schedule.Freq,
speed: Schedule.Speed,
variant: Variant,
position: StartingPosition,
at: DateTime) {
def name = freq match {
case m@Schedule.Freq.Experi... |
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 net.surguy.less
import org.specs2.mutable.Specification
import io.Source
import org.specs2.matcher.ParserMatchers
import LessParser._
class LessParserTest extends Specification with ParserMatchers {
val parsers = LessParser
private def read(name: String) = Source.fromInputStream( this.getClass.getResourc... |
Explain and rewrite the following Scala code: | package pubsub
import constants.PubSub._
import java.util.UUID
import score.UserScore
import utils.Alias
case class AliasData(key: String, alias: String, data: Map[String, Any])
class AliasSubscriber extends Subscriber(TOPIC_ALIAS){
def process(data: Any) = data match {
case data: AliasData => Alias.save(data... |
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 scala {
object a {
object b {
trait c {}
def foo(x: c): c = bar(x)
}
def bar(x: b.c): b.c = x
}
}
|
Explain and rewrite the following Scala code: | package scala.meta.tests.semanticdb
import scala.util.Properties
object ScalaVersion {
val version = Properties.versionNumberString
// both the compiler and stdlib are different between Scala versions.
// For the sake of simplicity, we only run the expect test against the
// output of 2.12. It's possible to ... |
Explain and rewrite the following Scala code: | package org.jetbrains.plugins.scala
package lang
package resolve
package imports
import com.intellij.psi.PsiPolyVariantReference
import org.jetbrains.plugins.scala.lang.resolve.{ScalaResolveResult, ScalaResolveTestCase}
import org.jetbrains.plugins.scala.util.TestUtils
/**
* @author jzaugg
*/
class ImplicitPriority... |
Explain and rewrite the following Scala code: | package org.jetbrains.plugins.scala.testingSupport.specs2
import org.jetbrains.plugins.scala.lang.structureView.elements.impl.TestStructureViewElement._
/**
* @author Roman.Shein
* @since 20.04.2015.
*/
abstract class Specs2FileStructureViewTest extends Specs2TestCase {
private def prepareAndRunTestInner(status... |
Explain and rewrite the following Scala code: | package epam.idobrovolskiy.wikipedia.trending.time.extractor.stack
import java.io.Serializable
import java.time.{LocalDate, Month}
import epam.idobrovolskiy.wikipedia.trending.document.WikiCitation
import epam.idobrovolskiy.wikipedia.trending.time._
import scala.util.matching.Regex
/**
* Created by Igor_Dobrovols... |
Explain and rewrite the following Scala code: | package adm.transport
import adm.{Client, LwConfig, Server}
import adm.interfaces.RegisterInterface
import adm.model.{LwInstance, LwNode, LwObject, LwResource}
import adm.transport.message._
import scala.concurrent.Future
import scala.util.Try
trait TransportModule {
this: Server with RegisterInterface =>
priva... |
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 (c) 2017-2018 IBM
* Copyright (c) 2013-2018 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 ac... |
Explain and rewrite the following Scala code: | /*
* Copyright 2001-2013 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 blended.streams.dispatcher.internal.builder
import akka.NotUsed
import akka.stream.scaladsl.Flow
import akka.stream.{FlowShape, Graph}
import blended.container.context.api.ContainerIdentifierService
import blended.streams.FlowProcessor
import blended.streams.dispatcher.internal.{ResourceTypeConfig, ResourceTyp... |
Explain and rewrite the following Scala code: | package scaffvis.client.store.model
import diode.data.{Empty, Pot}
/**
* Represents (almost all) client application state
*
* @param molecules currently loaded dataset
*/
case class Model(
scaffolds: Scaffolds = Scaffolds(),
molecules: Pot[Molecules] = Empty,
... |
Explain and rewrite the following Scala code: | package com.box.castle.core.mock
import com.box.castle.committer.api.{BatchCommittedSuccessfully, CommitResult, Committer}
import kafka.message.Message
class MockCommitter extends Committer {
def isMockCommitter = true
override def close(): Unit = { }
override def commit(messageBatch: IndexedSeq[Message], met... |
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: | /*
* Copyright (c) 2014 Alvaro Agea.
*
* 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 tutorial
import org.scalatest.FlatSpec
import org.scalatest.Matchers
class ScalableLanguageSuite extends FlatSpec with Matchers {
val twentyThree = 23
"By default fields" should "be private" in {
val instance = new FieldsArePrivate(twentyThree, "my name")
assertCompiles("instance.toString")
... |
Explain and rewrite the following Scala code: | package clusterconsole.client
import clusterconsole.client.modules.{ ClusterMap, Dashboard, MainMenu }
import clusterconsole.client.services.Logger._
import clusterconsole.client.services._
import clusterconsole.client.style.GlobalStyles
import japgolly.scalajs.react.React
import japgolly.scalajs.react.extra.router2._... |
Explain and rewrite the following Scala code: | package eventstore
package akka
@SerialVersionUID(1L)
case object LiveProcessingStarted {
/**
* Java API
*/
def getInstance = this
} |
Explain and rewrite the following Scala code: | import sbt._
object Dependencies {
lazy val minlog = "com.esotericsoftware" % "minlog" % "1.3.0"
lazy val asm = Seq(
"org.ow2.asm" % "asm" % "7.0",
"org.ow2.asm" % "asm-commons" % "7.0"
)
// for testing
lazy val scalactic = "org.scalactic" %% "scalactic" % "3.0.4" % Test
lazy val scalaTest = "org.scalatest"... |
Explain and rewrite the following Scala code: | /**
* Copyright (c) 2014 Rafael Brandão <rafa.bra@gmail.com>
*
* This 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 (at
* your option) any later version.
*
... |
Explain and rewrite the following Scala code: | package controllers
import org.qbproject.api.schema.{QBJson, QBType}
import play.api.libs.json._
/**
* Created by Edgar on 26.05.2014.
*/
object QBView {
// TODO: or reference via val?
case class QBViewPath(domainPath: String)
trait QBViewElement
case class QBViewControl(name: String, path: QBViewPath) e... |
Explain and rewrite the following Scala code: | object FunctionUtilities {
/* FPIS - Exercice 2.3
* Currying converts a function f of two arguments into a function of one argument that partially applies f.
* Here again there’s only one implementation that compiles. Write this implementation.
* def curry[A,B,C](f: (A, B) => C): A => (B => C)
* */
def... |
Explain and rewrite the following Scala code: | package com.datawizards.splot.examples.charts.line
import com.datawizards.splot.api.implicits._
object LineChartMultipleSeries extends App {
val xs = (1 to 100) map (x => x/10.0)
val sinx = xs.map(x => ("sin", x, Math.sin(x)))
val cosx = xs.map(x => ("cos", x, Math.cos(x)))
val sqrtx = xs.map(x => ("sqrt", x... |
Explain and rewrite the following Scala code: | /*
* Copyright © 2014 TU Berlin (emma@dima.tu-berlin.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.apache.org/licenses/LICENSE-2.0
*
* Unless required by app... |
Explain and rewrite the following Scala code: | package truerss.services
import truerss.db.DbLayer
import truerss.dto.{FeedDto, Page, SearchRequest}
import truerss.services.FeedsService.toPage
import zio.Task
class SearchService(private val dbLayer: DbLayer) {
def search(request: SearchRequest): Task[Page[FeedDto]] = {
dbLayer.feedDao
.search(
... |
Explain and rewrite the following Scala code: | import org.specs2.matcher.Matcher
import org.specs2.mutable._
import spray.http.Uri
import com.chrisrebert.lmvtfy.live_examples._
class LiveExamplesExtractorSpec extends Specification {
def assertNoLiveExamplesIn(text: String) = {
LiveExamplesExtractor.liveExamplesFromWithin(text) must beEmpty
}
def assertHa... |
Explain and rewrite the following Scala code: | package com.twitter.util.registry
import org.junit.runner.RunWith
import org.scalatest.FunSuite
import org.scalatest.junit.JUnitRunner
import scala.util.control.NoStackTrace
@RunWith(classOf[JUnitRunner])
class FormatterTest extends FunSuite {
test("asMap generates reasonable Maps") {
val registry = new SimpleR... |
Explain and rewrite the following Scala code: | package scalafiddle.compiler.cache
import scala.tools.nsc
object CompilerCache extends LRUCache[nsc.Global]("Compiler") {}
|
Explain and rewrite the following Scala code: | /**
* Copyright (C) 2015-2016 Miguel Osorio. All rights reserved.
*/
package controllers
import java.util.UUID
import javax.inject.Inject
import com.mohiva.play.silhouette.api.{Silhouette, Environment}
import com.mohiva.play.silhouette.impl.authenticators.JWTAuthenticator
import com.mohiva.play.silhouette.impl.pr... |
Explain and rewrite the following Scala code: | package com.nekopiano.scala.processing.sandbox
import com.nekopiano.scala.processing.{ScalaPApp, ScalaPAppCompanion, ThreeDimensionalPApp}
import peasy.PeasyCam
/**
* Created on 07/08/2016.
*/
class LineFieldApp extends ThreeDimensionalPApp {
override def settings: Unit = {
size(1024, 768, P3D)
pixelDe... |
Explain and rewrite the following Scala code: | package dedep.bonobo._match.evaluator
import dedep.bonobo._match.Match
import dedep.bonobo._match.result.{Draw, WinA, WinB}
import dedep.bonobo.team.Team
import org.scalatest.FunSuite
class NormalDistributionBasedMatchEvaluatorTest extends FunSuite {
test("test balance point calculation - A 2x bigger than B") {
... |
Explain and rewrite the following Scala code: | package org.jetbrains.plugins.scala.testingSupport.scalatest.scala2_11.scalatest2_1_7
import org.jetbrains.plugins.scala.testingSupport.scalatest.ScalaTestTestCase
/**
* @author Roman.Shein
* @since 22.01.2015
*/
abstract class Scalatest2_11_2_1_7_Base extends ScalaTestTestCase {
/**
* Intended for loading li... |
Explain and rewrite the following Scala code: | /*
* Copyright 2016 Coral realtime streaming analytics (http://coral-streaming.github.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... |
Explain and rewrite the following Scala code: | /* Copyright 2015 Bernhard Frauendienst
*
* 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 agr... |
Explain and rewrite the following Scala code: | import scalatags.Text.all._
object NanoboardAssets {
def index = {
"<!DOCTYPE html>" + html(
head(
base(href := "/"),
meta(name := "viewport", content := "width=device-width, initial-scale=1.0"),
link(rel := "shortcut icon", href := "favicon.ico", `type` := "image/x-icon")
),
... |
Explain and rewrite the following Scala code: | /*
* Copyright 2022 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: | import java.io.{BufferedWriter, FileOutputStream, OutputStreamWriter}
import scala.collection.JavaConverters._
import org.apache.spark.rdd.DoubleRDDFunctions
import org.apache.spark.rdd.RDD
import org.apache.spark.sql.functions._
import org.apache.spark.sql.Row
import org.apache.spark.sql.catalyst.ScalaReflection
impor... |
Explain and rewrite the following Scala code: | /*
* Copyright 2015-2020 Noel Welsh
*
* 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 2011-2018 GatlingCorp (http://gatling.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 applic... |
Explain and rewrite the following Scala code: | /*
* Copyright 2016 The BigDL Authors.
*
* 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 agr... |
Explain and rewrite the following Scala code: | package com.softwaremill.streams
import akka.actor.ActorSystem
import akka.stream.ActorMaterializer
import akka.stream.scaladsl.Source
import scala.concurrent.Await
import scala.concurrent.duration._
import scalaz.concurrent.{Strategy, Task}
import scalaz.stream.{Process, async, time}
object AkkaSlowConsumer extends... |
Explain and rewrite the following Scala code: | /*
* Copyright 2017 Datamountaineer.
*
* 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: | /**
* Copyright 2011-2017 GatlingCorp (http://gatling.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 appli... |
Explain and rewrite the following Scala code: | /***********************************************************************
* Copyright (c) 2013-2015 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 uk.gov.digital.ho.proving.financialstatus.domain
import java.util.Optional
import org.springframework.beans.factory.annotation.{Autowired, Value}
import org.springframework.stereotype.Service
import uk.gov.digital.ho.proving.financialstatus.api.configuration.VariantTypeException
@Service
class VariantTypeChe... |
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.szadowsz.gospel.core.data.numeric
import com.szadowsz.gospel.core.data.{Term, Struct, Var}
import org.scalatest.{Matchers, FlatSpec}
class DoubleTestCase extends FlatSpec with Matchers {
"A Double" should " be atomic" in {
Number(0.0).isAtomic should be(true)
}
"A Double" should " not be an atom"... |
Explain and rewrite the following Scala code: | package unfiltered.oauth
import unfiltered.response._
import unfiltered.request.{HttpRequest => Req}
/** Respresents the `User` in an oauth interaction */
trait UserLike {
val id: String
}
/** Provides a means of host-specific hooks into providing user interfaces */
trait HostResponses {
/** @return a function 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: | package io.muvr.exercise
/**
* The rest between exercies
*
* @param minimumDuration minimum number of seconds to rest
* @param maximumDuration maximum number of seconds to rest
* @param minimumHeartRate the heart rate
*/
case class Rest(minimumDuration: Double, maximumDuration: Double, minimumHeartRate: Int) ext... |
Explain and rewrite the following Scala code: | package de.sciss.lucre.swing
import de.sciss.lucre.expr.Context
import scala.swing.Component
object WidgetCouplingTest extends InMemoryAppLike {
protected def mkView(): Component = {
import graph._
val g = Graph {
val items = List("alpha", "beta", "gamma")
val c1 = ComboBox[String](items)
... |
Explain and rewrite the following Scala code: | object Animal {
def main(args: Array[String]): Unit = { new Animal[Awake].goToSleep }
}
class Animal[A <: AwakeOrAsleep] {
def goToSleep[B >: A <: Awake]: Animal[Asleep] = new Animal[Asleep]
def wakeUp[B >: A <: Asleep]: Animal[Awake] = new Animal[Awake]
}
sealed trait AwakeOrAsleep
trait Awake extends AwakeOrA... |
Explain and rewrite the following Scala code: | package com.capotej.finatra_core
import org.apache.commons.fileupload._
import java.io._
// HERE BE DRAGONS
class MultipartItem(val fileobj:Tuple2[java.util.Map[String,String], ByteArrayOutputStream]) {
def headers() = {
this.fileobj._1
}
def data() = {
this.fileobj._2
}
def name() = {
header... |
Explain and rewrite the following Scala code: | package org.splink.pagelets
import akka.actor.ActorSystem
import helpers.FutureHelper
import org.scalamock.scalatest.MockFactory
import org.scalatest.matchers.should.Matchers
import org.scalatest.flatspec.AnyFlatSpec
import org.scalatest.EitherValues
import org.splink.pagelets.Exceptions.TypeException
import play.api.... |
Explain and rewrite the following Scala code: | package org.globalnames.matcher
case class Candidate(term: String,
stem: String,
dataSourceIds: Set[Int],
verbatimEditDistance: Option[Int],
stemEditDistance: Option[Int])
|
Explain and rewrite the following Scala code: | package dokutoku.golden_thumb.seed
import dokutoku.golden_thumb.seed.traits.GoldenSeed
import net.minecraft.util.Icon
import net.minecraft.item.ItemStack
import net.minecraft.item.Item
class RedstoneSeed(id: Int, crop: Int) extends GoldenSeed(id, crop) {
val product = new ItemStack(Item.redstone, 2)
} |
Explain and rewrite the following Scala code: | /*
* Copyright 2017 Datamountaineer.
*
* 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: | package tsp
import util.graph._
import scala.annotation.tailrec
import scala.util.Random
import scalax.collection._
import scalax.collection.GraphPredef._
import scalax.collection.GraphEdge._
import scalax.collection.edge._
import scalax.collection.edge.Implicits._
import scalaz._
import Scalaz._
trait TravelingSa... |
Explain and rewrite the following Scala code: | /*
* Copyright (C) 2005, The Beangle Software.
*
* This program 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
* (at your option) any later version.
*
* This... |
Explain and rewrite the following Scala code: | /* __ *\\
** ________ ___ / / ___ __ ____ Scala.js IR **
** / __/ __// _ | / / / _ | __ / // __/ (c) 2014, LAMP/EPFL **
** __\\ \\/ /__/ __ |/ /__/ __ |/_// /_\\ \\ http://scala-js.org/ **
** /____/\\___/... |
Explain and rewrite the following Scala code: | package com.twitter.zipkin.receiver.kafka
import com.twitter.logging.Logger
import com.twitter.util.{Await, Future}
import com.twitter.zipkin.thriftscala.{Span => ThriftSpan}
import kafka.consumer.KafkaStream
case class KafkaStreamProcessor[T](
stream: KafkaStream[T, Option[List[ThriftSpan]]],
process: Seq[Thrift... |
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.twitter.scalding.examples
import com.twitter.scalding._
/**
* weighted page rank for the given graph, start from the given pagerank, perform one iteartion, test for
* convergence, if not yet, clone itself and start the next page rank job with updated pagerank as input.
*
* This class is very similar t... |
Explain and rewrite the following Scala code: | package dokutoku.golden_thumb.seed
import dokutoku.golden_thumb.seed.traits.GoldenSeed
import net.minecraft.util.Icon
import net.minecraft.item.ItemStack
import net.minecraft.item.Item
class GlowstoneSeed(id: Int, crop: Int) extends GoldenSeed(id, crop) {
val product = new ItemStack(Item.lightStoneDust, 3)
} |
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: | /*
* Copyright 2012-2013 Stephane Godbillon (@sgodbillon) and Zenexity
*
* 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 req... |
Explain and rewrite the following Scala code: | package org.kimbasoft.specs2.structure
// Specification class for a Unit Specification
import org.specs2.mutable.Specification
/**
* The Unit style specification extends 'org.specs2.mutable.Specification' and operates
* in the Thrown Expectation mode. This means the first failure encountered in a block
* of expect... |
Explain and rewrite the following Scala code: | package lila.ai
import scala.concurrent.duration.FiniteDuration
import actorApi._
private[ai] case class Config(
execPath: String,
hashSize: Int,
nbThreads: Int,
nbInstances: Int,
playMaxMoveTime: FiniteDuration,
analyseMoveTime: FiniteDuration,
playTimeout: FiniteDuration,
analyseMax... |
Explain and rewrite the following Scala code: | /*
* Copyright 2017 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 prassee
import com.twitter.finagle.{ Service, Filter }
import com.twitter.finagle.http.{ Response, Request }
import com.twitter.util.Future
import data.UserData
import org.jboss.netty.handler.codec.http.HttpHeaders.Names
import org.jboss.netty.handler.codec.http.HttpResponseStatus
/*
*
*/
class PageCrawlFi... |
Explain and rewrite the following Scala code: | package com.peterpotts.example
import java.security.SecureRandom
import scala.util.Random
object RandomExample extends RandomExample(Random)
object SecureRandomExample extends RandomExample(new SecureRandom)
class RandomExample(random: Random) extends Example {
private[example] def nextLong() = random.nextLong()... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.