instruction stringclasses 1
value | output stringlengths 5 1M |
|---|---|
Explain and rewrite the following Scala code: | // Copyright: 2010 - 2018 https://github.com/ensime/ensime-server/graphs
// License: http://www.gnu.org/licenses/lgpl-3.0.en.html
package spray.json
import org.scalatest._
import shapeless._
import java.util.UUID
// Example domain models used in the tests. Note that the domain model
// and formatters are defined in s... |
Explain and rewrite the following Scala code: | package org.jetbrains.plugins.dotty.project
import java.awt.event.{ActionEvent, ActionListener}
import com.intellij.openapi.roots.libraries.ui.{LibraryEditorComponent, LibraryPropertiesEditor}
import com.intellij.openapi.ui.Messages
import org.jetbrains.plugins.dotty.project.template.DottyDownloader
import org.jetbra... |
Explain and rewrite the following Scala code: | package mesosphere.util
import akka.actor.Terminated
import com.codahale.metrics.MetricRegistry
import mesosphere.marathon.MarathonSpec
import mesosphere.marathon.integration.setup.WaitTestSupport
import mesosphere.marathon.metrics.Metrics
import mesosphere.marathon.test.MarathonActorSupport
import org.scalatest.concu... |
Explain and rewrite the following Scala code: | package epfl
object TestSensorReader {
import SensorReader._
val s1 = new Sensor { val label = "sensor1" }
val s2 = new Sensor { val label = "sensor2" }
def main(args: Array[String]) = {
val d1 = new Display
val d2 = new Display
s1.subscribe(d1)
s1.subscribe(d2)
s2.subscribe(d1)
s1.chan... |
Explain and rewrite the following Scala code: | package com.readclosely.snippet
/*
Copyright 2009-2010 Karl Pichotta
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... |
Explain and rewrite the following Scala code: | package com.citechnical.model.financial
import org.scalatest.junit.JUnitRunner
import org.junit.runner.RunWith
import org.scalatest.matchers.ShouldMatchers
import org.scalatest.Spec
import com.citechnical.constant._
@RunWith(classOf[JUnitRunner])
class FinancialTests extends Spec with ShouldMatchers {
describe("Mon... |
Explain and rewrite the following Scala code: | package org.http4s
package headers
import org.http4s.parser.HttpHeaderParser
import org.http4s.util.Writer
object Host extends HeaderKey.Internal[Host] with HeaderKey.Singleton {
def apply(host: String, port: Int): Host = apply(host, Some(port))
override def parse(s: String): ParseResult[Host] =
HttpHeaderPa... |
Explain and rewrite the following Scala code: | package info.glennengstrand.news
import java.util.Date
import java.util.logging.Logger
import info.glennengstrand.io._
/** helper functions for inbound object creation */
object Inbound {
val log = Logger.getLogger("info.glennengstrand.news.Inbound")
val reader: PersistentDataStoreReader = new CassandraReader
... |
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: | /*
* ============= Ryft-Customized BSD License ============
* Copyright (c) 2015, Ryft Systems, Inc.
* All rights reserved.
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must... |
Explain and rewrite the following Scala code: | package wakfutcp.protocol.messages.server
import java.nio.ByteBuffer
import wakfutcp.protocol.common.Position
import wakfutcp.protocol.{Decoder, ServerMessage}
final case class FightersPlacementPositionMessage(
fightId: Int,
fighters: Array[FighterPosition],
shouldTeleport: Boolean
) extends ServerMessage {
... |
Explain and rewrite the following Scala code: | /*
* ElementCollection.scala
* Element collections.
*
* Created By: Avi Pfeffer (apfeffer@cra.com)
* Creation Date: Jan 1, 2009
*
* Copyright 2013 Avrom J. Pfeffer and Charles River Analytics, Inc.
* See http://www.cra.com or email figaro@cra.com for information.
*
* See http://www.github.com/p2t2/f... |
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 scala.slick.driver
import scala.slick.SlickException
import scala.slick.lifted._
import scala.slick.ast._
import scala.slick.ast.TypeUtil._
import scala.slick.util.MacroSupport.macroSupportInterpolation
import scala.slick.profile.{RelationalProfile, SqlProfile, Capability}
import scala.slick.compiler.{Phase, Q... |
Explain and rewrite the following Scala code: | /*
*
* * Copyright 2020 Lenses.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 app... |
Explain and rewrite the following Scala code: | package org.littlewings.javaee7.jotm
import java.rmi.registry.LocateRegistry
import javax.naming.InitialContext
import org.enhydra.jdbc.standard.StandardXADataSource
import org.h2.Driver
import org.littlewings.javaee7.standalonejta.StandaloneJtaSpecSupport
import org.objectweb.jotm.Jotm
class JotmJtaSpec extends Sta... |
Explain and rewrite the following Scala code: | /*
* Copyright 2016 The BigDL Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agr... |
Explain and rewrite the following Scala code: | package org.scalamu.core.compilation
import org.scalamu.common.filtering.InverseRegexFilter
object IgnoreCoverageStatementsFilter extends InverseRegexFilter(Seq("org.scalamu.compilation.ForgetfulInvoker.*".r))
|
Explain and rewrite the following Scala code: | package im.actor.server.encryption
import cats.Foldable
import cats.data.Xor, Xor._
import cats.instances.all._
import cats.syntax.all._
import com.google.protobuf.ByteString
import im.actor.api.rpc.encryption.{ ApiEncryptionKeySignature, ApiEncryptionKeyGroup, ApiEncryptionKey }
import im.actor.server.model.encryptio... |
Explain and rewrite the following Scala code: | /*
* Copyright 2016 The BigDL Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agr... |
Explain and rewrite the following Scala code: | package chrome.alarms
import chrome.alarms.bindings.{AlarmInfo, Alarm}
import chrome.events.EventSource
import chrome.events.EventSourceImplicits._
import chrome.utils.ErrorHandling._
import scala.concurrent.{Future, Promise}
import scala.scalajs.js
object Alarms {
val onAlarm: EventSource[Alarm] = bindings.Alarm... |
Explain and rewrite the following Scala code: | package com.karasiq.shadowcloud.storage.repository.wrappers
import akka.NotUsed
import akka.stream.scaladsl.{Flow, Keep, Sink, Source}
import com.karasiq.shadowcloud.storage.StorageIOResult
import com.karasiq.shadowcloud.storage.repository.{CategorizedRepository, Repository}
import com.karasiq.shadowcloud.storage.util... |
Explain and rewrite the following Scala code: | package jsky.app.ot.viewer.action
import edu.gemini.pot.sp.version._
import edu.gemini.shared.util.VersionComparison
import edu.gemini.shared.util.VersionComparison.{Conflicting, Newer, Older}
import edu.gemini.sp.vcs2.{OptionOps, _}
import edu.gemini.spModel.core.{Peer, SPProgramID}
import edu.gemini.util.security.au... |
Explain and rewrite the following Scala code: | /**
* See <a href="https://www.codeeval.com/open_challenges/7/">Prefix Expressions</a>
*/
object PrefixExpressions extends Challenge {
val lines = scala.io.Source.fromFile(args(0)).getLines().filter(_.length > 0)
lines.map(_.split(" ").toList).map {
case expressions =>
eval(expressions.head, express... |
Explain and rewrite the following Scala code: | package org.nexbook.app
import org.nexbook.repository.{OrderDatabaseRepository, OrderInMemoryRepository, OrderRepository}
/**
* Created by milczu on 07.01.16.
*/
trait OrderRepositoryResolver {
def orderRepository: OrderRepository
def inMemoryRepository: OrderInMemoryRepository
def databaseRepository: Or... |
Explain and rewrite the following Scala code: | /*
* Copyright 2015 the original author or 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 applicab... |
Explain and rewrite the following Scala code: | import org.rdowinton.robots._
import org.scalatest.{FunSpec, Matchers}
class RobotsSpec extends FunSpec with Matchers {
describe("Robots") {
it("should correctly parse a robots.txt file with more than one group") {
val robotsFile = RobotsFile(
List(
RobotsEntry(
List("Example"... |
Explain and rewrite the following Scala code: | /*
* Copyright 2016 The BigDL Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agr... |
Explain and rewrite the following Scala code: | package manual
object LoadRooms extends Process[data.Rooms] {
def run(): data.Rooms =
reportTime(s"Loading ${config.config("rooms")}") {
data.Rooms.current // should Rooms.current be cached as a lazy val at all?
}
}
|
Explain and rewrite the following Scala code: | /*
* Copyright (c) 2012 Yahoo! 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 applicable law
* or a... |
Explain and rewrite the following Scala code: | package tk.mygod.speech.synthesizer
import java.io.FileOutputStream
import android.app.Service
import android.content.{BroadcastReceiver, Intent, IntentFilter}
import android.net.Uri
import android.os.{Handler, ParcelFileDescriptor}
import android.support.annotation.IntDef
import android.support.v4.app.NotificationCo... |
Explain and rewrite the following Scala code: | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\\
* @ @ *
* # # # # (c) 2017 CAB *
* # # # # # # ... |
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.alghimo.spark.dimensionalModelling
import org.apache.spark.sql.Column
/**
* Created by alghimo on 6/6/2017.
*/
trait IsCurrentColumn extends Serializable {
def isCurrentColumnName: String = "_dim_is_current"
def isCurrentColumn = new Column(isCurrentColumnName)
}
|
Explain and rewrite the following Scala code: | // Copyright (c) 2016 PSForever.net to present
package net.psforever.packet.game
import net.psforever.packet.{GamePacketOpcode, Marshallable, PacketHelpers, PlanetSideGamePacket}
import scodec.Codec
import scodec.codecs._
case class PlanetSideZoneID(zoneId : Long)
object PlanetSideZoneID {
implicit val codec = ui... |
Explain and rewrite the following Scala code: | package edu.berkeley.cs.amplab.carat.tools
import spark._
import spark.SparkContext._
import spark.timeseries._
import edu.berkeley.cs.amplab.carat._
import java.util.concurrent.Semaphore
import scala.collection.mutable.ArrayBuffer
import scala.collection.Seq
import scala.collection.immutable.Set
import scala.collecti... |
Explain and rewrite the following Scala code: | package com.jdrews.logstation.config
import akka.actor.ActorRef
import akka.agent.Agent
import net.liftweb.common.Loggable
import scala.concurrent.ExecutionContext.Implicits.global
/**
* Controls the life-cycle of Actor Bridges
*/
object BridgeController extends Loggable {
//TODO: Pretty sure an agent (singlet... |
Explain and rewrite the following Scala code: | /*
* Scala (https://www.scala-lang.org)
*
* Copyright EPFL and Lightbend, Inc.
*
* Licensed under Apache License 2.0
* (http://www.apache.org/licenses/LICENSE-2.0).
*
* See the NOTICE file distributed with this work for
* additional information regarding copyright ownership.
*/
package scala
package reflect
... |
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: | package com.github.novamage.svalidator.validation.simple
abstract class SimpleValidator[A]
extends SimpleValidatorWithData[A, Nothing]
with ValidatorWithoutData[A] {
}
|
Explain and rewrite the following Scala code: | package org.http4s
package server
package middleware
import scala.concurrent.duration._
import scalaz.concurrent.Task
import Method._
class TimeoutSpec extends Http4sSpec {
val myService = HttpService {
case req if req.uri.path == "/fast" => Response(Status.Ok).withBody("Fast")
case req if req.uri.path == ... |
Explain and rewrite the following Scala code: | import play.api.libs.concurrent.Akka
import play.api.Play.current
package object controllers {
def gamesActor = Akka.system.actorSelection(s"/user/games-actor")
def sessionActor = Akka.system.actorSelection(s"/user/session-actor")
def gameActor(id: String) = Akka.system.actorSelection(s"/user/games-actor/game-... |
Explain and rewrite the following Scala code: | package io.flow.lint.linters
import io.flow.lint.Linter
import io.apibuilder.spec.v0.models.{Field, Model, Operation, Parameter, Resource, Service}
/**
* We have decided to call the same things consistently. This linter
* validates common field and parameter names
*/
case object BadNames extends Linter with H... |
Explain and rewrite the following Scala code: | package ecommerce.sales.app
import akka.actor._
import akka.kernel.Bootable
class SalesFrontApp extends Bootable {
override def systemName = "sales-front"
override def startup(): Unit = {
system.actorOf(SalesFrontAppSupervisor.props, "sales-front-supervisor")
}
}
object SalesFrontAppSupervisor {
def p... |
Explain and rewrite the following Scala code: | package com.github.mdr.ascii.layout.cycles
import org.scalatest.{FlatSpec, Matchers}
import com.github.mdr.ascii.graph.Graph
import com.github.mdr.ascii.util.Utils
class GraphReflowTest extends FlatSpec with Matchers {
reflowingGraph("""
+-+ +-+
|A|-->|B|
+-+ +-+ """).
inOrder(... |
Explain and rewrite the following Scala code: | package service
import models.User
import securesocial.core._
import play.api.mvc.{ Session, RequestHeader }
import play.api.Logger
class SecureSocialEventListener extends EventListener[User] {
def onEvent(event: Event[User], request: RequestHeader, session: Session): Option[Session] = {
val eventName = event m... |
Explain and rewrite the following Scala code: | /*
* The MIT License
*
* Copyright (c) 2010 Vladimir Kirichenko <vladimir.kirichenko@gmail.com>
*
* 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... |
Explain and rewrite the following Scala code: | package polyite.fitness.scop_features
import polyite.fitness.Feature
import polyite.schedule.DomainCoeffInfo
import polyite.schedule.Dependence
import polyite.ScopInfo
import polyite.util.SCoPMetrics
import polyite.schedule.schedule_tree.ScheduleNode
import polyite.config.Config
/**
* Number of dependences of the S... |
Explain and rewrite the following Scala code: | package org.apache.spark.ml.mleap.param
import org.apache.spark.ml.param.{Param, Params}
/**
* Created by hollinwilkins on 1/18/17.
*/
private[ml] trait HasProbabilitiesCol extends Params {
/**
* Param for input column name.
*
* @group param
*/
final val probabilitiesCol: Param[String] = new ... |
Explain and rewrite the following Scala code: | /*
* Copyright 2016 The BigDL Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agr... |
Explain and rewrite the following Scala code: | package com.github.morikuni.locest.frequency.application.service
import com.github.morikuni.locest.frequency.application.dto.CountDto
import com.github.morikuni.locest.frequency.application.service.impl.CountServiceImpl
import com.github.morikuni.locest.frequency.domain.repository.{FrequencyInformationRepositorySessio... |
Explain and rewrite the following Scala code: | package at.logic.gapt.language.fol.algorithms
import at.logic.gapt.expr._
import at.logic.gapt.expr.StringSymbol
import at.logic.gapt.expr.{ TA, Ti, To }
import at.logic.gapt.utils.logging.Logger
/**
* This is implements some heuristics to convert a fol formula obtained by
* [[at.logic.gapt.language.fol.algorithms.... |
Explain and rewrite the following Scala code: | package org.littlewings.hazelcast.sessionclustering
import java.io.IOException
import javax.servlet.ServletException
import javax.servlet.annotation.WebServlet
import javax.servlet.http.{HttpServlet, HttpServletRequest, HttpServletResponse, HttpSession}
@WebServlet(Array("/*"))
class SharedSessionServlet extends Htt... |
Explain and rewrite the following Scala code: | /*******************************************************************************
Copyright (c) 2013-2014, S-Core, KAIST.
All rights reserved.
Use is subject to license terms.
This distribution may include materials developed by third parties.
*********************************************************... |
Explain and rewrite the following Scala code: | package net.machinemuse.utils.render
/**
* Author: MachineMuse (Claire Semple)
* Created: 6:36 PM, 5/15/13
*/
object BufferMapper {
}
|
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) 2014 Snowplow Analytics Ltd. All rights reserved.
*
* This program is licensed to you under the Apache License Version 2.0,
* and you may not use this file except in compliance with the Apache License Version 2.0.
* You may obtain a copy of the Apache License Version 2.0 at http://www.apache.org... |
Explain and rewrite the following Scala code: | /*
* Copyright 2014 Cisco Systems, 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 org.jetbrains.plugins.scala.findUsages.compilerReferences.indices
import java.io.{DataInput, DataOutput}
import java.util
import com.intellij.openapi.util.io.{DataInputOutputUtilRt => ioutil}
import com.intellij.util.indexing.{DataIndexer, IndexExtension, IndexId}
import com.intellij.util.io.{DataExternalizer... |
Explain and rewrite the following Scala code: | package io.netflow.flows.cflow
import java.net.{ InetAddress, InetSocketAddress }
import java.util.UUID
import com.datastax.driver.core.utils.UUIDs
import com.twitter.util.Future
import io.netflow.lib._
import io.netflow.storage
import io.netty.buffer._
import net.liftweb.json.JsonDSL._
import org.joda.time.DateTime
... |
Explain and rewrite the following Scala code: |
package org.timur.anymime
object Static {
val DBGLOG = true
}
|
Explain and rewrite the following Scala code: | package uk.co.turingatemyhamster
package owl2
package ast
sealed trait IRI extends AnnotationSubject with AnnotationValue
/** A full IRI string, without the wrapping < (U+3C) and > (U+3E) characters. */
case class FullIRI(iriString: String) extends IRI
/** A prefix string, matching the as PNAME_NS production of SPA... |
Explain and rewrite the following Scala code: | /*
* Copyright (c) 2013-2014 Telefónica Investigación y Desarrollo S.A.U.
*
* 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
*
* Unles... |
Explain and rewrite the following Scala code: | package scalan.primitives
import scalan.ScalanDsl
trait PrimitiveExamples extends ScalanDsl {
lazy val id = fun {(x: Rep[Int]) => x}
lazy val inc = fun {(x: Rep[Int]) => x + 1}
lazy val curred = fun {(x: Rep[Int]) => fun {(y: Rep[Int]) => x + y }}
lazy val tupled = fun {(x: Rep[(Int,Int)]) => x._1 + x._2 }
... |
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 edu.mit.csail.cap.query
package analysis
import java.io.File
import xml.{ NodeSeq, Elem, XML }
class MethodDocumentation(val documentation: String,
val returnValue: Option[String],
val parameters: List[(String, String)],
val excepti... |
Explain and rewrite the following Scala code: | package es.weso.wiExtract
case class Observation(
countryCode: String,
countryName: String,
year: String,
indicatorCode: String,
value: Float,
datasetName: String,
sheet_type: String) {
def toJson() : String = {
"{ " +
List(pair("countryCode",countryCode),
pair("count... |
Explain and rewrite the following Scala code: | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... |
Explain and rewrite the following Scala code: | package org.http4s
package server
import java.net.InetSocketAddress
import fs2._
import org.specs2.mutable.After
trait ServerAddressSpec extends Http4sSpec {
def builder: ServerBuilder
trait ServerContext extends After {
val address = new InetSocketAddress(0)
val server = builder.bindSocketAddress(addres... |
Explain and rewrite the following Scala code: | package scodec
package codecs
import java.security.KeyPairGenerator
import java.util.Arrays
class SignatureCodecTest extends CodecSuite {
private val keyPair = {
val keyGen = KeyPairGenerator.getInstance("RSA")
keyGen.initialize(1024)
keyGen.generateKeyPair
}
"fixedSizeSignature codec" should {
... |
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 controllers
import java.util.UUID
import models.audit.UserFeedback
import models.database.queries.audit.UserFeedbackQueries
import play.api.i18n.MessagesApi
import play.api.libs.concurrent.Execution.Implicits.defaultContext
import services.database.Database
import services.email.EmailService
import services.u... |
Explain and rewrite the following Scala code: | /**
* Copyright (C) 2016 Jonathan Passerat-Palmbach
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This p... |
Explain and rewrite the following Scala code: | package orientdb.stream.shared.local
import orientdb.stream.shared.InMemoryTckTest
import orientdb.stream.{NonBlockingQueryBuffering, NonBlockingQuery, OverflowStrategy}
import OverflowStrategy.Fail
import scala.reflect.ClassTag
class TckTestLocalBuffering extends InMemoryTckTest {
def NonBlockingQuery[A: ClassTag... |
Explain and rewrite the following Scala code: | package org.nexbook.testutils
import java.util.concurrent.atomic.AtomicLong
import org.nexbook.domain._
import org.nexbook.fix.FixOrderConverter
import org.nexbook.utils.DefaultClock
import quickfix.Message
import quickfix.field.MsgType
import quickfix.fix44.{NewOrderSingle, OrderCancelRequest}
/**
* Created by m... |
Explain and rewrite the following Scala code: | package com.atlassian.svn2git
import org.specs2.mutable
import org.apache.commons.io.FileUtils
import java.io.File
class CleanTest extends mutable.Specification {
def writeSVNRemoteConfig(dir: File, extra: String = "") = {
FileUtils.writeStringToFile(new File(dir, ".git/config"),
"""
|[svn-remote... |
Explain and rewrite the following Scala code: | package org.scalacheck.derive
import org.scalacheck.{Arbitrary, Cogen, Gen, Shrink}
import shapeless.{Coproduct, HList, LowPriority, Strict, Witness}
import shapeless.labelled._
trait SingletonInstances {
implicit def arbitrarySingletonType[S]
(implicit
w: Witness.Aux[S]
): Arbitrary[S] =
Arbitrary(... |
Explain and rewrite the following Scala code: | package com.github.j5ik2o.dddbase.skinny
import cats.data.ReaderT
import com.github.j5ik2o.dddbase.AggregateMultiWriter
import monix.eval.Task
import scalikejdbc.DBSession
trait AggregateMultiWriteFeature
extends AggregateMultiWriter[ReaderT[Task, DBSession, ?]]
with AggregateBaseWriteFeature {
override de... |
Explain and rewrite the following Scala code: | package com.expedia.gps.geo.reactive101.server
import com.typesafe.scalalogging.StrictLogging
import org.eclipse.jetty.server.Server
import org.eclipse.jetty.servlet.DefaultServlet
import org.eclipse.jetty.webapp.WebAppContext
import org.scalatra.servlet.ScalatraListener
import org.slf4j.LoggerFactory
/**
* Launch ... |
Explain and rewrite the following Scala code: | package fpinscala.monoids
trait Monoid[A] {
def op(a1: A, a2: A): A
def zero: A
}
object Monoid {
val stringMonoid = new Monoid[String] {
def op(a1: String, a2: String) = a1 + a2
val zero = ""
}
def listMonoid[A] = new Monoid[List[A]] {
def op(a1: List[A], a2: List[A]) = a1 ++ a2
val zero ... |
Explain and rewrite the following Scala code: | trait T[A, B] {
def f(a: A): B
def g(a: A, b: B): Unit
}
class C[X, Y] extends T[X, Y] {} // error
|
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: | /*
* Copyright 2015 herd contributors
*
* 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 ... |
Explain and rewrite the following Scala code: | package org.openurp.edu.eams.teach.grade.lesson.service.impl
import org.beangle.commons.collection.Collections
import org.beangle.commons.dao.impl.BaseServiceImpl
import org.beangle.data.jpa.dao.OqlBuilder
import org.beangle.commons.lang.Strings
import org.openurp.base.Semester
import org.openurp.edu.base.Teacher
i... |
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.nscplugin.test
import uti... |
Explain and rewrite the following Scala code: | package mesosphere.marathon.state
import scala.collection.immutable.Seq
import scala.collection.JavaConverters._
import scala.util.Try
import java.lang.{ Integer => JInt }
import org.apache.mesos.{ Protos => mesos }
import mesosphere.marathon.Protos
case class Container(
`type`: mesos.ContainerInfo.Type = mesos.C... |
Explain and rewrite the following Scala code: | /*
* Copyright 2014 Treode, 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.transgee.ebook
case class Toc(rootNode: TocNode) {
def isEmpty() = rootNode.children.isEmpty
}
object Toc {
val empty = new Toc(TocNode.root)
}
|
Explain and rewrite the following Scala code: | /*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright 2015-2021 Andre White.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE... |
Explain and rewrite the following Scala code: | /*-------------------------------------------------------------------------*\\
** ScalaCheck **
** Copyright (c) 2007-2014 Rickard Nilsson. All rights reserved. **
** http://www.scalacheck.org **
** ... |
Explain and rewrite the following Scala code: | // code-examples/AdvOOP/objects/text-field-unapply-spec.scala
package objects
import org.specs._
object TextFieldUnapplySpec extends Specification {
"TextField.unapply" should {
"should match a TextField object" in {
val tf = new TextField("hello world!")
tf match {
... |
Explain and rewrite the following Scala code: | /*
* Copyright 2017 Max Meldrum
*
* 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 w... |
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 2001-2008 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: | /*
* 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: | package chapter6
import scala.annotation.tailrec
trait RNG {
def nextInt: (Int, RNG)
}
case class SimpleRNG(seed: Long) extends RNG {
def nextInt: (Int, RNG) = {
val newSeed = (seed * 0x5DEECE66DL + 0xBL) & 0xFFFFFFFFFFFFL
val nextRNG = SimpleRNG(newSeed)
val n = (newSeed >>> 16).toInt
... |
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 us... |
Explain and rewrite the following Scala code: | import java.io.StringReader
import au.com.bytecode.opencsv.CSVReader
import com.fasterxml.jackson.annotation.{JsonCreator, JsonProperty}
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.databind.jsonschema.JsonSerializableSchema
import org.apache.spark.{SparkConf, SparkContext}
case cla... |
Explain and rewrite the following Scala code: | package org.scalawiki.dto.cmd.query.list
import org.scalawiki.dto.cmd.Action
import org.scalawiki.dto.cmd.query.Query
import org.scalawiki.dto.cmd.query.list.cmprop.{Ids, Title}
import org.specs2.mutable.Specification
class CategoryMembersSpec extends Specification {
val baseParams = Map(
"action" -> "query",
... |
Explain and rewrite the following Scala code: | package com.greencatsoft.angularjs.extensions.material
import com.greencatsoft.angularjs.injectable
import scala.scalajs.js
/** @see https://material.angularjs.org/#/Theming/03_configuring_a_theme
*/
@js.native
@injectable("$mdThemingProvider")
trait ThemingProvider extends js.Object {
def theme(name: String): ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.