instruction stringclasses 1
value | output stringlengths 5 1M |
|---|---|
Explain and rewrite the following Scala code: | package com.flowtomation.akkared
import akka.actor.{Actor, ActorLogging, ActorRef, ActorRefFactory, Props, Terminated}
import com.flowtomation.akkared.RuntimeActor.{SendToNode, Update}
import com.flowtomation.akkared.model.{FlowNode, Flows, ItemId}
class Runtime(registry: Registry, lookupBus: LookupBusImpl)(implicit ... |
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.j5ik2o.spetstore.adaptor.aggregate
import akka.persistence.PersistentActor
import com.github.j5ik2o.spetstore.adaptor.eventbus.{EventBus, EventWithSender}
import com.github.j5ik2o.spetstore.infrastructure.domainsupport.EntityProtocol.{CreateEvent, UpdateEvent}
import com.github.j5ik2o.spetstore.infr... |
Explain and rewrite the following Scala code: | /*
* Copyright 2011-2018 Chris de Vreeze
*
* 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 agree... |
Explain and rewrite the following Scala code: | package com.twitter.cache
import com.twitter.util.{Future, Memoize}
import java.util.concurrent.ConcurrentMap
/**
* FutureCache is used to represent an in-memory, in-process, asynchronous cache.
*
* Every cache operation is atomic.
*
* Any correct implementation should make sure that you evict failed
* results,... |
Explain and rewrite the following Scala code: | /**
* Copyright (c) 2002-2012 "Neo Technology,"
* Network Engine for Objects in Lund AB [http://neotechnology.com]
*
* This file is part of Neo4j.
*
* Neo4j 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 Foundati... |
Explain and rewrite the following Scala code: | package ai.h2o.sparkling.api.generation
import java.io.{File, PrintWriter}
import java.lang.reflect.{Method, Modifier}
import ai.h2o.sparkling.utils.ScalaUtils.withResource
object ConfigurationRunner {
val templatesByLanguage = Map("py" -> python.ConfigurationTemplate, "R" -> r.ConfigurationTemplate)
def main(ar... |
Explain and rewrite the following Scala code: | package com.twitter.conversions
import scala.collection.{SortedMap, immutable, mutable}
import scala.math.Ordering
/**
* Implicits for converting tuples.
*
* @example
* {{{
* import com.twitter.conversions.TupleOps._
*
* Seq(1 -> "tada", 2 -> "lala").toKeys
* Seq(1 -> "tada", 2 -> "lala").mapValues(_.size)
*... |
Explain and rewrite the following Scala code: | package org.nd4j.api
import org.scalatest.FlatSpec
import Implicits._
class NDArrayProjectionAPITest extends FlatSpec {
"ColumnProjectedNDArray" should "map column correctly" in {
val ndArray =
Array(
Array(1d, 2d, 3d),
Array(4d, 5d, 6d),
Array(7d, 8d, 9d)
).toNDArray
va... |
Explain and rewrite the following Scala code: | package mesosphere.marathon
package core.event
import com.fasterxml.jackson.annotation.JsonIgnore
import mesosphere.marathon.api.v2.json.Formats.eventToJson
import mesosphere.marathon.core.condition.Condition
import mesosphere.marathon.core.health.HealthCheck
import mesosphere.marathon.core.instance.update.InstanceCha... |
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: | /***********************************************************************
* 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 ru.tolsi.matcher
import org.scalatest._
import org.scalatest.concurrent.ScalaFutures
abstract class UnitSpec extends FunSpec with Matchers with
OptionValues with Inside with Inspectors with ScalaFutures with BeforeAndAfter
|
Explain and rewrite the following Scala code: | /*
* Copyright 2001-2009 OFFIS, Tammo Freese
*
* 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 com.nekogata.backlogger.application.command.dashboard
import com.nekogata.backlogger.application.service.dashboard.ChangeStatusService
import scala.scalajs.js
trait MakeIssueStatusAsProcessedCommand {
var projectId: js.UndefOr[Int]
var issueId: js.UndefOr[Int]
def projectIdAsOption = projectId.toOptio... |
Explain and rewrite the following Scala code: | package io.iohk.ethereum.vm.utils
import ABI._
object ABI {
case class Param(name: String, `type`: String)
}
case class ABI(`type`: String, name: String = "", inputs: Seq[Param] = Nil, outputs: Seq[Param] = Nil) {
val shortSignature = s"$name(${inputs.map(_.`type`).mkString(",")})"
val fullSignature = {
v... |
Explain and rewrite the following Scala code: | package basic
import com.excilys.ebi.gatling.core.Predef._
import com.excilys.ebi.gatling.http.Predef._
import com.excilys.ebi.gatling.jdbc.Predef._
import com.excilys.ebi.gatling.http.Headers.Names._
import akka.util.duration._
import bootstrap._
/**
* Started with a command like:
* $ cd $GATLING_HOME/bin
* $ ./g... |
Explain and rewrite the following Scala code: | package com.aristocrat.mandrill.requests.Inbound
import com.aristocrat.mandrill.requests.MandrillRequest
case class Domains(key: String) extends MandrillRequest
|
Explain and rewrite the following Scala code: | package org.jetbrains.plugins.scala.lang.annotator
import org.jetbrains.plugins.scala.base.ScalaLightCodeInsightFixtureTestAdapter
/**
* Nikolay.Tropin
* 25-Sep-17
*/
class UnspecifiedValueParamImplicitTest extends ScalaLightCodeInsightFixtureTestAdapter {
def testSCL10845(): Unit = {
checkTextHasNoErrors... |
Explain and rewrite the following Scala code: | package pl.edu.agh.mplt.parser.declaration.objective
import pl.edu.agh.mplt.parser.declaration.Declaration
import pl.edu.agh.mplt.parser.phrase.set.Indexing
import pl.edu.agh.mplt.parser.phrase.expression.Expression
trait ObjectiveDeclaration extends Declaration {
def name: String
def indexing: Option... |
Explain and rewrite the following Scala code: | package v1.post
import javax.inject.Inject
import play.api.http.HttpVerbs
import play.api.i18n.{Messages, MessagesApi}
import play.api.mvc._
import scala.concurrent.{ExecutionContext, Future}
/**
* A wrapped request for post resources.
*
* This is commonly used to hold request-specific information like
* se... |
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 dotty.tools
package dotc
package config
import io.{AbstractFile,ClassPath,JavaClassPath,MergedClassPath,DeltaClassPath}
import ClassPath.{ JavaContext, DefaultJavaContext }
import core._
import Symbols._, Types._, Contexts._, Denotations._, SymDenotations._, StdNames._, Names._
import Flags._, Scopes._, Decora... |
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 twentysix.playr
import play.api.mvc._
import twentysix.playr.simple._
class TestController extends InjectedController with Resource[Boolean] {
def fromId(id: String): Option[Boolean] = if (id == "26") Some(true) else None
def name: String = "test"
def list: EssentialAction = Action { Ok("list") }
def ... |
Explain and rewrite the following Scala code: | // Copyright 2014 Commonwealth Bank of Australia
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by ap... |
Explain and rewrite the following Scala code: | package week4.primitives
class Succ(n: Nat) extends Nat {
def isZero: Boolean = false
def predecessor: Nat = n
def + (that: Nat): Nat = new Succ(n + that)
def - (that: Nat): Nat =
if (that.isZero) this
else n - that.predecessor
} |
Explain and rewrite the following Scala code: | import leon.annotation._
import leon.lang._
import leon.lang.synthesis._
object Complete {
sealed abstract class List
case class Cons(head: Int, tail: List) extends List
case object Nil extends List
def size(l: List) : Int = (l match {
case Nil => 0
case Cons(_, t) => 1 + size(t)
}) ensuring(res... |
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: | package lila.swiss
import cats.implicits._
import org.joda.time.DateTime
import scala.concurrent.duration._
import lila.db.dsl._
import lila.hub.LightTeam.TeamID
import lila.memo._
final private class SwissCache(
colls: SwissColls,
cacheApi: CacheApi
)(implicit ec: scala.concurrent.ExecutionContext) {
imp... |
Explain and rewrite the following Scala code: | package org.lanyard.dist.disc
import org.lanyard.dist.Distribution
import org.lanyard.random.RNG
case class NegBinomial( nrOfFailures: Int, prob: Double) extends Distribution[Int] {
require( 0 < nrOfFailures, s"Negative binomial distribution parameter nrOfFailures needs to be strictly positive. Found value: ${nrOf... |
Explain and rewrite the following Scala code: | import sbt._
import Keys._
import com.jsuereth.sbtpgp.PgpKeys
import com.jsuereth.sbtpgp.PgpKeys._
import org.scalajs.jsenv.jsdomnodejs.JSDOMNodeJSEnv
import org.scalajs.sbtplugin.ScalaJSPlugin
import org.scalajs.sbtplugin.ScalaJSPlugin.autoImport._
import sbtrelease.ReleasePlugin.autoImport._
import xerial.sbt.Sonatyp... |
Explain and rewrite the following Scala code: | package com.twitter.finagle.http
import scala.collection.mutable
protected abstract class CookieMapVersionSpecific(message: Message, cookieCodec: CookieCodec)
extends mutable.Map[String, Cookie]
with mutable.MapLike[String, Cookie, CookieMap] {
def this(message: Message) = this(message, CookieMap.cookieCode... |
Explain and rewrite the following Scala code: | package scorex.transaction
import org.h2.mvstore.MVStore
import scorex.block.Block
import scorex.block.Block.BlockId
import scorex.crypto.encode.Base58
import scorex.utils.ScorexLogging
import scala.util.{Failure, Success, Try}
/**
* Storage interface combining both history(blockchain/blocktree) and state
*/
tra... |
Explain and rewrite the following Scala code: | package exploration
import ParseSettings._
import lift.arithmetic.ArithExpr
import org.junit.Test
import org.junit.Assert._
import play.api.libs.json._
class TestParametersAndSettings {
@Test
def generateCompleteDefaultConfigString(): Unit = {
val config = Settings.generateConfigString
println(config)
... |
Explain and rewrite the following Scala code: | package org.tinydvr.schedulesdirect.api
import dispatch.{HttpExecutor, Req}
import org.joda.time.LocalDate
import org.joda.time.format.DateTimeFormat
import scala.concurrent._
class SchedulesDirectAPIClient(token: String)(
implicit val http: HttpExecutor,
implicit val execution: ExecutionContext
) extends AsyncHt... |
Explain and rewrite the following Scala code: | package com.daodecode.scalaj.collection.test
import scala.collection.generic.CanBuildFrom
import scala.collection.{immutable, mutable}
import com.daodecode.scalaj.collection._
import org.scalatest.{Matchers, WordSpec}
class SimpleJConvertersTest extends WordSpec with Matchers {
"SeqConverters" should {
def a... |
Explain and rewrite the following Scala code: | package scodec
package msgpack
import org.scalacheck.Prop._
import org.scalacheck.Arbitrary._
import org.scalatestplus.scalacheck.Checkers
import scala.util.Random
class MessagePackSpec extends TestSuite with Checkers {
import Serialize._
"bool" should "be able to encode and decode" in {
check(forAll((b: Bo... |
Explain and rewrite the following Scala code: | /**
* Licensed to Big Data Genomics (BDG) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The BDG licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use ... |
Explain and rewrite the following Scala code: | /*
* Copyright 2019 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) 2009-2017 Lightbend Inc. <https://www.lightbend.com>
*/
package play.api.routing.sird
import play.api.mvc.RequestHeader
/**
* An extractor that extracts requests by method.
*/
class RequestMethodExtractor private[sird] (method: String) {
def unapply(request: RequestHeader): Option[RequestHead... |
Explain and rewrite the following Scala code: | package akka.contrib.persistence.mongodb
import akka.actor.{PoisonPill, Props}
import akka.persistence.PersistentActor
import akka.persistence.query.PersistenceQuery
import akka.stream.ActorMaterializer
import com.typesafe.config.ConfigFactory
import org.scalatest.BeforeAndAfterAll
import org.scalatest.concurrent.Even... |
Explain and rewrite the following Scala code: | package com.netgents.antelese
import org.apache.tools.ant._
import util._
class RichFileNameMapper(override val project: Project, val fileNameMapper: FileNameMapper) extends AntElement[FileNameMapper](project, fileNameMapper)
|
Explain and rewrite the following Scala code: | package frameless
import shapeless._
trait InjectionEnum {
implicit val cnilInjectionEnum: Injection[CNil, String] =
Injection(
// $COVERAGE-OFF$No value of type CNil so impossible to test
_ => throw new Exception("Impossible"),
// $COVERAGE-ON$
name =>
throw new IllegalArgumentE... |
Explain and rewrite the following Scala code: | package cattamer
import java.io.File
import java.util.concurrent.TimeUnit
import akka.actor.{Cancellable, Props, Actor}
import cats.abstractcat.Cat
import cattamer.CatTamer.{Disable, Enable}
import com.typesafe.config.{ConfigFactory, Config}
import com.typesafe.scalalogging.LazyLogging
import message.Act
import scala... |
Explain and rewrite the following Scala code: | package com.whisk.docker.testkit.test
import com.whisk.docker.testkit._
import org.scalatest.funsuite.AnyFunSuite
class MultiContainerTest
extends AnyFunSuite
with DockerElasticsearchService
with DockerMongodbService {
override val managedContainers: ContainerGroup =
ContainerGroup.of(elasticsearch... |
Explain and rewrite the following Scala code: | package com.datastax.spark.connector
/** Contains a [[cql.CassandraConnector]] object which is used to connect
* to a Cassandra cluster and to send CQL statements to it. `CassandraConnector`
* provides a Scala-idiomatic way of working with `Cluster` and `Session` object
* and takes care of connection pooling an... |
Explain and rewrite the following Scala code: | package co.verst.slick
import slick.codegen.SourceCodeGenerator
import slick.{model => m}
// scalastyle:off methodname
class WideTableGenerator(model: m.Model) extends SourceCodeGenerator(model) {
override def Table = { table: m.Table =>
if (table.columns.size > 22) {
new super.Table(table) with WideTable... |
Explain and rewrite the following Scala code: | /*
* Copyright © 2011-2012 Sattvik Software & Technology Resources, Ltd. Co.
* All rights reserved.
*
* 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/licens... |
Explain and rewrite the following Scala code: | package utils.actors
class LogActor {
}
|
Explain and rewrite the following Scala code: | package fpinscala.ch2_gettingstarted
// A comment!
/* Another comment */
/** A documentation comment */
object MyModule {
def abs(n: Int): Int =
if (n < 0) -n
else n
private def formatAbs(x: Int) = {
val msg = "The absolute value of %d is %d"
msg.format(x, abs(x))
}
def main(args: Array[Stri... |
Explain and rewrite the following Scala code: | package com.jesperancinha.imagecontour.filters.contour
import org.scalatest.funsuite.AnyFunSuite
class ImageContourThresholdTest extends AnyFunSuite {
test("testDiffThreshold") {
val imageContourThreshold: ImageContourThreshold = new ImageContourThreshold(123D, 123)
assertResult(imageContourThreshold.diffT... |
Explain and rewrite the following Scala code: | package com.twitter.finatra.http.tests.integration.tweetexample.main
import com.twitter.conversions.storage._
import com.twitter.finatra.http.HttpServer
import com.twitter.finatra.http.filters.CommonFilters
import com.twitter.finatra.http.tests.integration.tweetexample.main.controllers.{AdminController, TweetsControll... |
Explain and rewrite the following Scala code: | package utils
import java.util.Date
import org.joda.time.{DateTime, DateTimeZone}
import org.joda.time.format.ISODateTimeFormat
import play.api.libs.json._
/**
* Play Json formatter that formats Date objects as ISO-8601 strings
*/
object JsonFormats {
implicit object DateFormat extends Format[Date] {
val for... |
Explain and rewrite the following Scala code: | package com.tsukaby.bean_validation_scala
import javax.validation.constraints.Pattern
import javax.validation.{ConstraintValidator, ConstraintValidatorContext}
import org.hibernate.validator.internal.constraintvalidators.bv.PatternValidator
/**
* Check the wrapped string.
*/
class PatternValidatorForOption extends... |
Explain and rewrite the following Scala code: | /**********************************************************************************************************************
* This file is part of Scrupal, a Scalable Reactive Web Application Framework for Content Management *
* ... |
Explain and rewrite the following Scala code: | package scorex.network
import java.net.InetSocketAddress
import akka.actor.{Actor, ActorRef}
import akka.io.Tcp._
import akka.util.ByteString
import scorex.Controller
import scorex.block.{Block, NewBlock}
import scorex.network.NetworkController.UpdateBlockchainScore
import scorex.network.message.{Message, _}
import s... |
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 gapt.proofs.lk.reductions
import gapt.expr.formula.fol.FOLFormula
import gapt.proofs.lk.LKProof
import gapt.proofs.lk.rules.CutRule
import gapt.proofs.lk.transformations.Selector
import gapt.proofs.lk.util.logicalComplexity
class MaximumGradeSelector( reduction: CutReduction ) extends Selector {
override de... |
Explain and rewrite the following Scala code: | package scrabble
abstract class Tile() {
val letter: Char
val value: Int
}
case class Letter(letter: Char, value: Int) extends Tile {
override def equals(that: Any) = {
that match {
case (Letter(chr, vl)) => (chr == letter) && (value == value)
case _ => false
}
}
}
case class BlankLetter(... |
Explain and rewrite the following Scala code: | // Webside Source Code Zauberstuhl.de
// Copyright (C) 2016-2019 Lukas Matt <lukas@matt.wf>
//
// 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
// any late... |
Explain and rewrite the following Scala code: | /*
* Anthony Anderson (Illyohs)
* Copyright (c) 2017.
*
* This library 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 version 2.1
* of the License.
*
* This library is distributed in the hope t... |
Explain and rewrite the following Scala code: | package vulkan.wrapper.registry.vtype
import vulkan.wrapper.registry.venum.{VulkanEnumEnum, VulkanEnumNormalEnum}
import vulkan.wrapper.registry.{Registry, _}
import scala.xml.Node
class VulkanMember(registry: Registry, val vulkanMemberType: VulkanMemberType, node: Node) extends VulkanNamedComponent(registry,node){
... |
Explain and rewrite the following Scala code: | package edu.berkeley.cs.boom.bloomscala.typing
object CollectionType extends Enumeration {
type CollectionType = Value
val Table, Scratch, Input, Output, Channel = Value
val nameToType: Map[String, CollectionType] = Map(
"table" -> Table,
"scratch" -> Scratch,
"input" -> Input,
"output" -> Outpu... |
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 dhg.ccg.parse.pcfg
import org.junit.Test
import org.junit.Assert._
import dhg.ccg.parse._
import dhg.ccg.prob._
import dhg.ccg.cat._
import dhg.ccg.rule._
import dhg.ccg.tagdict.SimpleTagDictionary
import dhg.util._
import scala.collection.immutable.ListMap
import dhg.ccg.tagdict.TagDictionary
import dhg.gfl._... |
Explain and rewrite the following Scala code: | package akka.contrib.persistence.mongodb
import akka.actor.Actor
import akka.persistence.journal.AsyncWriteJournal
import akka.persistence.{AtomicWrite, PersistentRepr}
import com.typesafe.config.Config
import nl.grons.metrics4.scala.MetricName
import scala.collection.immutable.Seq
import scala.concurrent.Future
impo... |
Explain and rewrite the following Scala code: | package debop4s.data.orm.jpa.spring
import javax.sql.DataSource
import debop4s.data.orm.DataConst._
/**
* JPA 에서 MariaDB 을 사용하기 위한 환경설정
*
* Created by debop on 2014. 1. 29..
*/
abstract class AbstractJpaMariaDbConfiguration extends AbstractJpaMySqlConfiguration {
override def dataSource: DataSource = {
bu... |
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 io.netflow.netty
import java.net.InetSocketAddress
import io.netflow.actors._
import io.netflow.lib._
import io.netty.buffer._
import io.netty.channel._
import io.netty.channel.socket.DatagramPacket
import io.wasted.util._
abstract class TrafficHandler extends SimpleChannelInboundHandler[DatagramPacket] with... |
Explain and rewrite the following Scala code: | /**
* Licensed to Big Data Genomics (BDG) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The BDG licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use ... |
Explain and rewrite the following Scala code: | package alwsk
import java.io.File
import java.net.URL
import io.circe.generic.auto._
import io.circe.parser._
import io.circe.syntax._
import org.apache.tools.ant.taskdefs.Zip
import org.apache.tools.ant.types.FileSet
import vgrechka.Shared_jvmKt._
case class JSON_BuildState(
var modificationTimeOfLastDeployedAlra... |
Explain and rewrite the following Scala code: | package modules
import actor.{ActorInit, PlaylistActor}
import com.google.inject.AbstractModule
import play.api.libs.concurrent.AkkaGuiceSupport
class EagerInit extends AbstractModule with AkkaGuiceSupport {
override def configure(): Unit = {
bind(classOf[ActorInit]).asEagerSingleton()
bindActor[PlaylistAct... |
Explain and rewrite the following Scala code: | /**
* Copyright 2016 ZuInnoTe (Jörn Franke) <zuinnote@gmail.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... |
Explain and rewrite the following Scala code: | package argonaut
import org.specs2._
import Argonaut._
object EncodeJsonSpecification extends Specification with ScalaCheck { def is = s2"""
EncodeJson mapJson
Normal invocation ${mapJson}
EncodeJson Witness Compilation
Witness basics ${ok}
Witness tuples ... |
Explain and rewrite the following Scala code: | package org.jetbrains.plugins.scala.findUsages.factory
import com.intellij.openapi.project.Project
import org.jetbrains.plugins.scala.lang.psi.fake.FakePsiMethod
import org.jetbrains.plugins.scala.lang.psi.api.toplevel.ScTypedDefinition
import org.jetbrains.plugins.scala.lang.psi.api.toplevel.typedef.ScTypeDefinition
... |
Explain and rewrite the following Scala code: | package nl.surfnet.safnari
import nl.surfnet.nsiv2.utils._
import javax.xml.datatype.XMLGregorianCalendar
import java.time.{ Instant, ZoneOffset }
import java.time.temporal._
import org.scalacheck.Arbitrary
import org.scalacheck.Gen
@org.junit.runner.RunWith(classOf[org.specs2.runner.JUnitRunner])
class PackageSpec ... |
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"); y... |
Explain and rewrite the following Scala code: | /** this package implements dynamic exprs (Scan, Val) */
package drx
import drx.graph.{RxDynamic, Rx}
import scala.util.{DynamicVariable, Failure, Success, Try}
//pipe iter(1, 2, 3, 4, 5)
// map(x => x+1)
// filter(x => x % 2)
// println
//
//do x <- 1, 2, 3, 4, 5
// x <- x+1
// if x % 2
// pri... |
Explain and rewrite the following Scala code: | import leon.lang._
object ArrayBinarySearchFun {
//def binarySearchOverflow()
def binarySearch(a: Array[Int], key: Int, low: Int, high: Int): Int = ({
require(a.length > 0 && sorted(a, low, high) &&
0 <= low && low <= high + 1 && high < a.length
)
if(low <= high) {
val i = (high + low)... |
Explain and rewrite the following Scala code: | /*
* Copyright 2014–2018 SlamData 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 agr... |
Explain and rewrite the following Scala code: | /***********************************************************************
* 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 accompanies this distribution and... |
Explain and rewrite the following Scala code: | /* *\\
** Squants **
** **
** Scala Quantities and Units of Measure Library and DSL **
** (c) 2013-2015, G... |
Explain and rewrite the following Scala code: | package com.toscaruntime.it
import java.nio.file.{Files, Path, Paths, StandardCopyOption}
import com.toscaruntime.cli.command.UseCommand
import com.toscaruntime.it.TestConstant._
import com.toscaruntime.rest.client.ToscaRuntimeClient
import com.toscaruntime.util.DockerUtil
import org.apache.commons.lang3.StringUtils
... |
Explain and rewrite the following Scala code: | package dotty.tools.languageserver.worksheet
import dotty.tools.dotc.core.Contexts.Context
import java.io.{File, PrintStream, IOException}
import java.lang.ProcessBuilder.Redirect
import java.util.concurrent.CancellationException
import java.util.{Timer, TimerTask}
import org.eclipse.lsp4j.jsonrpc.CancelChecker
pri... |
Explain and rewrite the following Scala code: | /* NSC -- new Scala compiler
* Copyright 2005-2013 LAMP/EPFL
* @author Martin Odersky
*/
package scala
package tools.nsc
import io.{ AbstractFile, Directory, File, Path }
import java.io.IOException
import scala.tools.nsc.classpath.DirectoryClassPath
import scala.tools.nsc.reporters.{Reporter,ConsoleReporter}
impo... |
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 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 ui
import java.awt.image.BufferedImage
import java.awt.{Color, Dimension, Font, GradientPaint}
import application.Settings
import scala.swing.{MainFrame, Panel}
class ServerWindow() extends MainFrame {
title = "Remote server"
preferredSize = new Dimension(320, 240)
centerOnScreen()
contents = new P... |
Explain and rewrite the following Scala code: | package security
import be.objectify.deadbolt.scala.HandlerKey
/**
* @author Steve Chaloner (steve@objectify.be)
*/
object HandlerKeys {
val defaultHandler = Key("defaultHandler")
val altHandler = Key("altHandler")
val userlessHandler = Key("userlessHandler")
case class Key(name: String) extends HandlerKe... |
Explain and rewrite the following Scala code: | package mesosphere.mesos
import mesosphere.marathon.core.task.Task
import org.apache.mesos.{ Protos => Mesos }
import scala.collection.JavaConverters._
object PersistentVolumeMatcher {
def matchVolumes(
offer: Mesos.Offer,
waitingTasks: Iterable[Task.Reserved]): Option[VolumeMatch] = {
// find all off... |
Explain and rewrite the following Scala code: | package colossus.controller
import colossus.service.Protocol
trait Encoding {
type Input
type Output
}
object Encoding {
type Apply[I, O] = Encoding { type Input = I; type Output = O }
type Server[P <: Protocol] = Encoding { type Input = P#Request; type Output = P#Response }
type Client[P <: Protocol] = ... |
Explain and rewrite the following Scala code: | package keystoneml.loaders
import org.scalatest.FunSuite
import org.apache.spark.SparkContext
import keystoneml.utils.TestUtils
import keystoneml.workflow.PipelineContext
class VOCLoaderSuite extends FunSuite with PipelineContext {
test("load a sample of VOC data") {
sc = new SparkContext("local", "test")
v... |
Explain and rewrite the following Scala code: | /*
* Copyright 2014–2018 SlamData 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 agr... |
Explain and rewrite the following Scala code: | package lara.epfl.scalasca.core
import scala.tools.nsc._
abstract class Node
abstract class ControlFlowGraphNode(val node: Option[Global#Tree]) extends Node
case class MethodDef(val n: Global#Tree) extends ControlFlowGraphNode(Some(n))
case class ValueDef(val n: Global#Tree) extends ControlFlowGraphNode(Some(n))
case... |
Explain and rewrite the following Scala code: | package org.jetbrains.plugins.scala
package compiler
import java.io.File
import java.net.{URL, URLClassLoader}
import com.btr.proxy.util.PlatformUtil
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.module.Module
import com.intellij.openapi.roots.OrderEnumerator
import com.intell... |
Explain and rewrite the following Scala code: | package org.helgoboss.scala_osgi_metatype.adapters
import org.helgoboss.scala_osgi_metatype.interfaces.ListAttributeDefinition
/**
* Provides the given Scala list attribute definition as an OSGi-compliant attribute definition.
*
* @constructor Creates an adapter for the given definition.
* @param delegate Scala l... |
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 Scalisp
import org.scalatest.FlatSpec
import org.scalatest.matchers.ShouldMatchers
class Compiler extends FlatSpec with ShouldMatchers {
val repl = new REPL()
"Function arities" should "be recognized correctly" in {
val ast = List[Any]("begin", List[Any]("print", 1, 4), List[Any]("echo", 3, 3.0))
... |
Explain and rewrite the following Scala code: | package problemtype
import org.scalatest.FunSuite
import problemtype.ExactCover.mapInput
/** Unit tests ExactCover class */
class ExactCoverUnitTest extends FunSuite {
test("mapInput() should map inputs correctly") {
val universe: Array[Int] = Array(1, 2, 3, 4, 5, 6, 7)
val sets: Map[String, Array[Int]] = ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.