instruction stringclasses 1
value | output stringlengths 5 1M |
|---|---|
Explain and rewrite the following Scala code: | // See the LICENCE.txt file distributed with this work for additional
// information regarding copyright ownership.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache... |
Explain and rewrite the following Scala code: | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... |
Explain and rewrite the following Scala code: | /* Copyright (C) 2008-2016 University of Massachusetts Amherst.
This file is part of "FACTORIE" (Factor graphs, Imperative, Extensible)
http://factorie.cs.umass.edu, http://github.com/factorie
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with... |
Explain and rewrite the following Scala code: | package org.littlewings.javaee7.entity
import javax.persistence.{Column, Entity, Id, Table}
import scala.beans.BeanProperty
@Entity
@Table(name = "language")
@SerialVersionUID(1L)
class Language extends Serializable {
@Id
@BeanProperty
var id: Long = _
@Column
@BeanProperty
var name: String = _
overr... |
Explain and rewrite the following Scala code: | package org.bitcoins.core.script.constant
import org.bitcoins.core.script.flag.ScriptFlagUtil
import org.bitcoins.core.script.result._
import org.bitcoins.core.script.{
ExecutionInProgressScriptProgram,
StartedScriptProgram
}
import org.bitcoins.core.util.{BitcoinScriptUtil, BytesUtil}
import scala.annotation.tai... |
Explain and rewrite the following Scala code: | package org.openurp.edu.eams.teach.program.major.flexible
import org.openurp.edu.eams.teach.program.Program
//remove if not needed
trait MajorProgramTextTitleProvider {
def provideTitle(program: Program): Array[String]
}
|
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.distributed_stumps.stumps.message.subscriber
/**
* Acknowledgement message sent back to clients to let them know that the subscription has
* been successfully unregistered.
*/
case object Unregistered
|
Explain and rewrite the following Scala code: | package de.axeclbr.shoushiling.rules
case class TurnChoice(number: Int, name: String)
package object rules {
type ChoiceFunction = Seq[TurnChoice] => TurnChoice
}
|
Explain and rewrite the following Scala code: | /*
* Copyright 2011-2022 GatlingCorp (https://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) 2016 SnappyData, Inc. 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/licenses/LICENSE-2.0
*
* Unless required by ap... |
Explain and rewrite the following Scala code: | package poly.algebra
import poly.algebra.factory._
import poly.algebra.specgroup._
/**
* Represents the existence of a maximum `top` element.
*
* An instance of this typeclass should satisfy the following axiom:
* - $lawTop
* @define lawTop '''Top element''': ∀''a''∈X, ''a'' <= top.
* @author Tongfei Chen
* @... |
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.upgrade
import akka.actor.{ ActorSystem, Props }
import akka.testkit.{ TestActorRef, TestKit }
import com.codahale.metrics.MetricRegistry
import mesosphere.marathon.event.{ HealthStatusChanged, MesosStatusUpdateEvent }
import mesosphere.marathon.Protos.MarathonTask
import mesosphere.maratho... |
Explain and rewrite the following Scala code: | import sbt._
import sbt.Keys._
object LiftProjectBuild extends Build {
import BuildSettings._
lazy val root = Project("antipodizame", file("."))
.settings(liftAppSettings: _*)
.settings(libraryDependencies ++=
Seq(
"net.liftweb" %% "lift-webkit" % Ver.lift % "compile",
"net.liftweb"... |
Explain and rewrite the following Scala code: | /*
* Copyright 2015 ligaDATA
*
* 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 edu.berkeley.nlp.entity.coref
import scala.collection.mutable.ArrayBuffer
import edu.berkeley.nlp.futile.fig.basic.Indexer
import edu.berkeley.nlp.futile.util.Logger
import scala.collection.mutable.HashMap
import scala.collection.JavaConverters._
import edu.berkeley.nlp.futile.util.Counter
import edu.berkeley.n... |
Explain and rewrite the following Scala code: | package com.github.maxpsq.googlemaps
object GeoSpatials {
abstract class Coordinate(val coord: Double) {
val Min: Double
val Max: Double
def isValid: Boolean = ( Max > coord && Min < coord )
}
class Latitude(override val coord: Double) extends Coordinate(coord) {
override val Min: Double ... |
Explain and rewrite the following Scala code: | /*
*************************************************************************************
* Copyright 2016 Normation SAS
*************************************************************************************
*
* This file is part of Rudder.
*
* Rudder is free software: you can redistribute it and/or modify
* it under the... |
Explain and rewrite the following Scala code: | package challenge
object Int190 {
def main(args: Array[String]): Unit = {
println("The word containing the most number of words: " +
mostCountSubwords)
}
val words = io.Source.fromFile("data/challenge/enable1.txt").getLines()
.filter(_.length >= 2).toSet
def substrings(str: String): Iterator[St... |
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 (C) 2009-2017 Lightbend Inc. <https://www.lightbend.com>
*/
import sbt._
import sbt.Keys._
import play.sbt.PlayScala
import play.sbt.test.MediatorWorkaroundPlugin
import org.apache.logging.log4j.Level
import org.apache.logging.log4j.core.{ LogEvent => Log4JLogEvent, _ }
import org.apache.logging.log4... |
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: | // Copyright: 2010 - 2016 https://github.com/ensime/ensime-server/graphs
// Licence: http://www.gnu.org/licenses/gpl-3.0.en.html
package org.ensime.jerk
import org.scalatest._
import spray.json._
trait SprayJsonTestSupport {
this: Matchers =>
def roundtrip[T: JsonFormat](value: T, via: Option[String] = None): Un... |
Explain and rewrite the following Scala code: | package org.ratina.leetcode.longest_palindrome_substring
import scala.collection.mutable._
object Solution {
def longestPalindrome(s: String): String = {
var (maxSize, maxIdx) = (1, 0)
var chars = new ArrayBuffer[Char]
for (ch <- s) {
chars append('*', ch)
}
cha... |
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 scalaxy.streams
private[streams] trait StreamSources
extends InlineRangeStreamSources
with InlineSeqStreamSources
with IteratorStreamSources
with ListStreamSources
with OptionStreamSources
with ArrayStreamSources
with JsArrayStreamSources
{
val global: scala.reflect.api.Universe
import global... |
Explain and rewrite the following Scala code: | package org.triplepoint.ScalaCrazyflie
object Main extends App {
// ## Testing!
// Eventually, we want to not talk to the radio directly and instead
// talk to a CrazyFlie object that owns a radio object.
val radio = CrazyRadio()
println("Radio Firmware Version", radio.firmwareVersion)
radio.scanChanne... |
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.maxpsq.googlemaps.geocoding
import com.github.maxpsq.googlemaps.Parameter
import com.github.maxpsq.googlemaps.GeoSpatials._
object Parameters {
sealed trait LocationParam extends Parameter
// LatLng
case class LatLngParam(lat: Double, lng: Double) extends Parameter("latlng", new GeoPoint(... |
Explain and rewrite the following Scala code: | package org.rebeam.boxes.persistence
/**
* Writes tokens using side effects.
* TODO replace with something like a Process from fs2?
*/
trait TokenWriter {
def write(t: Token): Unit
def close(): Unit
} |
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 Dennis Vriend
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed t... |
Explain and rewrite the following Scala code: | package co.blocke.scalajack
package typeadapter
import model._
import co.blocke.scala_reflection._
import co.blocke.scala_reflection.info.IntersectionInfo
import co.blocke.scala_reflection.impl.Clazzes._
import scala.collection.mutable.Builder
import scala.util.{ Failure, Success, Try }
object IntersectionTypeAdapte... |
Explain and rewrite the following Scala code: | object Test {
def main(args: Array[String]): Unit = {
// these should give unboxed results
println(().getClass)
println(5.getClass)
// these should give boxed results
println(().asInstanceOf[AnyRef with Unit].getClass)
println(().asInstanceOf[Unit with AnyRef].getClass)
println(5.asInstance... |
Explain and rewrite the following Scala code: | /* Copyright (c) 2008 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to... |
Explain and rewrite the following Scala code: | package com.javachen.spark.examples.rdd
/**
*
* @author <a href="mailto:june.chan@foxmail.com">june</a>.
* @date 2015-05-12 17:21.
*/
object Pipe {
}
|
Explain and rewrite the following Scala code: | package org.vvcephei.scalaofx.lib.model.response
import org.joda.time.DateTime
import org.vvcephei.scalaofx.lib.model.Account
case class CreditCardStatement(currency: String, account: Account, startTime: DateTime, endTime: Option[DateTime], transactions: Seq[Transaction], ledgerBalance: Double, availableBalance: Opt... |
Explain and rewrite the following Scala code: | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... |
Explain and rewrite the following Scala code: | /*
* Copyright (C) Lightbend Inc. <https://www.lightbend.com>
*/
package play.data
import com.typesafe.config.ConfigFactory
import java.nio.file.Files
import akka.util.ByteString
import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.node.JsonNodeFactory
import com.fasterxml.jackson.d... |
Explain and rewrite the following Scala code: | /*
* Copyright 2016 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 $package$
import sri.core.ReactElement
import sri.web.router
import sri.web.router.{
History,
HistoryFactory,
RouteNotFound,
Router,
RouterConfig,
RouterCtrl
}
package object components {
object AppRoutes extends RouterConfig {
override val history: History = HistoryFactory.browserHistory()... |
Explain and rewrite the following Scala code: | /**
* @author Chris Campo
*/
object Brotwurst extends App {
def mandelbrot(nx: Int, ny: Int, xMin: Double, xMax: Double,
yMin: Double, yMax: Double, max_iterations: Int): Array[Array[Int]] = {
val grid = Array.ofDim[Int](ny, nx)
val dx = (xMax - xMin) / (nx - 1)
val dy = (yMax - yMin) ... |
Explain and rewrite the following Scala code: | /*
* Copyright 2007-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: | /* 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 com.jspha.maia.generic
import scala.language.higherKinds
import com.jspha.maia._
import shapeless._
impo... |
Explain and rewrite the following Scala code: | /*
* Copyright (c) 2002-2018 "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 Foundatio... |
Explain and rewrite the following Scala code: | package org.deepdive.test.unit
import anorm._
import org.deepdive.datastore._
import org.deepdive.extraction._
import org.deepdive.extraction.datastore._
import org.deepdive.test._
import org.scalatest._
import scala.io.Source
import play.api.libs.json._
import java.io.StringWriter
class PostgresExtractionDataStoreSp... |
Explain and rewrite the following Scala code: | package com.electronwill.niol.buffer.storage
/**
* Thrown when a StagedPools object cannot return a result because there is no stage that
* corresponds to the requested capacity.
*
* @param msg explanation message
*/
class NoCorrespondingStageException(msg: String) extends Exception(msg) {}
|
Explain and rewrite the following Scala code: | package io.buoyant.grpc.runtime
import com.google.protobuf.{CodedInputStream, CodedOutputStream}
import com.twitter.finagle.buoyant.h2
import com.twitter.util.Future
import io.netty.buffer.{ByteBuf, Unpooled}
import java.nio.ByteBuffer
trait Codec[T] {
val decodeByteBuffer: ByteBuffer => T =
bb => decode(Coded... |
Explain and rewrite the following Scala code: | /*
* tuProlog - Copyright (C) 2001-2002 aliCE team at deis.unibo.it
*
* 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; either
* version 2.1 of the License, or (at your option) any l... |
Explain and rewrite the following Scala code: | package com.github.etacassiopeia.s99.arithmetic
/**
* <h1>P34</h1>
* Calculate Euler's totient function phi(m)
* Euler's so-called totient function phi(m) is defined as the number[count] of positive integers r ( 1 <= r <= m)
* that are coprime to m
*
* @author Mohsen Zainalpour
* @version 1.0
* @since ... |
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 (C) 2016-2019 Lightbend Inc. <https://www.lightbend.com>
*/
package com.lightbend.lagom.dev
private[lagom] object StaticServiceLocations {
def staticServiceLocations(lagomCassandraPort: Int, lagomKafkaAddress: String): Map[String, String] = {
Map(
"cas_native" -> s"tcp://127.0.0.1:$lago... |
Explain and rewrite the following Scala code: | package ckite.kvstore.http
import java.net.InetSocketAddress
import ckite.CKite
import com.twitter.finagle.builder.ServerBuilder
import com.twitter.finagle.http.{Http, Request, RichHttp}
import com.twitter.util.Closable
import com.typesafe.config.ConfigFactory
class HttpServer(ckite: CKite) {
var closed = false
... |
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 vegas.DSL
import monocle.{Lens, Optional}
import monocle.macros.GenLens
import vegas.data.SimpleTypeUtils
import vegas.spec.Spec._
import vegas.macros.{alias_with_lens, aliased}
@aliased
trait EncoderDSL[T] extends BaseEncoderDSL[T] {
self: T =>
protected[this] def _encoding: Lens[T, Option[Encoding]]
... |
Explain and rewrite the following Scala code: | /*
* Copyright 2015 Netflix, 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: | /*
* Copyright 2014 Frugal Mechanic (http://frugalmechanic.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 notebook.server
import notebook.client.CalcRequest
import play.api.libs.json._
/**
* Author: Ken
*/
trait KernelMessage
case object RestartKernel extends KernelMessage
case object Shutdown extends KernelMessage
trait CalcServiceMessage
case class Unregister(ws:WebSockWrapper) extends CalcServiceMessage
ca... |
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: | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... |
Explain and rewrite the following Scala code: | package org.jetbrains.plugins.scala.failed.annotator
import org.jetbrains.plugins.scala.PerfCycleTests
import org.jetbrains.plugins.scala.base.ScalaLightCodeInsightFixtureTestAdapter
import org.junit.experimental.categories.Category
/**
* User: Dmitry.Naydanov
* Date: 27.03.16.
*/
@Category(Array(classOf[PerfCy... |
Explain and rewrite the following Scala code: | package asobu.distributed.gateway
import akka.actor.{Props, ActorSystem, ActorRef}
import akka.cluster.Cluster
import akka.cluster.metrics.AdaptiveLoadBalancingGroup
import akka.cluster.routing.{ClusterRouterGroupSettings, ClusterRouterGroup}
import akka.routing.{Group, RoundRobinGroup, FromConfig}
import scala.concu... |
Explain and rewrite the following Scala code: | package es.ucm.fdi.sscheck.spark.streaming.receiver
import org.apache.spark._
import org.apache.spark.streaming.{StreamingContext, Duration}
import org.apache.spark.streaming.dstream.{DStream, InputDStream}
import scala.reflect._
import org.apache.spark.streaming.receiver.ActorHelper
import org.apache.spark.s... |
Explain and rewrite the following Scala code: | package org.jetbrains.plugins.scala.codeInsight.template.impl
import com.intellij.psi.PsiWhiteSpace
import com.intellij.psi.impl.source.tree.LeafPsiElement
import org.jetbrains.plugins.scala.codeInsight.ScalaCodeInsightBundle
import org.jetbrains.plugins.scala.extensions.{&&, ObjectExt, Parent, PsiElementExt}
import o... |
Explain and rewrite the following Scala code: | /*
* Copyright 2017-2020 Aleksey Fomkin
*
* 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 ag... |
Explain and rewrite the following Scala code: | /*
* Copyright 2015 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 org.scalaide.ui.internal.preferences
import org.eclipse.jface.preference.FieldEditorPreferencePage
import org.eclipse.ui.IWorkbenchPreferencePage
import org.eclipse.ui.IWorkbench
import org.scalaide.core.IScalaPlugin
import org.eclipse.jface.preference.BooleanFieldEditor
/**
* Abstract base class for simple ... |
Explain and rewrite the following Scala code: | package upack
import java.io.ByteArrayOutputStream
import upickle.core.Util
import utest._
object MsgPackTests extends TestSuite{
val tests = Tests{
test("hello"){
for{
(k, v) <- unitCases.obj
if k != "50.timestamp.yaml"
testCase <- v.arr
packed0 <- testCase("msgpack").arr
... |
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: |
/** Test that constructor operations are reordered correctly. */
class Outer {
object global {
val x = 10;
}
class X extends AnyRef with M1 {
// TODO NEEDS MANUAL CHANGE (early initializers)
// BEGIN copied early initializers
val outer = Outer.this
// END copied early initializers
}
trait M1 { self: X ... |
Explain and rewrite the following Scala code: | package actor
import akka.actor.{Actor, Props}
import akka.pattern.{ask,pipe}
import scala.concurrent.Future
import redis.RedisClient
import scala.concurrent.ExecutionContext.Implicits.global
import util.SearchQueryParser
import scala.util.{Try, Success, Failure}
import akka.util.Timeout
import scala.concurrent.durati... |
Explain and rewrite the following Scala code: | // Generated by the Scala Plugin for the Protocol Buffer Compiler.
// Do not edit!
//
// Protofile syntax: PROTO3
package com.google.protobuf.api
object ApiProto extends _root_.scalapb.GeneratedFileObject {
lazy val dependencies: Seq[_root_.scalapb.GeneratedFileObject] = Seq(
com.google.protobuf.source_context.... |
Explain and rewrite the following Scala code: | import akka.actor.{ActorSystem, Actor, Props}
import akka.testkit.{ImplicitSender, TestKit}
import org.scalatest.{Suite, BeforeAndAfterAll}
import scala.concurrent.duration._
import akka.testkit._
abstract class ActorTest(_system: ActorSystem) extends TestKit(_system) with ImplicitSender with Suite with BeforeAndAfter... |
Explain and rewrite the following Scala code: | package net.revenj.patterns
trait ValidationErrors {
def registerError(path: String, message: String): Unit
def getValidationErrors: scala.collection.Map[String, scala.collection.Seq[String]]
} |
Explain and rewrite the following Scala code: | package io.udash.bindings.inputs
import io.udash._
import io.udash.testing.AsyncUdashFrontendTest
import scala.concurrent.duration.DurationInt
class TextAreaTest extends AsyncUdashFrontendTest {
"TextArea" should {
"synchronise state with property changes" in {
val p = Property[String]("ABC")
val i... |
Explain and rewrite the following Scala code: | import scala.util.parsing.combinator._
import scala.util.parsing.combinator.syntactical._
import scala.util.parsing.input._
case class Ident(name: String) extends Positional
case class Var(left: Ident, right: Any)
class MyParser extends StandardTokenParsers {
lexical.reserved += ("var", "true", "false")
lexical.d... |
Explain and rewrite the following Scala code: | package skidbladnir
import javax.swing.{JFrame, WindowConstants},
bsh.util.{GUIConsoleInterface,JConsole},
java.io.{BufferedReader,IOException},
java.awt.Color,
java.awt.event.{WindowAdapter, WindowEvent, KeyEvent},
scala.util.control.Exception,
com.sun.awt.AWTUtilities
... |
Explain and rewrite the following Scala code: | package io.getquill.norm
import io.getquill.Spec
import io.getquill.testContext.implicitOrd
import io.getquill.testContext.qr1
import io.getquill.testContext.qr2
import io.getquill.testContext.quote
import io.getquill.testContext.unquote
class NormalizeSpec extends Spec {
"normalizes random-generated queries" - {
... |
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 nbmtools
import java.io.Closeable
import java.io.FileInputStream
import java.io.FileOutputStream
import java.io.InputStream
import java.io.PrintStream
import java.net.URL
import java.util.zip.ZipOutputStream
import scala.util.Failure
import scala.util.Success
import scala.util.Try
class Internalize extends Co... |
Explain and rewrite the following Scala code: | /*
* # Trove
*
* This file is part of Trove - A FREE desktop budgeting application that
* helps you track your finances, FREES you from complex budgeting, and
* enables you to build your TROVE of savings!
*
* Copyright © 2016-2021 Eric John Fredericks.
*
* Trove is free software: you can redistribute it ... |
Explain and rewrite the following Scala code: | package org.pico.event
/** A SinkSource is both a Sink and a Source.
* Any events published to the SinkSource will have a transformation function applied to it
* before emitting the transformed event to subscribers.
*/
trait SinkSource[-A, +B] extends Sink[A] with Source[B]
object SinkSource {
def apply[A, B]... |
Explain and rewrite the following Scala code: | package hcube.scheduler
import hcube.scheduler.backend.Backend
import hcube.scheduler.backend.Backend._
import hcube.scheduler.job.Job
import hcube.scheduler.model.{ExecTrace, JobSpec, TriggerSpec}
import org.mockito.{Matchers => M}
import org.specs2.mock.{Mockito => MockitoSpecs2}
import org.specs2.mutable.Specificat... |
Explain and rewrite the following Scala code: | package im.actor.server.api.http.webhooks
import scala.concurrent.ExecutionContext
import scala.concurrent.duration._
import scala.concurrent.forkjoin.ThreadLocalRandom
import scala.util.{ Failure, Success }
import akka.http.scaladsl.model.HttpResponse
import akka.http.scaladsl.model.StatusCodes._
import akka.http.sc... |
Explain and rewrite the following Scala code: | package l3
import java.io.File
import java.util.Formatter
import PCRelativeASMInstructionModule._
/**
* Assembly program writer. Dumps a program to a textual file, in
* which each line is composed of an encoded instruction represented
* as a 32-bit hexadecimal value, followed by a textual representation
* of the ... |
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.nomadicalien.ch5
import org.specs2.mutable.Specification
class StreamSpec extends Specification {
"exercise 5.1, toList" in {
Stream(1, 2, 3, 4).toList must_== (List(1, 2, 3, 4))
}
"exercise 5.2, take" in {
Stream(1, 2, 3, 4).take(2).toList must_== (List(1, 2))
}
"exercise 5.2, drop" ... |
Explain and rewrite the following Scala code: | package views
import play.api.libs.json.{JsObject,JsString}
import play.api.i18n.{Messages,MessagesApi}
import scala.annotation.tailrec
/** Embeds translated messages in a JsObject.
*
* Usage:
* {{{
* val jsMessages = JsMessages(Seq(
* "views.DocumentSet._documentSet.jobs_to_process",
* "vie... |
Explain and rewrite the following Scala code: | /*
* Copyright 2013, by Vladimir Kostyukov and Contributors.
*
* This file is part of Quipu project (https://github.com/vkostyukov/quipu)
*
* 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 a... |
Explain and rewrite the following Scala code: | package com.sksamuel.elastic4s
import org.elasticsearch.search.suggest.SuggestBuilder
import org.elasticsearch.search.suggest.SuggestBuilder.SuggestionBuilder
import org.elasticsearch.search.suggest.completion.CompletionSuggestionBuilder
/** @author Stephen Samuel */
trait SuggestionDsl {
sealed trait Suggester[S ... |
Explain and rewrite the following Scala code: | /* __ *\\
** ________ ___ / / ___ Scala API **
** / __/ __// _ | / / / _ | (c) 2003-2010, LAMP/EPFL **
** __\\ \\/ /__/ __ |/ /__/ __ | **
** /____/\\___/_/... |
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 org.jetbrains.sbt.resolvers.indexes
import com.intellij.openapi.progress.ProgressIndicator
import org.jetbrains.plugins.scala.project.ProjectContext
/**
* @author Mikhail Mutcianko
* @since 26.08.16
* @usecase if maven plugin is not enabled
*/
class FakeMavenIndex (val root: String, val name: String) e... |
Explain and rewrite the following Scala code: | package org.jetbrains.plugins.scala.failed.typeInference
import org.jetbrains.plugins.scala.PerfCycleTests
import org.jetbrains.plugins.scala.base.ScalaLightCodeInsightFixtureTestAdapter
import org.junit.experimental.categories.Category
/**
* @author mucianm
* @since 07.04.16.
*/
@Category(Array(classOf[PerfCy... |
Explain and rewrite the following Scala code: | package scala.slick.test.ql
import org.junit.Test
import org.junit.Assert._
import scala.slick.ql._
import scala.slick.ql.TypeMapper._
import scala.slick.driver.{BasicTable => Table}
import scala.slick.session._
import scala.slick.session.Database.threadLocalSession
import scala.slick.testutil._
import scala.slick.tes... |
Explain and rewrite the following Scala code: | import sbt._, Keys._
import com.typesafe.tools.mima.plugin.MimaPlugin
import com.typesafe.tools.mima.plugin.MimaKeys._
object MimaSettings {
// TODO: Enable this after 3.4.0 release
// val previousVersions = Set(0).map(patch => s"3.4.$patch")
val previousVersions: Set[String] = Set.empty
val mimaSettings = M... |
Explain and rewrite the following Scala code: | package tw.com.chttl.spark.core.util
/**
* Created by leorick on 2015/11/12.
*/
object IntParaTest {
def unapplyTest() = {
val IntPara(v1) = "12"
assert(v1 == 12)
}
}
|
Explain and rewrite the following Scala code: | package spark
import java.util.concurrent.atomic.AtomicInteger
sealed trait CachePutResponse
case class CachePutSuccess(size: Long) extends CachePutResponse
case class CachePutFailure() extends CachePutResponse
/**
* An interface for caches in Spark, to allow for multiple implementations. Caches are used to store
... |
Explain and rewrite the following Scala code: | package scalax.collection.constrained
import scalax.collection.GraphPredef.{EdgeLikeIn}
import scalax.collection.GraphEdge.{EdgeCompanionBase}
import scalax.collection.io._
/**
* Template for stream-based operations such as instantiation through
* a stream-based auxiliary constructor.
*
* @tparam N ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.