instruction stringclasses 1
value | output stringlengths 5 1M |
|---|---|
Explain and rewrite the following Scala code: | package com.twitter.finagle.thrift
import com.twitter.finagle.{Filter, Service, SimpleFilter, ThriftMux}
import com.twitter.finagle.benchmark.StdBenchAnnotations
import com.twitter.finagle.benchmark.thriftscala._
import com.twitter.util.{Await, Future}
import com.twitter.finagle.param
import com.twitter.finagle.stats.... |
Explain and rewrite the following Scala code: | package org.jetbrains.plugins.scala.testingSupport.scalatest.scala2_10.scalatest2_1_7
import org.jetbrains.plugins.scala.SlowTests
import org.jetbrains.plugins.scala.testingSupport.scalatest.finders.FindersApiTest
import org.junit.experimental.categories.Category
/**
* @author Roman.Shein
* @since 10.02.2015.
*/
@... |
Explain and rewrite the following Scala code: | package models.user
import models.game.{Gamification, Games}
import models.organization.Courses
import models.quiz.question._
import models.support.{CourseId, UserId}
import org.joda.time.DateTime
import play.api.db.slick.Config.driver.simple.Session
import service.Logins
case class User(id: UserId, consented: Boolea... |
Explain and rewrite the following Scala code: | /*
* Copyright (C) Lightbend Inc. <https://www.lightbend.com>
*/
package play.core.j
import play.mvc.{ ResponseHeader => JResponseHeader }
import scala.annotation.varargs
import scala.collection.JavaConverters
import scala.language.reflectiveCalls
object JavaResultExtractor {
@varargs
def withHeader(responseH... |
Explain and rewrite the following Scala code: | package com.wavesplatform.it.sync
import com.typesafe.config.Config
import com.wavesplatform.block.Block
import com.wavesplatform.common.state.ByteStr
import com.wavesplatform.common.utils.Base58
import com.wavesplatform.crypto
import com.wavesplatform.crypto.Blake2b256
import com.wavesplatform.it.api.SyncHttpApi._
im... |
Explain and rewrite the following Scala code: | package com.tribbloids.spookystuff.utils
import org.slf4j.LoggerFactory
import scala.collection.mutable.ArrayBuffer
case class Stopwatch() {
@volatile var _name: String = _
def nameOpt: Option[String] = Option(_name)
@volatile var start: Long = _
lazy val splitHistory: ArrayBuffer[Long] = ArrayBuffer.empt... |
Explain and rewrite the following Scala code: | package mrpolyonymous.problem3
import org.openjdk.jmh.annotations.Benchmark
class Problem3 {
// Some JMH benchmarking of factorization methods.
@Benchmark
def longSmallFactorization(): Seq[Long] = {
Problem3.primeFactorization(60)
}
@Benchmark
def bigIntSmallFactorization(): Seq[BigInt] = {
Probl... |
Explain and rewrite the following Scala code: | package mesosphere.marathon.integration
import mesosphere.marathon.integration.setup.{ IntegrationFunSuite, SingleMarathonIntegrationTest }
import org.scalatest._
class EventSubscribersIntegrationTest
extends IntegrationFunSuite
with SingleMarathonIntegrationTest
with Matchers
with BeforeAndAfter
... |
Explain and rewrite the following Scala code: | package fpinscala.datastructures
sealed trait List[+A] // `List` data type, parameterized on a type, `A`
case object Nil extends List[Nothing] // A `List` data constructor representing the empty list
case class Cons[+A](head: A, tail: List[A]) extends List[A] // Another data constructor, representing nonempty lists. N... |
Explain and rewrite the following Scala code: | package com.github.jeanadrien.evrythng.scala.json
/**
* {
* "evrythngUser": Ref,
* "activationCode": String,
* "status": String,
* "email": String
* }
*/
case class UserStatus(
evrythngUser : Option[Ref] = None,
evrythngApiKey : Option[String] = None,
activationCode : Option[String]... |
Explain and rewrite the following Scala code: | package colossus.extensions.protocols.mongo
import java.nio.ByteOrder
import akka.util.ByteString
import colossus.extensions.protocols.mongo.command._
import colossus.extensions.util.bson.BsonDsl._
import colossus.extensions.util.bson.Implicits._
import org.scalatest.{FlatSpec, Matchers}
class CommandSpec extends Fl... |
Explain and rewrite the following Scala code: | package com.karasiq.bootstrap.tooltip
import com.karasiq.bootstrap.context.RenderingContext
trait TooltipStyles { self: RenderingContext ⇒
import scalaTags.all._
final class TooltipPlacement private[tooltip](val placement: String) {
override def toString: String = placement
}
//noinspection TypeAnnotati... |
Explain and rewrite the following Scala code: | /*
* Scala.js (https://www.scala-js.org/)
*
* Copyright EPFL.
*
* Licensed under Apache License 2.0
* (https://www.apache.org/licenses/LICENSE-2.0).
*
* See the NOTICE file distributed with this work for
* additional information regarding copyright ownership.
*/
package org.scalajs.testsuite.jsinterop
impor... |
Explain and rewrite the following Scala code: | package com.karasiq.tls
import java.io.{FileOutputStream, InputStream, OutputStream}
import java.security.KeyStore
import com.karasiq.tls.TLS.{Certificate, CertificateChain, CertificateKey, KeySet}
import com.karasiq.tls.TLSKeyStore.{CertificateEntry, KeyEntry}
import com.karasiq.tls.internal.BCConversions._
import c... |
Explain and rewrite the following Scala code: | package models
import models.entities.{SeatType, ShowAvailability}
object AvailabilityFormat {
def format(availability: ShowAvailability): String = {
availability.byType(SeatType.Normal) match {
case quantity if quantity <= 0 => "Uitverkocht"
case 1 => "Nog 1 plaats"
case other => s"Nog $other... |
Explain and rewrite the following Scala code: | package io.chymyst.util
import scala.language.higherKinds
trait LabeledType[X] {
type T
/** Convert a collection of raw type `X` into a collection of labeled type.
* This does not iterate over the collection and does not allocate memory.
*
* @param xs A collection of raw type.
* @tparam F The col... |
Explain and rewrite the following Scala code: | package org.etl.process.onethread
import com.typesafe.scalalogging.LazyLogging
import org.etl.command.Context
import org.etl.command.Action
import org.etl.command.CommandProxy
import org.etl.util.ResourceAccess
import org.json.JSONObject
import org.json.JSONArray
import in.chimera.httpclient.ChimeraRestClient
import i... |
Explain and rewrite the following Scala code: | package chaplin
import java.io.{ BufferedReader, Reader }
trait Reading {
def readAll(reader: Reader): String = {
@annotation.tailrec
def read(br: BufferedReader, ls: List[String]): String =
br.readLine match {
case null =>
br.close()
ls.reverse.mkString("\\n")
case... |
Explain and rewrite the following Scala code: | /* **************************************************************************
* *
* Copyright (C) 2011-2012 Peter Kossek, Nils Foken, Christian Krause *
* *
* Pete... |
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 2018 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: | /** This file is part of TextCompose, a program for producing PDF from text files.
* Copyright 2014 Jesper S Villadsen <jeschvi@gmail.com>
* License: GNU Affero General Public License version 3 or later.
* For full license text see LICENSE.txt or <http://www.gnu.org/licenses/>.
*/
package textcompose.core
im... |
Explain and rewrite the following Scala code: | package model.form
import model.json.LoginJson
import play.api.data.Form
import play.api.data.Forms._
/**
* @author Camilo Sampedro <camilo.sampedro@udea.edu.co>
*/
object LoginForm {
val form = Form(
mapping(
"username" -> nonEmptyText,
"password" -> nonEmptyText
)(LoginJson.apply)(LoginJso... |
Explain and rewrite the following Scala code: | /*
* Copyright 2017 PayPal
*
* 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 writin... |
Explain and rewrite the following Scala code: | package com.sg.pnx
import com.sg.pnx.math.Math
import System.nanoTime
/**
* Created by bodie on 7/19/14.
*/
object Test extends App {
val numIterations = 100000
println("Remap Test - " + testRemap(550, 0.5f))
println("Lerp Test - " + testLerp(0.372f, 372))
println("Fast Sin Test A - Roots - " + testFastSin... |
Explain and rewrite the following Scala code: | package mailer.impl
import mailer.MailerComponent
import org.apache.commons.mail.{DefaultAuthenticator, HtmlEmail};
trait GmailerComponent extends MailerComponent{
val mailer = new Gmailer
class Gmailer extends Mailer{
private val username = System.getenv("EMAIL_USER_NAME")
private val password = System.... |
Explain and rewrite the following Scala code: | package com.mesosphere.universe.common
import java.nio.ByteBuffer
object ByteBuffers {
def getBytes(bb: ByteBuffer): Array[Byte] = {
if (bb.hasArray){
bb.array()
} else {
//the index of the first byte in the backing byte array of this ByteBuffer.
//if there isn't a backing byte array, the... |
Explain and rewrite the following Scala code: | /*
* Copyright 2013 TeamNexus
*
* TeamNexus Licenses this file to you under the MIT License (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://opensource.org/licenses/mit-license.php
*
* Unless required by applicable law ... |
Explain and rewrite the following Scala code: | package org.scaladebugger.api.lowlevel.breakpoints
import org.scalamock.scalatest.MockFactory
import org.scalatest.{FunSpec, Matchers, ParallelTestExecution}
import org.scaladebugger.api.lowlevel.requests.JDIRequestArgument
import org.scaladebugger.api.utils.{ActionInfo, PendingActionManager}
import org.scaladebugger.... |
Explain and rewrite the following Scala code: | package lila.forum
import akka.actor._
import com.typesafe.config.Config
import lila.common.DetectLanguage
import lila.common.PimpedConfig._
import lila.hub.actorApi.forum._
import lila.mod.ModlogApi
import lila.notify.NotifyApi
import lila.relation.RelationApi
final class Env(
config: Config,
db: lila.db.En... |
Explain and rewrite the following Scala code: | /*
* Copyright (C) 2009-2017 Lightbend Inc. <https://www.lightbend.com>
*/
package play.core.server.netty
import org.reactivestreams.{ Processor, Publisher, Subscription, Subscriber }
object SynchronousMappedStreams {
private class SynchronousContramappedSubscriber[A, B](subscriber: Subscriber[_ >: B], f: A => B... |
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: | option match {
do{
println("1. Suma")
println("2. Resta")
println("3. Dividir")
println("4. Multiplicar")
println("5. Adios")
case 1 => sumaFraccion()
case 2 => restaFraccion()
case 3 => divirFraccion()
case 4 => multiplicarFraccion()
case default => println("Adios")
}
}
var continuar = 'S'
var i = 1
do {
var numer... |
Explain and rewrite the following Scala code: | package at.junction.api
import com.joshcough.minecraft.{ListenersPlugin, ScalaPlugin}
import at.junction.api.rest.RestApi
import at.junction.api.bus.{BusOptions, BusEvents, Bus}
import org.bukkit.event.{EventHandler, Listener}
import at.junction.api.bus.events._
import akka.actor.ActorSystem
import com.typesafe.config... |
Explain and rewrite the following Scala code: | /*
* Copyright 2001-2014 Artima, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agre... |
Explain and rewrite the following Scala code: | /*
* 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.nephtys.keepaseat
import org.nephtys.keepaseat.internal.eventdata.{Event, EventElementBlock}
import org.nephtys.keepaseat.internal.testmocks.MockDatabase
import org.scalatest._
import scala.concurrent.{Await, Future}
import scala.concurrent.duration.Duration
/**
* Created by nephtys on 10/4/16.
*/
cl... |
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 org.embulk.parser.firebase_avro.define
import org.embulk.parser.firebase_avro.define.root._
case class Root(user_dim: Option[User_Dim], event_dim: List[Event_Dim])
|
Explain and rewrite the following Scala code: | package fpinscala.testing
import fpinscala.laziness.Stream
import fpinscala.state._
import fpinscala.parallelism._
import fpinscala.parallelism.Par.Par
import Gen._
import Prop._
import java.util.concurrent.{Executors,ExecutorService}
/*
The library developed in this chapter goes through several iterations. This file... |
Explain and rewrite the following Scala code: | package kuyfi
import java.time.zone.ZoneOffsetTransitionRule
import java.time.zone.ZoneOffsetTransitionRule.TimeDefinition
import java.time.{ DayOfWeek, LocalDateTime, LocalTime, Month, ZoneOffset }
import kuyfi.TZDB._
class TZDBOptimizedCodeGeneratorSuite extends munit.FunSuite {
import TZDBCodeGenerator.Optimized... |
Explain and rewrite the following Scala code: | package org.juitar.util.time
class IncompatibleSeriesException(reportedSeries: String, currentSeries: String)
extends RuntimeException(s"'$reportedSeries' cannot be added to series '$currentSeries'")
|
Explain and rewrite the following Scala code: | package com.ing.baker.runtime.akka
import java.util.{List => JavaList}
import akka.actor.{Actor, ActorRef, ActorSystem, Address, Props}
import akka.pattern.{FutureRef, ask}
import akka.util.Timeout
import cats.data.NonEmptyList
import cats.implicits._
import com.ing.baker.il._
import com.ing.baker.il.failurestrategy.... |
Explain and rewrite the following Scala code: | package provingground.learning
import spire.algebra._
import spire.implicits._
import scala.collection.parallel._, immutable.ParVector
object ParGramSchmidt {
def dotProd(v1: ParVector[Double], v2: ParVector[Double]) =
v1.zip(v2).map { case (x, y) => x * y }.sum
def normalize(v: ParVector[Double]) = {
va... |
Explain and rewrite the following Scala code: | package colossus.core
import scala.concurrent.duration._
import akka.actor.ActorRef
/**
* This trait must be implemented by any non-head member of a pipeline.
*/
trait HasUpstream[T] {
private var _upstream: Option[T] = None
def setUpstream(up: T) {
_upstream = Some(up)
}
lazy val upstream = _upstream... |
Explain and rewrite the following Scala code: | package com.github.tototoshi.play2.auth.social.providers.github
case class GitHubUser(
id: Long,
login: String,
avatarUrl: String,
accessToken: String)
|
Explain and rewrite the following Scala code: | package org.http4s
package multipart
import cats.effect._
import cats.implicits.{catsSyntaxEither => _, _}
import fs2._
import scala.annotation.tailrec
import scodec.bits.ByteVector
/** A low-level multipart-parsing pipe. Most end users will prefer EntityDecoder[Multipart]. */
object MultipartParser {
private[thi... |
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: | /*
* 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 macros
import scala.language.experimental.macros
import scala.reflect.macros.Context
object Foo {
def bar(a: Any): Any = macro impl
def impl(c: Context)(a: c.Expr[Any]): c.Expr[Any] = a
}
|
Explain and rewrite the following Scala code: | package com.socrata.datacoordinator.util
import java.io.Closeable
trait CloseableIterator[+T] extends Iterator[T] with Closeable
object CloseableIterator {
val empty: CloseableIterator[Nothing] = new CloseableIterator[Nothing] {
def hasNext = false
def next() = Iterator.empty.next()
def close() {}
}
... |
Explain and rewrite the following Scala code: | package com.campudus.tableaux.database
sealed trait ReturnType
case object GetReturn extends ReturnType
case object EmptyReturn extends ReturnType
|
Explain and rewrite the following Scala code: | package teststate.data
sealed abstract class Failure[+A] {
val failure: A
def cause: Option[Throwable]
def map[B](f: A => B): Failure[B]
}
object Failure {
final case class NoCause[+A](failure: A) extends Failure[A] {
override def cause = None
override def map[B](f: A => B) = NoCause(f(failure))
}
... |
Explain and rewrite the following Scala code: | /*
* Copyright 2013 http4s.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 law or agreed to i... |
Explain and rewrite the following Scala code: | package scutil.codec
import minitest._
object URIComponentTest extends SimpleTestSuite {
test("URIComponent should roundtrip all usual chars (low)") {
val str = '\\u0000' to '\\ud7ff' map { _.toChar } mkString ""
val enc = URIComponent.utf_8 encode str
val dec = URIComponent.utf_8 decode enc
assertEquals(dec... |
Explain and rewrite the following Scala code: | package pl.project13.scala.akka.raft
import akka.actor.ActorRef
import model._
import protocol._
import config.RaftConfig
private[raft] trait Leader {
this: RaftActor =>
protected def raftConfig: RaftConfig
private val HeartbeatTimerName = "heartbeat-timer"
val leaderBehavior: StateFunction = {
case E... |
Explain and rewrite the following Scala code: | /**
* Original work: SecureSocial (https://github.com/jaliss/securesocial)
* Copyright 2013 Brian Porter (poornerd at gmail dot com) - twitter: @poornerd
*
* Derivative work: Silhouette (https://github.com/mohiva/play-silhouette)
* Modifications Copyright 2015 Mohiva Organisation (license at mohiva dot com)
*
* ... |
Explain and rewrite the following Scala code: | package org.kostaskougios.idea
import com.intellij.openapi.module.ModuleManager
import com.intellij.openapi.project.ProjectManager
import org.kostaskougios.idea.scripts.ScriptsManager
import org.scalatest.{BeforeAndAfterAll, FunSuite, Matchers}
/**
* @author kostas.kougios
* Date: 05/08/14
*/
class Base... |
Explain and rewrite the following Scala code: | /*
* Copyright (C) 2016 VSCT
*
* 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 writ... |
Explain and rewrite the following Scala code: | package chap3
object Exe14 extends App {
assert(List.append(List(1, 2, 3), 1) == List(1, 2, 3, 1))
}
|
Explain and rewrite the following Scala code: | /*
* Copyright 2013 Maurício Linhares
*
* Maurício Linhares licenses this file to you 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 ... |
Explain and rewrite the following Scala code: | package eventstore.util
import org.specs2.mutable.Specification
import scala.concurrent.duration._
class DelayedRetrySpec extends Specification with NoConversions {
"DelayedRetry.opt" should {
"return none if 0 retries" in {
DelayedRetry.opt(0, 1.second, 1.second) must beNone
}
"return some if -1... |
Explain and rewrite the following Scala code: | /**
* Copyright 2017-2018 Alexis Seigneurin.
*
* 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: | package intellij.haskell.refactor
import java.util
import com.intellij.psi.PsiElement
import com.intellij.refactoring.listeners.RefactoringElementListener
import com.intellij.refactoring.rename.RenamePsiElementProcessor
import intellij.haskell.annotator.HaskellAnnotator
import intellij.haskell.external.component.Hask... |
Explain and rewrite the following Scala code: | /*
* The MIT License (MIT)
*
* Copyright (c) 2015 Enterprise Data Management Council
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation... |
Explain and rewrite the following Scala code: | import sbt._
object Dependencies {
val mesosVersion = sys.props.getOrElse("mesos.version", "0.22.0") //0.22.0 is current DCOS version
val playDeps = Seq(
"com.typesafe.play" %% "play" % "2.3.7" withSources() excludeAll(
ExclusionRule("com.typesafe.akka"),
ExclusionRule("com.google.guava")
),... |
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 IntLis... |
Explain and rewrite the following Scala code: | package sample
import scopt.OptionParser
import sample.model.Model
object OptionParserMain {
case class Config(
h: Boolean = false,
profile: String = "profile"
)
def main(args: Array[String]):Unit = {
println("Main")
args.foreach { arg =>
println("arg=" + arg)
}
val currentDir =... |
Explain and rewrite the following Scala code: | package com.lynbrookrobotics.potassium.lighting
import com.lynbrookrobotics.potassium.streams.Stream
import com.lynbrookrobotics.potassium.tasks.ContinuousTask
/**
* Continuous Task that you feed a communicator and an rgb value.
* Defaults to black onEnd
*/
class DisplayLighting(signal: Stream[Int], lightingCompon... |
Explain and rewrite the following Scala code: | package fr.igpolytech.bernads.cleanning
import org.apache.spark.sql.DataFrame
object Implicit {
def cleanDataFrame(dataFrame: DataFrame)(implicit dataCleaner: DataCleaner): DataFrame = {
dataCleaner.clean(dataFrame)
}
}
|
Explain and rewrite the following Scala code: | package ua.ds.persistent
import scala.annotation.tailrec
import scala.collection.AbstractIterator
import scala.collection.mutable.ArrayBuffer
sealed trait List[+T] {
self =>
import List._
def scan[A](init: A)(operation: (A, T) => A): List[A] = this match {
case Nil => Nil
case Cons(elem,... |
Explain and rewrite the following Scala code: | /****************************************************************************
* Copyright Fabien Sartor
* Contributors: Fabien Sartor (fabien.sartor@gmail.com)
* http://fasar.fr
*
* This software is a computer program whose purpose to compute differences
* between two files.
*
****************... |
Explain and rewrite the following Scala code: | package org.oseraf.bullseye.service.DataService
import com.thinkaurelius.titan.core.TitanFactory
import com.tinkerpop.blueprints._
import com.typesafe.config.Config
import org.apache.commons.configuration.BaseConfiguration
import org.oseraf.bullseye.service.Service
import scala.collection.JavaConversions._
trait Gra... |
Explain and rewrite the following Scala code: | package psyco.scala.akka
import akka.Main
import akka.actor.{Actor, Props}
/**
* Created by lipeng on 15/7/24.
*/
class DataStream
{
var data: Int = 0
val isDone: Boolean = false
}
case class DataTrue() extends DataStream {
override val isDone: Boolean = true
}
case class DataFalse() extends DataStream {... |
Explain and rewrite the following Scala code: | package net.nomadicalien.ch2
import java.util.{Calendar, Date}
/**
* Scala case classes, which are immutable by default
*/
object Listing2_10 {
sealed trait Account
case class SavingsAccount(number: String, name: String, dateOfOpening: Date, rateOfInterest: BigDecimal)
extends Account
val today = Cal... |
Explain and rewrite the following Scala code: | /**
* Copyright (C) 2016 Nicola Justus <nicola.justus@mni.thm.de>
*
* 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 de.thm.move
import java.net.URL
im... |
Explain and rewrite the following Scala code: | package team16.euler
/**
* Maximum path sum I
* Problem 18
*
* By starting at the top of the triangle below and moving to adjacent numbers on the row below,
* the maximum total from top to bottom is 23.
*
* 3
* 7 4
* 2 4 6
* 8 5 9 3
*
* That is, 3 + 7 + 4 + 9 = 23.
*
* Find the maxim... |
Explain and rewrite the following Scala code: | type Callback[T] = Function1[T, Unit]
val x : Callback[Int] = y => println(/*start*/y/*end*/ + 2)
//Int |
Explain and rewrite the following Scala code: | /**
* Copyright 2013 Gianluca Amato <gamato@unich.it>
*
* This file is part of JANDOM: JVM-based Analyzer for Numerical DOMains
* JANDOM 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 o... |
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 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: | package com.github.j5ik2o.reactive.redis.parser
import java.util.concurrent.TimeUnit
import StringParsers._
import com.github.j5ik2o.reactive.redis.parser.util.instance.Reference
import org.openjdk.jmh.annotations._
import fastparse.all._
@SuppressWarnings(Array("org.wartremover.warts.Null", "org.wartremover.warts.V... |
Explain and rewrite the following Scala code: |
class OJ() extends Any {
}
object AutoAC{
def getPage(url) : String = {
}
} |
Explain and rewrite the following Scala code: | package com.goibibo.sqlshift.offsetmanagement.zookeeper
import java.util.Properties
import com.goibibo.dp.utils.ZkUtils
import com.goibibo.sqlshift.models.Configurations.Offset
import com.goibibo.sqlshift.offsetmanagement.{OffsetManager, ServiceConnectionException}
import org.apache.zookeeper.ZooKeeper
import org.jso... |
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 imp
object Decompile extends DecompileBase {
val ClassPath = "jvm/target/scala-2.13/test-classes"
}
|
Explain and rewrite the following Scala code: | import sbt._
object Version {
val scala = "2.13.3"
val akka = "2.5.29"
val akkaHttp = "10.1.11"
val javaxWsRs = "1.1.1"
val rdf4j = "2.1.6" //"2.3.2"
val logback = "1.2.3"
val scalaTest = "3.0.8"
val fuseki = "3.7.0"
val xmlBind = "2.3.2"
}
object Dependencies {
v... |
Explain and rewrite the following Scala code: | package org.apache.spark.sql.cassandra
import java.sql.Timestamp
import java.util.Date
import com.datastax.driver.core.{Row, ProtocolVersion}
import com.datastax.spark.connector.AbstractGettableData
import com.datastax.spark.connector.rdd.reader.{ThisRowReaderAsFactory, RowReader}
import com.datastax.spark.connector.... |
Explain and rewrite the following Scala code: | package de.htwg.scala.person
case class Person(name:String, birthdate:Date) extends Ordered[Person]{
override def compare(that: Person) = this.age - that.age
def age = birthdate.fullYearsSince
def age(date:Date) = birthdate.fullYearsSince(date)
} |
Explain and rewrite the following Scala code: | package rpm4s.cli.commands
object version {
def apply(): Unit = {
val output =
s"""|Version: ${rpm4s.cli.BuildInfo.version}
|Commit: ${rpm4s.cli.BuildInfo.commit}""".stripMargin
println(output)
}
}
|
Explain and rewrite the following Scala code: | /*
* Copyright 2012-2013 Eligotech BV.
*
* 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 com.datastax.spark.connector.embedded
import java.io.{PrintWriter, StringWriter, StringReader, BufferedReader}
import java.net.URLClassLoader
import scala.collection.mutable.ArrayBuffer
import org.apache.spark.repl.SparkILoop
trait SparkRepl {
def runInterpreter(master: String, input: String): String = {
... |
Explain and rewrite the following Scala code: | package com.github.fellowship_of_the_bus
package bruteb
import models._
import org.scaloid.common._
import android.os.Bundle
import android.view.{Gravity, View, KeyEvent}
import android.view.inputmethod.EditorInfo
import android.widget.{GridView, ImageView, AdapterView, AbsListView, TextView}
import android.content.... |
Explain and rewrite the following Scala code: | package gmodlab
class Log(text0:String, style:String) extends swing.EditorPane("text/html", text0) with ul.GetTextable {
val errLog = this
editable = false;
text = "<html><head><title></title><style type='text/css'>" + style + "</style></head><body><font face='Monospaced'><span id='Text'> </spa... |
Explain and rewrite the following Scala code: | import core._
import org.scalatest.{Inside, MustMatchers, TryValues, WordSpec}
import scala.util.Try
class StartedGameScalaTest extends WordSpec with TryValues with MustMatchers with Inside {
val boardLines = """
| e o o o
| d o o o o
|c o o o o o
... |
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: | package zzz.akka.investigation
import akka.actor.ActorSystem
import akka.testkit.{TestKit, ImplicitSender}
import java.util.concurrent.atomic.AtomicInteger
object ActorSys {
val uniqueId = new AtomicInteger(0)
}
class ActorSys(name: String) extends TestKit(ActorSystem(name))
with ImplicitSender
with DelayedInit {
... |
Explain and rewrite the following Scala code: | package io.github.tailhq.dynaml.tensorflow.dynamics
import io.github.tailhq.dynaml.pipes.DataPipe
import org.platanios.tensorflow.api._
import org.platanios.tensorflow.api.core.types.{IsNotQuantized, TF}
import org.platanios.tensorflow.api.learn.layers.Layer
private[dynamics] case class CoordinateTransform[I, J, D: ... |
Explain and rewrite the following Scala code: | package epic.dense
import scala.runtime.ScalaRunTime
import breeze.linalg._
import epic.features.SegmentedIndex
import epic.framework.Feature
import scala.collection.mutable.HashMap
import scala.util.Random
/**
* Used at the input layer to cache lookups and the result of applying
* the affine transform at the first... |
Explain and rewrite the following Scala code: | package au.id.cxd.math.function.transform
import breeze.linalg.{DenseMatrix, DenseVector}
/**
* The data will be transformed using the empircal mean and approximate variance to create
* a spherical result.
*
* The standardised normalisation will store the parameters \\hat{mu} and \\hat{sigma}
*
* Created ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.