instruction stringclasses 1
value | output stringlengths 5 1M |
|---|---|
Explain and rewrite the following Scala code: | /*
* (c) Copyright 2019 EntIT Software LLC, a Micro Focus company, L.P.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Apache License v2.0 which accompany this distribution.
*
* The Apache License is available at
* http://www.apache.org/licenses/LICE... |
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: | /*
* ViewState.scala
* (Mellite)
*
* Copyright (c) 2012-2022 Hanns Holger Rutz. All rights reserved.
*
* This software is published under the GNU Affero General Public License v3+
*
*
* For further information, please contact Hanns Holger Rutz at
* contact@sciss.de
*/
package de.sciss.mellite
import ... |
Explain and rewrite the following Scala code: | /*
* Copyright 2017 HM Revenue & Customs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or a... |
Explain and rewrite the following Scala code: | package com.azavea.opentransit.indicators.calculators
import com.azavea.gtfs._
import com.azavea.opentransit._
import com.azavea.opentransit.database.DemographicsTable
import com.azavea.opentransit.indicators._
import com.azavea.opentransit.indicators.parameters._
import geotrellis.vector._
import geotrellis.slick._
... |
Explain and rewrite the following Scala code: | package com.twitter.zipkin.aggregate
import com.twitter.finagle.stats.{DefaultStatsReceiver, StatsReceiver}
import com.twitter.util.{Await, Closable, Future}
import com.twitter.zipkin.anormdb.AnormDBSpanStoreFactory
import com.twitter.zipkin.aggregates.anormdb.AnormAggregatorFactory
import com.twitter.zipkin.storage.a... |
Explain and rewrite the following Scala code: | package com.karasiq.videojs
import scala.scalajs.js
object VjsUtils {
def ready(f: Player ⇒ Unit): js.Function = {
js.ThisFunction.fromFunction1((p: Player) ⇒ f(p))
}
}
|
Explain and rewrite the following Scala code: | package com.pentandra.roc.core
import java.util.Date
trait CreatedOn {
def createdOn: Date
def createdBy: String
}
|
Explain and rewrite the following Scala code: | /* ___ ____ ___ __ ___ ___
** / _// __// _ | / / / _ | / _ \\ Scala classfile decoder
** __\\ \\/ /__/ __ |/ /__/ __ |/ ___/ (c) 2003-2010, LAMP/EPFL
** /____/\\___/_/ |_/____/_/ |_/_/ http://scala-lang.org/
**
*/
package scala.tools.scalap
import java.io.{ByteArrayOutputStream, OutputStreamWri... |
Explain and rewrite the following Scala code: | package com.alvin.niagara.kafkastream.serde
/**
* Created by alvinjin on 2017-04-02.
*/
import java.io.ByteArrayOutputStream
import java.util
import com.alvin.niagara.model.Business
import com.sksamuel.avro4s.AvroSchema
import org.apache.avro.Schema
import org.apache.avro.generic._
import org.apache.avro.io.{De... |
Explain and rewrite the following Scala code: | /*
* Copyright 2012-2016 Steve Chaloner
*
* 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: | package org.scalawiki.dto.filter
import org.scalawiki.dto.Page
object PageFilter {
def titles(titles: Set[String]) = (p:Page) => titles.contains(p.title)
def ids(ids: Set[Long]) = (p:Page) => p.id.exists(ids.contains)
def ns(namespaces: Set[Int]) = (p:Page) => p.ns.exists(namespaces.contains)
val all = (p... |
Explain and rewrite the following Scala code: | package mesosphere
import java.util.concurrent.{ LinkedBlockingDeque, TimeUnit }
import akka.actor.{ ActorSystem, Scheduler }
import akka.stream.{ ActorMaterializer, Materializer }
import akka.testkit.{ TestActor, TestActorRef, TestKitBase }
import akka.util.Timeout
import com.typesafe.config.{ Config, ConfigFactory ... |
Explain and rewrite the following Scala code: | package monocle.internal.focus.features
import scala.quoted.Quotes
import monocle.internal.focus.FocusBase
private[focus] trait ParserBase {
this: FocusBase =>
import macroContext.reflect._
// Marker class for type safety
case class RemainingCode(code: Term)
trait FocusParser {
def unapply(term: Term... |
Explain and rewrite the following Scala code: | // Copyright (c) 2011-2015 ScalaMock Contributors (https://github.com/paulbutcher/ScalaMock/graphs/contributors)
//
// 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, inc... |
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) 2012 - 101loops.com <dev@101loops.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 by appli... |
Explain and rewrite the following Scala code: | package Objects
case class SecureMessage(
from: Int,
message: Array[Byte],
signature: Array[Byte],
encryptedKey: Array[Byte]
) |
Explain and rewrite the following Scala code: | package com.crobox.clickhouse.dsl.column
import com.crobox.clickhouse.dsl._
import com.crobox.clickhouse.{dsl, DslITSpec}
import java.util.UUID
class UUIDFunctionsIT extends DslITSpec {
override val table1Entries: Seq[Table1Entry] =
Seq(Table1Entry(UUID.randomUUID()), Table1Entry(UUID.fromString("00000000-0000... |
Explain and rewrite the following Scala code: | /*
* This file is part of the ToolXiT project.
*
* 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 2008-present MongoDB, 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 ag... |
Explain and rewrite the following Scala code: | package com.productfoundry.akka.cqrs.process
import akka.actor._
import akka.pattern.ask
import akka.productfoundry.contrib.pattern.ReceivePipeline
import akka.util.Timeout
import com.productfoundry.akka.cqrs.process.ProcessManagerRegistryActor.Register
import com.productfoundry.akka.cqrs.publish.{EventPublication, Ev... |
Explain and rewrite the following Scala code: | package gateway.restapi.http.routes
import akka.http.scaladsl.server.Directives._
import de.heikoseeberger.akkahttpcirce.CirceSupport
import gateway.restapi.domain._
import gateway.restapi.services.{TransactionsService, WalletsService}
import io.circe.generic.auto._
import io.circe.syntax._
class GatewayRoute (val tr... |
Explain and rewrite the following Scala code: | /*
* Copyright 2019 Spotify AB.
*
* 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.twitter.finagle.partitioning
abstract class KetamaClientKey {
def identifier: String
}
object KetamaClientKey {
private[finagle] case class HostPortBasedKey(host: String, port: Int, weight: Int)
extends KetamaClientKey {
val identifier: String = if (port == 11211) host else host + ":" + port... |
Explain and rewrite the following Scala code: | package com.redbubble.pricer.shell
import java.io.File
import cats.data.NonEmptyList
import com.redbubble.pricer.common.Decoders.cartDecoder
import com.redbubble.pricer.common.{BaseProduct, JsonOps, Pricer}
import io.circe.Decoder
import scala.io.Source
object CommandLineApp {
def main(args: Array[String]): 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... |
Explain and rewrite the following Scala code: | package edu.uchicago.cs.encsel.classify
import edu.uchicago.cs.encsel.model.DataType
import org.junit.Assert._
import org.junit.Test
/**
* Created by harper on 4/20/17.
*/
|
Explain and rewrite the following Scala code: | package eu.ace_design.island.game
import eu.ace_design.island.geom.Point
import eu.ace_design.island.map._
import eu.ace_design.island.map.resources.Soils.Soil
import eu.ace_design.island.map.resources.Conditions.Condition
import eu.ace_design.island.map.resources.{NoResource, Biome, PrimaryResource}
import eu.ace_des... |
Explain and rewrite the following Scala code: | /*
* Copyright (C) 2016-2017 Lightbend Inc. <https://www.lightbend.com>
*/
package com.lightbend.lagom.internal.persistence.cluster
import akka.Done
import akka.actor.Actor
import akka.actor.ActorRef
import akka.actor.Props
import akka.actor.Terminated
import akka.cluster.Cluster
import akka.cluster.sharding.Cluster... |
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 io.scalac.newspaper.mailer.outbound
import java.sql.Timestamp
import akka.actor.ActorSystem
import akka.testkit.{ ImplicitSender, TestKit }
import io.scalac.newspaper.mailer.db.{SendOrders, SendOrdersRepository}
import io.scalac.newspaper.mailer.outbound.NotificationSendingCron.SendNow
import org.mockito.Mock... |
Explain and rewrite the following Scala code: | package mesosphere.marathon.plugin.plugin
import play.api.libs.json.JsObject
/**
* Plugin can be extended to receive configuration from plugin descriptor.
*/
trait PluginConfiguration { self: Plugin =>
/**
* If a plugin implements this trait, it gets initialized with a configuration
* defined in the pl... |
Explain and rewrite the following Scala code: | package com.flowy.fomoapi.database.postgres
import com.flowy.common.utils.sql.SqlDatabase
import com.flowy.common.utils.FutureHelpers._
import com.flowy.fomoapi.database.dao.PasswordResetCodeDao
import com.flowy.fomoapi.database.postgres.schema.{SqlPasswordResetCodeSchema, SqlUserSchema}
import com.flowy.fomoapi.model... |
Explain and rewrite the following Scala code: | package services.schedule.actors
import services.schedule.Tick
import akka.actor.Actor
import services.currencies.CurrenciesService
import javax.inject.Inject
class CurrenciesActor @Inject() (currencieService: CurrenciesService) extends Actor {
def receive = {
case Tick => {
currencieService.load
}
}
} |
Explain and rewrite the following Scala code: |
package at.logic.gapt.proofs.ceres.ACNF
import at.logic.gapt.expr.fol.FOLMatchingAlgorithm
import at.logic.gapt.proofs.HOLSequent
import at.logic.gapt.proofs.lk._
import at.logic.gapt.proofs.lk.base._
import at.logic.gapt.proofs.occurrences.FormulaOccurrence
import at.logic.gapt.proofs.resolutionOld.OccClause
import ... |
Explain and rewrite the following Scala code: | object JarvisAndSevenSegments extends App {
val in = io.Source.stdin.getLines()
val tests = in.next.toInt
val neededBulbs = Vector(6,2,5,5,4,5,6,3,7,6)
for(_ <- 1 to tests){
in.next.toInt // not needed length
val favs = in.next.split(" ")
val consumption: Vector[Int] = favs.map(_.toList.map(_.toInt ... |
Explain and rewrite the following Scala code: | package com.karasiq.nanoboard.server.streaming
import akka.stream.actor.ActorPublisher
import akka.stream.actor.ActorPublisherMessage.{Cancel, Request}
import com.karasiq.nanoboard.streaming.NanoboardEvent
import scala.annotation.tailrec
private[server] class NanoboardMessagePublisher extends ActorPublisher[Nanoboar... |
Explain and rewrite the following Scala code: | package com.linkedin.norbert.javacompat.network
import java.util.Set
import com.linkedin.norbert.EndpointConversions
import EndpointConversions._
class IntegerConsistentHashPartitionedLoadBalancerFactory(numPartitions: Int, serveRequestsIfPartitionMissing: Boolean)
extends DefaultPartitionedLoadBalancerFactor... |
Explain and rewrite the following Scala code: | package spinoco.fs2
import cats.effect.{Async, ContextShift}
import cats.syntax.all._
import com.google.common.util.concurrent.{FutureCallback, Futures, ListenableFuture}
package object cassandra {
implicit def toAsyncF[F[_],A](f:ListenableFuture[A])(implicit F:Async[F], CS: ContextShift[F]): F[A] = {
F.async[... |
Explain and rewrite the following Scala code: | package zzz.akka.avionics
import akka.actor.{FSM, Terminated, Actor, ActorRef}
import zzz.akka.avionics.Plane.{RequestCoPilot, GiveMeControl}
trait PilotProvider {
def newPilot(plane: ActorRef,
autopilot: ActorRef,
heading: ActorRef,
altimeter: ActorRef ): Actor = new Pi... |
Explain and rewrite the following Scala code: | package com.thetestpeople.trt.jenkins.importer
import scala.xml.Elem
import org.joda.time.Duration
import org.junit.runner.RunWith
import org.scalatest._
import org.scalatest.junit.JUnitRunner
import java.net.URI
import com.thetestpeople.trt.importer.jenkins.JenkinsTestResultXmlParser
import com.thetestpeople.trt.impo... |
Explain and rewrite the following Scala code: | package chapter02
import chapter02.Exercise08.PriorityTaskPool
import org.scalatest.concurrent.AsyncAssertions
import org.scalatest.{PropSpec, ShouldMatchers}
import scala.concurrent.duration._
class Exercise08Spec extends PropSpec with ShouldMatchers with AsyncAssertions {
property("The task will run") {
val... |
Explain and rewrite the following Scala code: | /* Copyright 2009-2011 Jay Conrod
*
* This file is part of Tungsten.
*
* Tungsten 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 of
* the License, or (at your option) any late... |
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 uk.co.turingatemyhamster
package owl2
package ast
/**
*
*
* @author Matthew Pocock
*/
trait ObjectPropertyRestrictionModuleImpl extends owl2.ObjectPropertyRestrictionsModule {
importedModules : owl2.EntitiesLiteralsAnonymousIndividualsModule with owl2.IriModule {
type ClassExpression = ast.ClassExpr... |
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: | import org.scalatest.{Matchers, FunSuite}
/** @version 1.2.0 */
class RotationalCipherTest extends FunSuite with Matchers {
test("rotate a by 0, same output as input") {
RotationalCipher.rotate("a", 0) should be("a")
}
test("rotate a by 1") {
pending
RotationalCipher.rotate("a", 1) should be("b")
... |
Explain and rewrite the following Scala code: | package net.anti344.rcircuits.handler
import cpw.mods.fml.common.network.IGuiHandler
import net.minecraft.entity.player.EntityPlayer
import net.minecraft.world.World
import net.anti344.rcircuits.client.gui.GuiCircuit
import net.anti344.rcircuits.tile.TileEntityCircuitBase
object GuiHandler extends IGuiHandler{
ove... |
Explain and rewrite the following Scala code: | package com.twitter.finagle.tracing
import com.twitter.finagle._
import com.twitter.finagle.client.Transporter
import java.net.{SocketAddress, InetSocketAddress}
/**
* [[com.twitter.finagle.ServiceFactoryProxy]] used to trace the local addr and
* server addr.
*/
class ServerDestTracingProxy[Req, Rep](self: Service... |
Explain and rewrite the following Scala code: | package com.twitter.finagle.memcached.integration
import com.twitter.conversions.time._
import com.twitter.finagle.builder.{ClientBuilder, Server => MServer, ServerBuilder}
import com.twitter.finagle.memcached.Client
import com.twitter.finagle.memcached.protocol.text.Memcached
import com.twitter.finagle.memcached.prot... |
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 es.uvigo.ei.sing.biomsef
package database
import scala.concurrent.Future
import play.api.Play
import play.api.db.slick.{ DatabaseConfigProvider, HasDatabaseConfig }
import play.api.libs.concurrent.Execution.Implicits.defaultContext
import slick.driver.JdbcProfile
import entity.Author
import entity.Article
i... |
Explain and rewrite the following Scala code: | /**
* Copyright 2015 ICT.
*
* 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
... |
Explain and rewrite the following Scala code: | package lila.blog
import lila.message.{ ThreadRepo, Api => MessageApi }
import lila.user.UserRepo
import org.joda.time.DateTime
private[blog] final class Notifier(
blogApi: BlogApi,
messageApi: MessageApi,
lastPostCache: LastPostCache,
lichessUserId: String) {
def apply {
blogApi.prismicApi for... |
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 example2
import org.apache.spark.SparkConf
import org.apache.spark.SparkContext
import org.apache.spark.SparkContext._
import org.apache.spark.rdd.RDD
import json.Deserializer
object Main {
def main(args: Array[String]) {
val sc = new SparkContext("local[*]", "Example2", new SparkConf())
val rddTw... |
Explain and rewrite the following Scala code: | package templemore.onx.version6
import actors.Actor
import templemore.onx.version5.Token
/**
* @author Chris Turner
*/
class GameActor(grid: Actor,
noughts: Actor,
crosses: Actor) extends Actor {
private var currentPlayer = noughts
private var otherPlayer = crosses
def act():... |
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 squants.electro
import squants.QuantityParseException
import squants.space.Meters
import org.scalatest.flatspec.AnyFlatSpec
import org.scalatest.matchers.should.Matchers
/**
* @author Nicolas Vinuesa
* @since 1.4
*
*/
class MagneticFieldStrengthSpec extends AnyFlatSpec with Matchers {
behavior of "... |
Explain and rewrite the following Scala code: | /*******************************************************************************
* Copyright 2010 Maxime Lévesque
*
* 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://... |
Explain and rewrite the following Scala code: | /*
* MOIS: Pre-computed Time Series
* Copyright (C) 2014 University of Edinburgh School of Informatics
*
* 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 Licens... |
Explain and rewrite the following Scala code: | /* *\\
** Squants **
** **
** Scala Quantities and Units of Measure Library and DSL **
** (c) 2013-2015, G... |
Explain and rewrite the following Scala code: | /*
* Copyright (C) 2012-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package com.qifun.statelessFuture
package test
package run
package helloAkka
import scala.language.postfixOps
import scala.concurrent._
import com.qifun.statelessFuture.Future
import scala.concurrent.duration._
import scala.concurrent.duration.... |
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 org.openmole.plugin.hook.json
import org.openmole.core.dsl._
import org.openmole.core.dsl.extension._
import org.openmole.core.workflow.format.WritableOutput
object JSONHook {
def apply(output: WritableOutput, values: Val[_]*)(implicit name: sourcecode.Name, definitionScope: DefinitionScope): FromContextHoo... |
Explain and rewrite the following Scala code: | /*
* Copyright (C) 2009 Lalit Pant <pant.lalit@gmail.com>
*
* The contents of this file are subject to the GNU General Public License
* Version 3 (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.gnu.org/copyleft/gpl.html
*
*... |
Explain and rewrite the following Scala code: | package net.sansa_stack.ml.spark.similarity.similarityEstimationModels
import org.apache.spark.ml.linalg.Vector
import org.apache.spark.sql.DataFrame
import org.apache.spark.sql.functions.{col, udf}
class DiceModel extends GenericSimilarityEstimatorModel {
protected val dice = udf( (a: Vector, b: Vector) => {
... |
Explain and rewrite the following Scala code: | package fabricator
import org.testng.annotations.Test
import sun.misc.BASE64Decoder
class MobileTestSuite extends BaseTestSuite {
@Test
def testAndroidId() = {
val androidId = mobile.androidGsmId
if (debugEnabled) logger.debug("Testing random android ID : " + androidId)
val expectedString = "APA91012... |
Explain and rewrite the following Scala code: | package com.jayway.textmining
import org.apache.commons.io.FileUtils
import java.io.File
import scalaz._
import Scalaz._
/**
* Copyright 2012 Amir Moulavi (amir.moulavi@gmail.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.... |
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 service
import org.joda.time.DateTime
import skinny.orm.SkinnyCRUDMapper
import scalikejdbc._
import skinny.orm.feature.TimestampsFeature
case class ServiceSetting(
id: Long,
maximumAccounts: Long,
serviceNo: Long,
service: Option[Service] = None,
createdAt: DateTime,
updatedAt: DateTime)
object ... |
Explain and rewrite the following Scala code: | package gdg.blaze
import org.apache.spark.SparkConf
import org.apache.spark.streaming.dstream.DStream
import org.apache.spark.streaming.{Seconds, StreamingContext}
import scala.io.Source
object Main {
type MStream = DStream[Message]
val registry = Registry
def loadFile(resource: String) = {
Source.fromUR... |
Explain and rewrite the following Scala code: | package fr.univnantes.vroom.core
import fr.univnantes.vroom.TestsConstants
import fr.univnantes.vroom.core.dto.tarifs.{TarifDTO, TarifSalleDTO}
import fr.univnantes.vroom.core.dto.{BatimentDTO, DemandeurDTO, ReservationDTO, SalleDTO}
import org.scalatest.{FunSpec, Matchers}
/**
* Cas de tests pour la classe Systeme... |
Explain and rewrite the following Scala code: | package kornell.server.helper
import kornell.server.jdbc.repository.PeopleRepo
import kornell.server.repository.TOs
import kornell.server.api.UserResource
import kornell.core.entity.RegistrationType
trait GenPerson
extends GenInstitution
with AuthSpec{
def newPerson() = {
val regreq = TOs.newRegistration... |
Explain and rewrite the following Scala code: | package org.jetbrains.plugins.scala.codeInspection.methodSignature
import com.intellij.codeInspection._
import org.jetbrains.plugins.scala.codeInspection.methodSignature.quickfix.AddEmptyParentheses
import org.jetbrains.plugins.scala.extensions._
import org.jetbrains.plugins.scala.lang.psi.api.expr.ScUnderScoreSection... |
Explain and rewrite the following Scala code: | package specmethods
trait BaseWriter {
def write(i:Int):Unit = {}
}
trait Printer extends BaseWriter {
override def write(i:Int):Unit = {
println(i)
}
}
trait Buffering extends BaseWriter {
val buffer = collection.mutable.Buffer[Int]()
override def write(i:Int):Unit = {
buffer += i
if(buffer.si... |
Explain and rewrite the following Scala code: | package com.github.j5ik2o.reactive.redis.command.keys
import java.util.UUID
import com.github.j5ik2o.reactive.redis.RedisIOException
import com.github.j5ik2o.reactive.redis.command.{ CommandRequest, CommandResponse, StringParsersSupport }
import com.github.j5ik2o.reactive.redis.parser.StringParsers._
import com.githu... |
Explain and rewrite the following Scala code: | /*
* Part of NDLA image-api
* Copyright (C) 2017 NDLA
*
* See LICENSE
*/
package no.ndla.imageapi.model.domain
trait LanguageField[T] {
def value: T
def language: String
}
|
Explain and rewrite the following Scala code: | package se.gigurra.aichallenge
import akka.actor.{Actor, ActorSystem, Props, actorRef2Scala}
import org.junit.{Before, Test}
import org.slf4j.LoggerFactory
class BaseActor extends Actor {
override def receive = {
case msg => println(s"Base received a ${msg.getClass}")
}
}
class DerivedActor extends BaseActo... |
Explain and rewrite the following Scala code: | package com.twitter.finagle.mysql.unit.harness
import com.twitter.finagle.mysql.harness.MySqlExecutables
import java.io.File
import java.nio.file.{Path, Paths}
import org.mockito.Mockito.when
import org.scalatest.funsuite.AnyFunSuite
import org.scalatestplus.mockito.MockitoSugar.mock
class MySqlExecutablesTest extend... |
Explain and rewrite the following Scala code: | /*
* Copyright 2015-2020 Noel Welsh
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed... |
Explain and rewrite the following Scala code: | /**
* Copyright (C) 2010-2011 LShift Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
Explain and rewrite the following Scala code: | package ru.txman.actors
import akka.actor._
import akka.testkit._
import org.scalatest._
import scala.language.postfixOps
import ru.txman.actors.Accounts._
import scala.concurrent.duration._
import ru.txman.model.AccountDetails
/**
* Specification on Account.
* Created by dmitry on 04.06.16.
*/
class AccountSpe... |
Explain and rewrite the following Scala code: | /*
Copyright 2014 Twitter, 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 in writing, software... |
Explain and rewrite the following Scala code: | import leon.lang._
/* VSTTE 2010 challenge 1 */
object MaxSum {
//not valid because of Int, unfortunately conversion between big int and
//int does not work and we cannot compute a.length * Max (Int * BigInt)
def maxSum(a: Array[Int]): (Int, Int) = {
require(a.length >= 0)
var sum = 0
var max = 0
... |
Explain and rewrite the following Scala code: | package io.github.meshelton.secs
import java.util.UUID
import scala.collection.mutable.{ArrayBuffer, HashMap}
/**
* An entity
*
* Represents an entity and stores some metadata for it.
* These should only be created by a [[io.github.meshelton.secs.EntityManager EntityManager]]
*/
class Entity protected[secs... |
Explain and rewrite the following Scala code: | /*
* Copyright 2006-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: | package com.github.dzhg.tedis.commands
import com.github.dzhg.tedis.protocol.RESP._
import com.github.dzhg.tedis.{CommandParser, TedisErrors}
case class CommandParams(cmd: String, params: List[RESPValue])
trait CommandFactory extends CommandHelper with TedisErrors {
def make(input: ArrayValue): TedisCommand[_] = i... |
Explain and rewrite the following Scala code: | /*
This file is part of Octetoscope.
Copyright (C) 2013-2014 Octetoscope contributors (see /AUTHORS.txt)
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
... |
Explain and rewrite the following Scala code: | package orientdb.stream
import akka.actor.{ActorRefFactory, ActorSystem}
import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx
import org.reactivestreams.Publisher
import OverflowStrategy.OverflowStrategy
import orientdb.stream.impl.{NonBlockingQueryBackpressuring, NonBlockingQueryBuffering}
import... |
Explain and rewrite the following Scala code: | package net.cassite.jsonbind
import play.api.libs.json.JsValue
/**
* plugin that resolves values
*/
trait Plugin {
/**
* is an instance of the plugin
* @param func function pattern
* @return true/false
*/
def isAssignableFrom(func: String): Boolean
/**
* build a function to the args
* @para... |
Explain and rewrite the following Scala code: | package core.host
import akka.actor.Actor
import core.CoreMessage.{Call, ClientInput}
class HostActor[T <: InputReceiver](val host : T) extends Actor {
override def receive: Receive = {
//make the host execute the function called by the sender
case call:Call[T] =>{
call.func(host)
}
//giv... |
Explain and rewrite the following Scala code: | package com.scalaAsm.x86
package Instructions
package General
// Description: Scan String
// Category: general/arithstring/binary
trait SCAS extends InstructionDefinition {
val mnemonic = "SCAS"
}
object SCAS extends ZeroOperands[SCAS] with SCASImpl
trait SCASImpl extends SCAS {
implicit object _0 extends NoOp{... |
Explain and rewrite the following Scala code: | package edu.fuberlin.hotspots
import java.io.{File, FileOutputStream}
import org.apache.spark.{SparkConf, SparkContext}
import org.apache.hadoop.fs.{FileSystem, Path}
import scala.util.matching.Regex
/**
* An implementation of the GetisOrd G* statistics that is tailored to NYC taxi data from 2015.
* (really, ye... |
Explain and rewrite the following Scala code: | /**
* Copyright (C) 2010-2011 LShift Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
Explain and rewrite the following Scala code: | package com.alexitc.coinalerts.tasks.collectors
import com.alexitc.coinalerts.models.Exchange
import com.alexitc.coinalerts.tasks.models.Ticker
import scala.concurrent.Future
trait TickerCollector {
def exchange: Exchange
def getTickerList: Future[List[Ticker]]
}
|
Explain and rewrite the following Scala code: | package org.atnos.eff.syntax
import org.atnos.eff._
object batch extends batch
trait batch {
implicit final def toBatchOps[R, A](e: Eff[R, A]): BatchOps[R, A] = new BatchOps(e)
}
final class BatchOps[R, A](val e: Eff[R, A]) extends AnyVal {
def batch[T[_]](implicit batchable: Batchable[T], member: T /= R): Eff... |
Explain and rewrite the following Scala code: | package foo
import org.scalatest._
class ExampleSpec extends FlatSpec with Matchers {
it should "check stuff" in {
val x = new CommonStuff {
}
x.foo should equal ("bar")
}
}
|
Explain and rewrite the following Scala code: | /*
* Copyright 2017 Datamountaineer.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.