instruction
stringclasses
1 value
output
stringlengths
5
1M
Explain and rewrite the following Scala code:
/* * Licensed to Intel Corporation under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * Intel Corporation licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not ...
Explain and rewrite the following Scala code:
package com.benkolera.slick.joda import pg.pgLocalDateTimeInstant import org.specs2.mutable._ import org.joda.time.LocalDateTime import scala.util.Try class InstantRangeSpec extends Specification { val now = LocalDateTime.now() val tomorrow = now.plusDays(1) val yesterday = now.plusDays(-1) val yes2tomInc = ...
Explain and rewrite the following Scala code:
package com.twitter.finagle.filter import com.twitter.conversions.time._ import com.twitter.finagle._ import com.twitter.finagle.stats.StatsReceiver import com.twitter.finagle.util.{Ema, Rng} import com.twitter.logging.{Level, Logger} import com.twitter.util._ private[finagle] object NackAdmissionFilter { private v...
Explain and rewrite the following Scala code:
package de.frosner.broccoli.controllers import javax.inject.Inject import cats.data.{EitherT, OptionT} import cats.instances.future._ import cats.syntax.either._ import com.mohiva.play.silhouette.api.util.Credentials import com.mohiva.play.silhouette.impl.providers.CredentialsProvider import de.frosner.broccoli.servi...
Explain and rewrite the following Scala code:
package noiselib.util class Color(val rgba: Int) extends AnyVal { def fr: Float = r.toFloat / 255 def fg: Float = g.toFloat / 255 def fb: Float = b.toFloat / 255 def fa: Float = a.toFloat / 255 def r: Int = rgba >> 24 & 0xFF def g: Int = rgba >> 16 & 0xFF def b: Int = rgba >> 8 & 0xFF def a: Int = rgba & 0xFF...
Explain and rewrite the following Scala code:
package net.kogics.jiva.util import scala.util.Random import junit.framework.TestCase import junit.framework.Assert._ class TestRandomizer extends TestCase { override def setUp = { Randomizer.reset } def testSeeding = { Randomizer.seedable Randomizer().rseed = 20 assert(Randomizer().rseed...
Explain and rewrite the following Scala code:
package sharry.backend.signup import cats.effect._ import cats.implicits._ import sharry.backend.account._ import sharry.common._ import sharry.common.syntax.all._ import sharry.store.records.RInvitation import sharry.store.{AddResult, Store} import org.log4s.getLogger trait OSignup[F[_]] { def register(cfg: Sig...
Explain and rewrite the following Scala code:
package com.twitter.io import org.specs.SpecificationWithJUnit import com.twitter.util.TempFolder import java.io.File class FilesSpec extends SpecificationWithJUnit with TempFolder { noDetailedDiffs() "Files" should { "delete" in withTempFolder { val tempFolder = new File(canonicalFolderName) v...
Explain and rewrite the following Scala code:
package skinny.oauth2.client.backlog import skinny.logging.LoggerProvider import skinny.oauth2.client.{ BearerRequest, OAuth2Client, OAuth2Token } import skinny.json.JSONStringOps import scala.util.control.NonFatal case class BacklogJPAPI(spaceID: String) extends LoggerProvider { def myself(token: OAuth2Token): O...
Explain and rewrite the following Scala code:
/* * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /* * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the...
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:
package de.fosd.typechef.crewrite import java.io.PrintWriter import scala.language.reflectiveCalls trait IOUtilities { // http://stackoverflow.com/questions/4604237/how-to-write-to-a-file-in-scala import java.io.FileWriter def using[A <: {def close()}, B](param: A)(f: A => B): B = try { ...
Explain and rewrite the following Scala code:
/** * © 2019 Refinitiv. 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 l...
Explain and rewrite the following Scala code:
package org.akka.essentials.serializer import akka.serialization.SerializationExtension import akka.actor.ActorSystem import com.typesafe.config.ConfigFactory case class MyMessage( name: String, age: Int, city: String) object MySerializationApp { def main(args: Array[String]): Unit = { val system = ActorSyste...
Explain and rewrite the following Scala code:
package com.themillhousegroup.bombardier import java.io.File object WeatherStation { val weatherStationFileName = "IDY02126.dat" private val weatherStationStream = getClass.getResourceAsStream("/" + weatherStationFileName) private[bombardier] val weatherStationSource = scala.io.Source.fromInputStream(weatherSta...
Explain and rewrite the following Scala code:
/* __ __ ** _____ ___ __ _/ /_ ___ __ _ ___ ___ __ _____ _/ /_ ** / ___// __` // __// __` // ___// __` // __// __/ ** / /__ / /_/ / / /_ / /_/ // / / /_/ // /__ / /_ ** \\___/ \\__,_/ \\__/ \\__,_//_/ \\__,_/ \\___/ \\__/ ** ** ...
Explain and rewrite the following Scala code:
/* ,i::, :;;;;;;; ;:,,::;. 1ft1;::;1tL t1;::;1, :;::; _____ __ ___ __ fCLff ;:: tfLLC / ___/ / |/ /____ _ _____ / /_ CLft11 :,, i1tffLi \\__ \\ ____ / /|_/ ...
Explain and rewrite the following Scala code:
/** * Copyright 2011-2016 GatlingCorp (http://gatling.io) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by appli...
Explain and rewrite the following Scala code:
import org.scalatest._ import scala.language.experimental.macros import scala.meta._ import scala.meta.semantic._ class NewMacros extends FunSuite { // TODO: implement this! // NOTE: going to be tough, because the macro in OldMacros is whitebox, and we don't know how to support whitebox yet }
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 org.axonframework.scynapse.akka import java.time.Instant import akka.actor.ActorSystem import akka.testkit.{ImplicitSender, TestKit, TestProbe} import org.axonframework.eventhandling.{GenericEventMessage, SimpleEventBus} import org.axonframework.eventsourcing.DomainEventMessage import org.axonframework.messag...
Explain and rewrite the following Scala code:
package com.ponkotuy.data import org.json4s._ /** * * @author ponkotuy * Date: 14/03/24. */ case class MapInfo(id: Int, cleared: Boolean, exbossFlag: Boolean, defeatedCount: Option[Int], eventMap: Option[EventMap]) object MapInfo { implicit val formats = DefaultFormats def fromJson(obj: JValue): List[MapInf...
Explain and rewrite the following Scala code:
package gui import java.awt.event.{KeyEvent, KeyListener} import java.util abstract class KeyBinder(val keyCodes: Int*) extends KeyListener { private val keyMap: util.Hashtable[Int, Boolean] = new util.Hashtable[Int, Boolean] override def keyTyped(e: KeyEvent): Unit = {} override def keyPressed(e: KeyEv...
Explain and rewrite the following Scala code:
package edu.holycross.shot.ohco2 import org.scalatest.FlatSpec import edu.holycross.shot.cite._ import scala.xml._ /** */ class OnlineDocumentSpec extends FlatSpec { /* val citeConfXml = """<CitationConfiguration xmlns="http://chs.harvard.edu/xmlns/hocuspocus" tiversion="6.0.0"> <online urn="urn:cts:gre...
Explain and rewrite the following Scala code:
/* * Copyright 2017 by Simba 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 agree...
Explain and rewrite the following Scala code:
package su.t1001.daika import java.net.InetSocketAddress import java.nio.file.{Files, Paths} import com.sun.net.httpserver.{HttpExchange, HttpHandler, HttpServer} import com.typesafe.config.Config import scala.collection.mutable abstract class SimpleHttpServerBase(config: Config) extends HttpHandler { private val...
Explain and rewrite the following Scala code:
package com.twitter.finagle.serverset2.client.apache import com.twitter.conversions.DurationOps._ import com.twitter.finagle.stats.InMemoryStatsReceiver import com.twitter.finagle.serverset2.client._ import com.twitter.finagle.util.DefaultTimer import com.twitter.util.Await import org.apache.zookeeper.WatchedEvent imp...
Explain and rewrite the following Scala code:
package codesniffer.deckard /** * Created by Bowen Cai on 8/2/2015. */ case class Location(file: String, lineBegin: Int, lineEnd: Int, scope: Scope) { /** * * enter a new scope, e.g., append new node to linked list, and return this list (a new location) * * @param name * @param ln *...
Explain and rewrite the following Scala code:
object WithSemicolon { def foo(i: Int) { /*start*/ val y = 0 println(i) y + 1 /*end*/ } def foofoo() { val y = 0 println(1); y + 1 } } /* object WithSemicolon { def foo(i: Int) { /*start*/ testMethodName(i) /*end*/ } def testMethodName(i: Int): Unit = { ...
Explain and rewrite the following Scala code:
/* Copyright 2017-19, Emmanouil Antonios Platanios. 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 ...
Explain and rewrite the following Scala code:
object Run extends App { println(666) new Thread {}.stop }
Explain and rewrite the following Scala code:
package services import actors.persistent.staffing.GetState import akka.actor.Actor import akka.pattern.after import controllers.ArrivalGenerator import drt.shared.CrunchApi._ import drt.shared.FlightsApi.Flights import drt.shared.Queues.Queue import drt.shared.Terminals.{T1, T2, Terminal} import drt.shared._ import d...
Explain and rewrite the following Scala code:
package audit import akka.actor.SupervisorStrategy.Escalate import akka.actor.{Actor, OneForOneStrategy, Props, SupervisorStrategy} import audit.collector.CollectorActor import audit.collector.CollectorActor.CollectorRequest import audit.viewer.ViewerActor import audit.viewer.ViewerActor.ViewerRequest import com.datas...
Explain and rewrite the following Scala code:
package chess package opening import format.FEN import org.specs2.mutable.Specification class FullOpeningTest extends Specification { def searchStr(str: String) = FullOpeningDB search str.split(' ').toList map (_.opening) "search" should { "find nothing on invalid PGN" in { searchStr("e4 c5 Nf3 cx...
Explain and rewrite the following Scala code:
package ru.org.codingteam.horta.plugins import ru.org.codingteam.horta.security.Credential /** * Trait for plugins that can process user commands. */ trait CommandProcessor extends BasePlugin { override def receive = { case ProcessCommand(credential, token, arguments) => processCommand(credential, token, arg...
Explain and rewrite the following Scala code:
/* * Copyright 2016 Johannes Rudolph * * 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 suzaku.platform.server import suzaku.platform.Logger class ServerLogger extends Logger { override def debug(message: => String): Unit = Console.println(s"DEBUG - $message") override def info(message: => String): Unit = Console.println(s"INFO - $message") override def warn(message: => String): Unit = ...
Explain and rewrite the following Scala code:
package knot.msgpack.codec import knot.msgpack.{Format, MsgPackInput, MsgPackOutput} trait ByteCodec extends Codec[Byte] { override def encode(out: MsgPackOutput, v: Byte): Unit = { if (v < -(1 << 5)) { out.putByteAndByte(Format.INT8, v) } else { out.putByte(v) } } override def decode(i...
Explain and rewrite the following Scala code:
// scalac: -Werror sealed trait Expr final case class Foo(other: Option[String]) extends Expr final case class Bar(someConstant: String) extends Expr final case class Baz() extends Expr final case class EatsExhaustiveWarning(other: Reference) extends Expr sealed trait Reference { val value: String } object Referenc...
Explain and rewrite the following Scala code:
package io.rampant.vulgar.db import play.api.Play.current import play.api.libs.concurrent.Akka object Pools { implicit val system = Akka.system val writePool = new WorkerPool("slick-write-pool") val readPool = new WorkerPool("slick-read-pool") }
Explain and rewrite the following Scala code:
package GUI import GUIAbstractComponent._ import javax.swing._ import java.awt.BorderLayout import java.awt.GridLayout import java.awt.Component import java.awt.event.ActionListener import java.awt.event.ActionEvent import java.awt.Dimension class GUIGeneratorSwing extends GUIAbstractGeneratorToolkit { type ImplFram...
Explain and rewrite the following Scala code:
package me.shadaj.genalgo.sequences import scala.collection.{mutable, IndexedSeqLike} import scala.collection.mutable.ArrayBuffer import scala.collection.generic.CanBuildFrom import me.shadaj.genalgo.util.BitStorage import me.shadaj.genalgo.codontable.CodonTable final class RNA private[sequences] (storage: BitStorage...
Explain and rewrite the following Scala code:
/* * Copyright 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 applicable l...
Explain and rewrite the following Scala code:
/* * * This file is part of BlueScale. * * BlueScale is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * BlueScale is distrib...
Explain and rewrite the following Scala code:
/** * Copyright (C) 2015-2016 DANS - Data Archiving and Networked Services (info@dans.knaw.nl) * * 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/license...
Explain and rewrite the following Scala code:
package mesosphere.marathon package integration import com.mesosphere.utils.mesos.MesosAgentConfig import mesosphere.marathon.core.health.{MesosHttpHealthCheck, PortReference} import mesosphere.marathon.core.pod.{HostNetwork, MesosContainer, PodDefinition} import mesosphere.marathon.integration.facades.AppMockFacade i...
Explain and rewrite the following Scala code:
package com.twitter.finagle.serverset2.client.apache import com.twitter.conversions.time._ import com.twitter.finagle.serverset2.client._ import com.twitter.finagle.stats.InMemoryStatsReceiver import com.twitter.io.Buf import com.twitter.util.Await import java.util.concurrent.ExecutionException import org.apache.zooke...
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) 2017 Richard Hull * * 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 the rights to * use, copy, modify, merge, publis...
Explain and rewrite the following Scala code:
package sample.stream.experiments import rx.lang.scala.subjects.PublishSubject object PublishSubjectExample { def main(args: Array[String]) { val subject = PublishSubject[String]() // observer1 will receive all onNext and onCompleted events subject.subscribe { x: String => println("observer 1") ...
Explain and rewrite the following Scala code:
package scalan.build import sbt._, Keys._ object ScalanBuildPlugin extends AutoPlugin { import ScalanBuild._ override def trigger = allRequirements object autoImport extends BuildKeys import autoImport._ private def scalanSettings = Seq( gitRevision := ScalanBuild.gitRev.get, commands ++= Seq(ver...
Explain and rewrite the following Scala code:
package mesosphere.mesos import mesosphere.marathon.test.{ MarathonTestHelper => MTH } import org.apache.mesos.Protos import org.apache.mesos.Protos.Resource.DiskInfo.Persistence import org.apache.mesos.Protos.Resource.{ DiskInfo, ReservationInfo } import org.apache.mesos.Protos._ import org.scalatest.{ Matchers, Asse...
Explain and rewrite the following Scala code:
package org.scalatra import javax.servlet.http.HttpServletRequest import org.scalatra.test.scalatest.ScalatraFunSuite import skinny.micro.contrib.FlashMapSupport import skinny.micro.{ SkinnyMicroFilter, SkinnyMicroServlet } class FlashMapSupportTestServlet extends SkinnyMicroServlet with FlashMapSupport { post("/m...
Explain and rewrite the following Scala code:
/* * Copyright (c) 2012-2017 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.apach...
Explain and rewrite the following Scala code:
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not u...
Explain and rewrite the following Scala code:
/////////////////////////////////////////////////////////////// // © ООО «Праймтолк», 2011-2013 // // Все права принадлежат компании ООО «Праймтолк». // /////////////////////////////////////////////////////////////// /** * SynapseGrid * © Primetalk Ltd., 2013. * All rights rese...
Explain and rewrite the following Scala code:
package com.twitter.finatra.thrift.tests.doeverything.controllers import com.twitter.conversions.DurationOps._ import com.twitter.doeverything.thriftscala.{Answer, DoEverything, DoEverythingException} import com.twitter.doeverything.thriftscala.DoEverything.{ Ask, Echo, Echo2, MagicNum, MoreThanTwentyTwoArgs...
Explain and rewrite the following Scala code:
import org.samplestack.id.UnsafeId import org.scalatest._ class IdGenerationTest extends FlatSpec with Matchers { "The id generator" must "generate correctly" in { val id = UnsafeId(2,2,"-") assert(!id.contains(" ")) info("id generation seems to work: " + id) } it must "generate readable id" in {...
Explain and rewrite the following Scala code:
package akka.persistence.kafka.journal import scala.concurrent.duration._ import akka.actor._ import akka.persistence.PersistentActor import akka.persistence.kafka._ import akka.persistence.kafka.server._ import akka.testkit._ import com.typesafe.config.ConfigFactory import org.scalatest._ object KafkaLoadSpec { ...
Explain and rewrite the following Scala code:
package org.joda.time.tz import java.io.DataInputStream import java.io.File import java.io.FileInputStream import java.io.IOException import java.io.InputStream import java.lang.ref.SoftReference import java.util.Set import org.joda.time.DateTimeZone import ZoneInfoProvider._ import scala.scalajs.js import scala.colle...
Explain and rewrite the following Scala code:
package at.forsyte.apalache.tla.lir.transformations.standard import at.forsyte.apalache.tla.lir.{LetInEx, NameEx, OperEx, TlaEx} import at.forsyte.apalache.tla.lir.oper.{TlaActionOper, TlaOper, TlaSetOper} import at.forsyte.apalache.tla.lir.transformations._ /** * Replace every equality x' = e with x' \\in {e}. Thi...
Explain and rewrite the following Scala code:
/* __ *\ ** ________ ___ / / ___ __ ____ Scala.js tools ** ** / __/ __// _ | / / / _ | __ / // __/ (c) 2013-2014, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ |/_// /_\ \ http://scala-js.org/ ** ** /____/\___/_/ |_/...
Explain and rewrite the following Scala code:
package com.twitter.finagle.mux import com.twitter.finagle.tracing import com.twitter.finagle.{Dtab, Dentry} import com.twitter.io.Charsets import com.twitter.util.Time import com.twitter.util.TimeConversions.intToTimeableNumber import org.jboss.netty.buffer.ChannelBuffers import org.junit.runner.RunWith import org.sc...
Explain and rewrite the following Scala code:
/* From ESOP 2014, Kuwahara et al */ import stainless.lang._ object IndirectHO { def app(h: () => () => Unit): () => Unit = h() def f(n: BigInt): () => Unit = { if (n > 0) { app(() => f(n - 1)) } else { () => () } } }
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 booflow import boopickle.Pickler /** * Proxy for Reactive Streams -like subscription */ trait SubscriptionProxy { def request(n: Long) def cancel() } /** * Proxy for Reactive Streams -like subscriber */ trait SubscriberProxy[T <: AnyRef] { def onSubscribe(s: SubscriptionProxy) def onNext(t: T) ...
Explain and rewrite the following Scala code:
/* * Copyright 2017 Benedikt Ritter * * 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:
/** * This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]]. */ // DO NOT EDIT MANUALLY package sbt.protocol abstract class SettingQueryResponse() extends sbt.protocol.EventMessage() with Serializable { override def equals(o: Any): Boolean = this.eq(o.asInstanceOf[AnyRef]) || (o m...
Explain and rewrite the following Scala code:
package org.bowlerframework.http import javax.servlet.http.HttpSession import collection.mutable.MutableList import org.bowlerframework.Session class BowlerHttpSession(session: Option[HttpSession]) extends Session { def getId = if(!session.isEmpty) session.get.getId else null private val errors = "_bo...
Explain and rewrite the following Scala code:
/* * Copyright (C) 2016-2019 Lightbend Inc. <https://www.lightbend.com> */ package com.lightbend.lagom.scaladsl.persistence.jdbc import akka.actor.ActorSystem import akka.stream.{ ActorMaterializer, Materializer } import com.lightbend.lagom.scaladsl.persistence.TestEntity.Evt import com.lightbend.lagom.scaladsl.per...
Explain and rewrite the following Scala code:
/* * Copyright 2016 The BigDL Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agr...
Explain and rewrite the following Scala code:
// Copyright : (C) 2012 Rúnar Bjarnason, Paul Chiusano, Dan Doel, Edward Kmett // License : BSD-style (see the file LICENSE) package com.clarifi.machines /** * Finite state automata. */ trait Automaton[-I, +O] { def process: Process[I, O] } import Plan._ /** * Mealy machines. */ case class Mealy[-I, +...
Explain and rewrite the following Scala code:
package org.jetbrains.plugins.scala import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase import com.intellij.testFramework.{IdeaTestUtil, LightProjectDescriptor} import com.intellij.openapi.projectRoots.impl.JavaSdkImpl import lang.psi.impl.toplevel.synthetic.SyntheticClasses import util.TestUtil...
Explain and rewrite the following Scala code:
package com.todesking.platebuilder sealed abstract class HList class HNil extends HList class ::[A, B <: HList] extends HList object HList { type HNel = `::`[_, _ <: HList] sealed abstract class Concat[A <: HList, B <: HList] { type Result <: HList } final class ConcatR[A <: HList, B <: HList, R <: HList...
Explain and rewrite the following Scala code:
package im.actor.server.persist.push import scala.concurrent.ExecutionContext import slick.driver.PostgresDriver.api._ import im.actor.server.models class ApplePushCredentialsTable(tag: Tag) extends Table[models.push.ApplePushCredentials](tag, "apple_push_credentials") { def authId = column[Long]("auth_id", O.Pri...
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.eigengo.akkapatterns.api import java.util.{UUID, Date} import spray.json.DefaultJsonProtocol import org.eigengo.scalad.mongo.sprayjson.{SprayMongo, SprayMongoCollection, DateMarshalling, UuidMarshalling} import org.eigengo.akkapatterns.domain.Configured import com.mongodb.DB import spray.http._ import spra...
Explain and rewrite the following Scala code:
package model import com.wordnik.swagger.annotations.{ ApiModelProperty, ApiModel } import org.joda.time.DateTime import spray.json.DefaultJsonProtocol import utils.ApiFormats._ import scala.annotation.meta.field /** * Created by gneotux on 16/07/15. */ @ApiModel(description = "An event day entity") case class Even...
Explain and rewrite the following Scala code:
/** * Copyright 2011-2012 @WalmartLabs, a division of Wal-Mart Stores, 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 * * Unl...
Explain and rewrite the following Scala code:
/* * 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 * distribute...
Explain and rewrite the following Scala code:
package kofre.decompose.interfaces import kofre.decompose.* import kofre.decompose.CRDTInterface.DeltaMutator import kofre.decompose.interfaces.AuctionInterface.Bid.User import kofre.decompose.interfaces.RubisInterface.{AID, UserAsUIJDLattice} object RubisInterface { type AID = String type State = (AWSetInterfac...
Explain and rewrite the following Scala code:
package dotty.tools.tasty class UnpickleException(msg: String) extends RuntimeException(msg)
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:
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may ...
Explain and rewrite the following Scala code:
package com.rafkind.platformer import java.awt._ import java.awt.image._ import javax.swing._ import java.io._ import javax.imageio._ import java.awt.event._ import javax.swing.event._ import org.swixml.SwingEngine import javax.swing.filechooser.FileFilter import scala.collection.immutable.List import com.rafkind.pa...
Explain and rewrite the following Scala code:
package scalapb.grpc import io.grpc.stub.StreamObserver import io.grpc.{CallOptions, Channel, MethodDescriptor} import scala.jdk.CollectionConverters._ import scala.concurrent.Future object ClientCalls { def blockingUnaryCall[ReqT, RespT]( channel: Channel, method: MethodDescriptor[ReqT, RespT], o...
Explain and rewrite the following Scala code:
/* * Copyright (C) FuseSource, Inc. * http://fusesource.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 ...
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 io.udash.bootstrap.pagination import com.avsystem.commons._ import io.udash._ import io.udash.testing.AsyncUdashCoreFrontendTest import io.udash.wrappers.jquery._ import org.scalajs.dom.Element import scala.concurrent.Future class UdashPaginationTest extends AsyncUdashCoreFrontendTest { "UdashPagination co...
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 ...
Explain and rewrite the following Scala code:
/* * Copyright 1998-2015 Linux.org.ru * 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:
/* * 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 sys pack...
Explain and rewrite the following Scala code:
package com.yammer.dropwizard.scala.inject.tests import org.junit.Test import com.sun.jersey.core.util.MultivaluedMapImpl import com.simple.simplespec.Spec import com.yammer.dropwizard.scala.inject.ScalaOptionStringExtractor class ScalaOptionStringExtractorTest extends Spec { class `Extracting a parameter` { v...
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 negatronic import org.scalatest.{FlatSpec, Matchers} import scala.math.abs /** * Created by darnold on 7/16/16. */ class MathSpec extends FlatSpec with Matchers { "Factorial" should "map 0 to 1" in { Math.factorial(0) should be (1) } it should "map 1 to 1" in { Math.factorial(1) should be (1...
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...
Explain and rewrite the following Scala code:
package juan.ddd.proto import _root_.akka.actor.ActorRefFactory import com.google.inject.{Guice, Provides} import juan.ddd.proto.adapter.RestComponent import juan.ddd.proto.external.rest.{RestService, RestServiceActor} import net.codingwell.scalaguice.ScalaModule import org.scalatest.concurrent.IntegrationPatience imp...
Explain and rewrite the following Scala code:
package com.tobe.data import org.apache.hadoop.fs.{FileSystem, Path} import org.apache.hadoop.io.{BytesWritable, NullWritable} import org.apache.spark.rdd.RDD import org.apache.spark.{SparkConf, SparkContext} import org.tensorflow.example._ import org.tensorflow.hadoop.io.TFRecordFileOutputFormat /** * Generate den...
Explain and rewrite the following Scala code:
object Solution { import java.util.Arrays.binarySearch def sievePrimeGenerator(n: Int): (List[Int], Array[Boolean]) = { val nums = Array.fill(n + 1)(true) val primes = for (i <- (2 to n).toList if nums(i)) yield { var j = 2 while (i * j <= n) { nums(i * j) = false j += 1 }...
Explain and rewrite the following Scala code:
package org.denigma.kappa import java.io.InputStream import org.denigma.kappa.messages.WebSimMessages._ /** * Created by antonkulaga on 04/04/16. */ object KappaRes extends KappaRes trait KappaRes { def read(res: String): Iterator[String] = { val stream : InputStream = getClass.getResourceAsStream(res) ...