instruction stringclasses 1
value | output stringlengths 5 1M |
|---|---|
Explain and rewrite the following Scala code: | package com.wavesplatform.lang.v1.repl.node.http
import cats.implicits._
import cats.{Functor, Id}
import com.wavesplatform.common.state.ByteStr
import com.wavesplatform.common.utils.{Base58, EitherExt2}
import com.wavesplatform.lang.v1.repl.node.http.NodeClient._
import com.wavesplatform.lang.v1.repl.node.http.respon... |
Explain and rewrite the following Scala code: | package gapt.proofs.gaptic
import gapt.expr._
import gapt.expr.formula.All
import gapt.expr.formula.Atom
import gapt.expr.formula.Ex
import gapt.expr.formula.Formula
import gapt.expr.subst.PreSubstitution
import gapt.expr.util.freeVariables
import gapt.expr.util.syntacticMatching
import gapt.formats.babel.BabelSignatu... |
Explain and rewrite the following Scala code: | package knights
import processing.core._
import processing.core.PConstants._
import scala.util.Random
import java.util.Arrays.ArrayList
import java.io.File
class Game {
} |
Explain and rewrite the following Scala code: | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... |
Explain and rewrite the following Scala code: | package net.kemuridama.kafcon.route
import akka.http.scaladsl.model.StatusCodes
import net.kemuridama.kafcon.model.{APIResponse, CreateTopicRequest}
import net.kemuridama.kafcon.protocol.{TopicJsonProtocol, CreateTopicRequestJsonProtocol}
import net.kemuridama.kafcon.service.{UsesTopicService, MixinTopicService}
tra... |
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 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 commanders.unite
import scala.util.Random
/**
* Created by Tommy Ettinger on 7/24/2014.
*/
object Extensions
{
val r = new Random()
implicit class RandElement[T](l: Seq[T])
{
def RandomElement(): Option[T] = if (l.isEmpty) None else Some(l(r.nextInt(l.length)))
}
/*
class RandElement[T >... |
Explain and rewrite the following Scala code: | package extruder.meta
import cats.data.{Chain, NonEmptyChain, NonEmptyVector}
import shapeless.Typeable
import shapeless.syntax.typeable._
import scala.reflect.ClassTag
trait TypeableInstances {
implicit def chain[A](implicit mChain: ClassTag[Chain[_]], castT: Typeable[A]): Typeable[Chain[A]] =
new Typeable[Ch... |
Explain and rewrite the following Scala code: | package inloopio.indicator.function
import inloopio.math.signal.Side
import inloopio.math.timeseries.Null
import inloopio.math.timeseries.TBaseSer
import inloopio.math.indicator.Factor
/**
*
* @author Caoyuan Deng
*/
class ZIGZAGFunction(_baseSer: TBaseSer, var percent: Factor) extends Function(_baseSer) {
val ... |
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 adapter.bitflyer.realtime
import com.pubnub.api.PNConfiguration
import com.pubnub.api.callbacks.SubscribeCallback
/**
* Created by ryuhei.ishibashi on 2017/07/06.
*/
object PubNubReceiver {
def start(productCode: String, key: String, callback: SubscribeCallback) = {
import java.util
import com.... |
Explain and rewrite the following Scala code: | package snakesladders.domain.services
import akka.actor.ActorSystem
import akka.testkit.{ImplicitSender, TestKit}
import org.scalatest.{BeforeAndAfterAll, Matchers, WordSpecLike}
import snakesladders.domain.events.{GameEvent, PlayerRolledDice}
import snakesladders.domain.models.Players.Player
import snakesladders.doma... |
Explain and rewrite the following Scala code: | package org.jetbrains.plugins.scala
package findUsages
package parameters
import com.intellij.psi.search.searches.ReferencesSearch
import com.intellij.util.{Processor, QueryExecutor}
import org.jetbrains.plugins.scala.lang.psi.api.base.ScReferenceElement
import com.intellij.psi._
import search.{UsageSearchContext, Psi... |
Explain and rewrite the following Scala code: | //
// Types.scala -- Scala object Types
// Project OrcScala
//
// $Id: Types.scala 2933 2011-12-15 16:26:02Z jthywissen $
//
// Created by dkitchin on Nov 30, 2010.
//
// Copyright (c) 2011 The University of Texas at Austin. All rights reserved.
//
// Use and redistribution of this file is governed by the license terms... |
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: | /*
* 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 dk.bayes.clustergraph
import factor._
import ClusterGraph._
import scala.collection._
import dk.bayes.clustergraph.factor.Var
import dk.bayes.clustergraph.factor.Factor
/**
* Default impimport dk.bayes.clustergraph.Edge
import dk.bayes.clustergraph.ClusterGraph
import dk.bayes.clustergraph.Cluster
lementatio... |
Explain and rewrite the following Scala code: | import Bowling._
import org.scalatest._
class BowlingTest extends FlatSpec with Matchers {
behavior of "A bowling Game roller"
it should "return a list of one frame when rolling 2 balls" in {
assert(NewGame().rollFrame(0, 0) == InCourseGame(List(NumberFrame(0, 0))))
}
object Roller {
def roll(frame:... |
Explain and rewrite the following Scala code: | /*
* Copyright 2016 Ben Ripkens
*
* 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: | /*
* 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 testextern
import leon.lang._
import leon.annotation._
import leon.lang.synthesis._
import leon.collection._
object ExternTest {
// All types 1
def test1() = {
allTypes1(false, (1,2), ExternFoo(12), Bar(false))
}
// All types 2
def test2() = {
allTypes2(Set(1,2,3), Map(1->2))
}
// Exte... |
Explain and rewrite the following Scala code: | package openscad
import openscad.OpenSCAD._
object Builders {
/**
* Creates a round beam from point to point.
*/
def beam(p1 : Vec3, p2 : Vec3, d : Double = 1) : SObject = {
val r = d / 2
// val o = sphere(r = r)
// val o = rotate(Vec3(0, math.Pi/2, 0), cube(size = Vec3(d, d, d)))
val o = cy... |
Explain and rewrite the following Scala code: | package org.overviewproject.pdfocr
import java.awt.image.BufferedImage
import java.io.FileNotFoundException
import java.nio.file.{Files,Path,Paths}
import java.util.Locale
import org.mockito.ArgumentMatchers.any
import org.mockito.Mockito.{never,when,verify}
import org.scalatest.BeforeAndAfter
import scala.concurrent.... |
Explain and rewrite the following Scala code: | package com.avsystem.scex
package japi
import java.lang.reflect.Type
import java.{util => ju}
import com.avsystem.scex.compiler.JavaTypeParsing._
import com.avsystem.scex.compiler.presentation.ScexPresentationCompiler
import com.avsystem.scex.compiler.{ExpressionDef, ScexCompiler}
import com.avsystem.scex.util.Fluent... |
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 2018 Secure Decisions, a division of Applied Visions, 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
*
* Unles... |
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 java.nio
import scala.scalajs.js.typedarray._
private[nio] final class DataViewCharBuffer private (
override private[nio] val _dataView: DataView,
_initialPosition: Int, _initialLimit: Int, _readOnly: Boolean,
override private[nio] val isBigEndian: Boolean)
extends CharBuffer(_dataView.byteLen... |
Explain and rewrite the following Scala code: | /*
*
* ____ __ ____________ ______
* / __/______ _/ /__ /_ __/ _/ //_/_ /
* _\\ \\/ __/ _ `/ / _ `// / _/ // ,< / /_
* /___/\\__/\\_,_/_/\\_,_//_/ /___/_/|_| /___/
*
* A PGF/TIKZ plot library for Scala.
*
*/
package scalatikz.pgf.enums
import enumeratum._
import scala.collection.immutab... |
Explain and rewrite the following Scala code: | // Copyright 2012 Foursquare Labs Inc. All Rights Reserved.
package io.fsq.common.scala
import scala.math.Numeric
final class Identity[A](val _value: A) extends AnyVal {
def =?(other: A): Boolean = _value == other
def !=?(other: A): Boolean = _value != other
@deprecated("unexpected operator precedence in bool... |
Explain and rewrite the following Scala code: | package probability.random
import au.id.cxd.math.probability.analysis.AndersonDarlingTest
import au.id.cxd.math.probability.continuous.Gamma
import au.id.cxd.math.probability.random.RGamma
import org.scalatest.{FlatSpec, Matchers}
class TestRGamma extends FlatSpec with Matchers {
"rgamma" should "produce variates ... |
Explain and rewrite the following Scala code: | package com.productfoundry.akka.cqrs.process
import com.productfoundry.akka.cqrs.EntityState
/**
* Process manager event used for persisting process state
*/
trait ProcessManagerEvent
extends EntityState |
Explain and rewrite the following Scala code: | /*!
* Copyright 2013-2014 Dennis Hörsch.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or ... |
Explain and rewrite the following Scala code: | package honor
import models.db.{MinimumRanking, MyfleetRanking}
import ranking.common.RankingType
import scalikejdbc._
import scala.collection.breakOut
/**
*
* @author ponkotuy
* Date: 15/03/17.
*/
object RankingTop extends HonorCategory {
override def category: Int = 3
override def approved(memberId: Long,... |
Explain and rewrite the following Scala code: | package com.acme.integration
// import scalaxy.debug._
import scalaxy.loops._
import scalaxy.beans._
import scalaxy.reified._
import scala.language.postfixOps
import org.junit._
import org.junit.Assert._
class IntegrationTest {
@Test
def testLoops {
var tot = 0
for (i <- 0 to 10 optimized;
j <-... |
Explain and rewrite the following Scala code: | /*
* Copyright (C) 2014-2016 Stichting Mapcode Foundation (http://www.mapcode.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
*
... |
Explain and rewrite the following Scala code: | package org.hawkular.ircbot
/**
* @author Jirka Kremser
*
*/
object Color {
val NORMAL = "\u000f";
val BOLD = "\u0002";
val UNDERLINE = "\u001f";
val REVERSE = "\u0016";
val WHITE = "\u000300";
val BLACK = "\u000301";
val DARK_BLUE = "\u000302";
val DARK_GREEN = "\u000303";
val RED = "\u000304";
... |
Explain and rewrite the following Scala code: | import natural_numbers.Zero
import presistent.binary_tree.EmptyLeaf
object Main extends App {
def hr = println("\\n----------\\n")
println("Topic 1")
println("Pure Object Orientation")
println("Scala is a pure-object-oriented language where every function and value is an object")
println()
val one = Zer... |
Explain and rewrite the following Scala code: | package ingraph.compiler.sql.driver
import java.lang.{Boolean => javaBoolean, Double => javaDouble, Long => javaLong}
import java.util.{List => javaList, Map => javaMap}
import org.neo4j.driver.v1.types.Path.Segment
import org.neo4j.driver.v1.types.{Node, Path, Relationship}
import org.opencypher.tools.tck.values._
... |
Explain and rewrite the following Scala code: | package at.logic.gapt.testing
import at.logic.gapt.expr.{ FOLFunction, EqC, constants }
import at.logic.gapt.formats.leanCoP.LeanCoPParser
import java.io._
import java.nio.file.{ Paths, Files }
import at.logic.gapt.examples._
import at.logic.gapt.formats.veriT.VeriTParser
import at.logic.gapt.proofs.lkNew._
import at.... |
Explain and rewrite the following Scala code: | /*
* Cerres (c) 2012-2014 EPFL, Lausanne
*/
import ceres.common._
import ceres.affine._
import cerres.examples._
import FunctionLibrary._
import cerres.algorithms._
import ceres.common.{QuadDouble => QD}
import QD._
object CerresMain extends App with MultivariateApplications {
val res = doublePendulumQD(1.0e-16)... |
Explain and rewrite the following Scala code: | package io.buoyant.telemetry.influxdb
import com.twitter.finagle.Stack
import com.twitter.finagle.util.LoadService
import io.buoyant.config.Parser
import io.buoyant.telemetry.{TelemeterConfig, TelemeterInitializer}
import io.buoyant.test.FunSuite
class InfluxDbTelemeterInitializerTest extends FunSuite {
test("io.l... |
Explain and rewrite the following Scala code: | package com.twitter.finatra.thrift.tests
import com.twitter.finagle.ThriftMux
import com.twitter.finatra.thrift.EmbeddedThriftServer
import com.twitter.finatra.thrift.tests.inheritance.InheritanceThriftTwitterServer
import com.twitter.inject.server.PortUtils
import com.twitter.io.Buf
import com.twitter.scrooge.{Reques... |
Explain and rewrite the following Scala code: | package org.jetbrains.plugins.scala.annotator
import com.intellij.openapi.util.TextRange
import com.intellij.lang.ASTNode
import java.lang.String
import com.intellij.psi.PsiElement
import com.intellij.lang.annotation.{Annotation, AnnotationSession, HighlightSeverity, AnnotationHolder}
/**
* Pavel.Fatin, 18.05.2010
... |
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: | /*
* 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: | package stealthnet.scala.network.protocol.commands
import java.io.InputStream
import stealthnet.scala.Constants
import stealthnet.scala.network.protocol.Encryption
import suiryc.scala.util.Hash
/**
* Search command companion object.
*/
object SearchCommand extends CommandBuilder {
val code: Byte = 0x20
def ar... |
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.codesimples.simple.restapi
import javax.servlet.ServletContext
import akka.actor.{ActorSelection, ActorSystem}
import com.typesafe.config.Config
import org.scalatra.LifeCycle
class ScalatraBootstrap extends LifeCycle {
override def init(context: ServletContext) {
val system = ActorSystem("sizebayRe... |
Explain and rewrite the following Scala code: | /*
* Copyright 2011-2021 Mathias Doenitz
*
* 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: | import org.parsec.protocol.EthereumCryptography
import org.scalatest.{FlatSpec, Matchers}
class EthereumCryptographyTests extends FlatSpec with Matchers with EthereumCryptography {
"Ethereum addresses" should "be derived correctly from public keys" in {
val publicKey = "bb48ae3726c5737344a54b3463fec499cb108a7d11... |
Explain and rewrite the following Scala code: |
package apps
/** The `dynamics` package contains example applications for continuous
* simulation models based on Ordinary Differential Equations 'ODE's
* or Partial Differential Equations 'PDE's.
*/
package object dynamics { }
|
Explain and rewrite the following Scala code: | package algorithms.search
import scala.util.Random
import org.scalatest.{FunSuite, WordSpec}
import SimilarPair._
/**
* Created by yujieshui on 2017/6/27.
*/
class SimilarPairTest extends WordSpec {
"solution" in {
val n = 5
val k = 2
val data = Seq(
Node(3, 2),
Node(3, 1),
Node(... |
Explain and rewrite the following Scala code: | import sbt._
object Dependencies {
def xml(scalaV: ScalaVer): ModuleID = {
val v = scalaV match {
case ScalaVer._211 => "1.3.0"
case ScalaVer._212 => "2.0.0"
case ScalaVer._213 => "2.0.0"
case ScalaVer._300 => "2.0.0"
}
"org.scala-lang.modules" %% "scala-xml" % v
}
def sca... |
Explain and rewrite the following Scala code: | package dotty.tools.scaladoc
package site
import java.io.File
import java.nio.file.Files
import com.vladsch.flexmark.ext.anchorlink.AnchorLinkExtension
import com.vladsch.flexmark.ext.autolink.AutolinkExtension
import com.vladsch.flexmark.ext.emoji.EmojiExtension
import com.vladsch.flexmark.ext.gfm.strikethrough.Stri... |
Explain and rewrite the following Scala code: |
import sbt._
import Keys._
object Dependencies{
//The closure compiler that play uses - we expect this to be provided by the play app.
val closureCompiler = ("com.google.javascript" % "closure-compiler" % "rr2079.1" )
.exclude("args4j", "args4j")
.exclude("org.json", "json")
... |
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 raft
import org.scalatest._
class ReplicatedStateMachineSpec extends WordSpecLike
with MustMatchers with BeforeAndAfterEach {
var rsm: TotalOrdering = _
override def beforeEach = rsm = new TotalOrdering()
"a replicated state machine" must {
"increment counter on get" in {
rsm.execute(Ge... |
Explain and rewrite the following Scala code: | // Databricks notebook source exported at Tue, 28 Jun 2016 11:22:17 UTC
// MAGIC %md
// MAGIC # [Scalable Data Science](http://www.math.canterbury.ac.nz/~r.sainudiin/courses/ScalableDataScience/)
// MAGIC
// MAGIC
// MAGIC ## Reading NetFlow files in Apache Spark
// MAGIC
// MAGIC ### Scalable data science project b... |
Explain and rewrite the following Scala code: | package testaus
import siirrot._
import scala.util.Random
/* Tulostettiin sarja satunnaisia laskuja. Ensimmäisessä testissä tarkastettiin oliko suunta vaihteen mukainen.
* Arvioitiin myös suunnan järkevyys suhteessa asteisiin. Toisessa testissä tulostettiin kaikkilla viidellä
* vaihdevaihtoehdolla, mutta tarkistett... |
Explain and rewrite the following Scala code: | /*
* Copyright 2020 CJWW Development
*
* 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: | //
// Copyright 2014-2020 Paytronix 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 ... |
Explain and rewrite the following Scala code: | package org.brzy.webapp.controller
import org.scalatest.WordSpec
import org.scalatest.matchers.ShouldMatchers
class TableSpec extends WordSpec with ShouldMatchers {
val list = List(
"One0",
"One1",
"One2",
"One3",
"One4",
"One5",
"One6",
"One7",
"One8",
"One9")
"Table" sh... |
Explain and rewrite the following Scala code: | package composition
import com.google.inject.name.Names
import com.tzavellas.sse.guice.ScalaModule
import play.api.Logger
import play.api.LoggerLike
import uk.gov.dvla.vehicles.presentation.common.filters.AccessLoggingConfig
import uk.gov.dvla.vehicles.presentation.common.filters.AccessLoggingFilter.AccessLoggerName
i... |
Explain and rewrite the following Scala code: | package name.filejunkie.osbmavenplugin.utils
import java.io.{StringReader, File}
import javax.xml.parsers.{DocumentBuilder, DocumentBuilderFactory}
import org.w3c.dom.Document
import org.xml.sax.InputSource
object XMLUtils {
private val documentBuilder = {
val documentBuilderFactory = DocumentBuilderFactory.new... |
Explain and rewrite the following Scala code: | /*
* The MIT License
*
* Copyright (c) 2017 Fulcrum Genomics LLC
*
* 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 us... |
Explain and rewrite the following Scala code: | /*************************************************************************
* *
* This file is part of the 20n/act project. *
* 20n/act enables DNA prediction for synthetic biology/bioengineering. *
* Copyright (C) 201... |
Explain and rewrite the following Scala code: | /*
* Copyright 2019 ACINQ SAS
*
* 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 bifrost.transaction.box.proposition
import com.google.common.primitives.{Bytes, Ints}
import bifrost.serialization.Serializer
import bifrost.transaction.box.proposition.PublicKey25519Proposition._
import bifrost.transaction.box.proposition._
import bifrost.transaction.state.PrivateKey25519
import scorex.crypto... |
Explain and rewrite the following Scala code: | package com.github.j5ik2o.reactive.redis.feature
import java.util.UUID
import cats.data.NonEmptyList
import com.github.j5ik2o.reactive.redis.command.CommandResponse
import com.github.j5ik2o.reactive.redis.command.transactions._
import com.github.j5ik2o.reactive.redis._
/**
* https://redis.io/commands#transactions
... |
Explain and rewrite the following Scala code: | package editors.bakery
import play.api.mvc.{AnyContent, Action, Controller}
import scala.concurrent.stm.Ref
import editors.{TwitterBootstrapLook, Mapping, Editors}
sealed trait IngredientUnit
case object GramPerFlourKilogram extends IngredientUnit
case object GramPerWaterLiter extends IngredientUnit
case class Ingre... |
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.openbee.test.bayesian
import org.junit._
import scala.collection.mutable
/**
* Created by fabien_s on 24/01/14.
*/
@Test
class CounterTest {
var counter: Counter = null
@Before
def init() {
val wordCounter = mutable.Map.empty[Word, mutable.Map[Category, Count]]
val categoryCounter = mut... |
Explain and rewrite the following Scala code: | package edu.rice.habanero.benchmarks.big
import edu.rice.habanero.actors.{ScalazActor, ScalazActorState, ScalazPool}
import edu.rice.habanero.benchmarks.big.BigConfig.{ExitMessage, Message, PingMessage, PongMessage}
import edu.rice.habanero.benchmarks.{Benchmark, BenchmarkRunner, PseudoRandom}
/**
* @author <a href=... |
Explain and rewrite the following Scala code: | /*
* bytefrog: a tracing framework for the JVM. For more information
* see http://code-pulse.com/bytefrog
*
* Copyright (C) 2014 Applied Visions - http://securedecisions.avi.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: | package com.rv.spark.sample
import org.apache.spark.SparkConf
import org.apache.spark.SparkContext
object SparkBigFileCounter {
def main(args: Array[String]) {
val filename = "/home/maya/akka-mine-sample/frwiki-20140331-pages-articles-multistream-index.txt"
val sparkConf = new SparkConf()
.set("... |
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.hydrosphere.mist.master.interfaces.async.kafka
import java.util.UUID
import java.util.concurrent.atomic.AtomicBoolean
import org.apache.kafka.clients.consumer.KafkaConsumer
import org.apache.kafka.clients.producer.{KafkaProducer, ProducerRecord}
import org.apache.kafka.common.serialization.{StringDeseriali... |
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: | /*
* 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 bifrost.scorexMod
import com.google.common.primitives.Longs
import bifrost.transaction.Transaction
import bifrost.transaction.box.BoxUnlocker
import bifrost.transaction.box.proposition.Proposition
/**
* Created by cykoz on 4/13/17.
*/
abstract class GenericBoxTransaction[P <: Proposition, T, BX <: Generic... |
Explain and rewrite the following Scala code: | /*
* Copyright 2015 Matt Massie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... |
Explain and rewrite the following Scala code: | /* Copyright 2009-2016 EPFL, Lausanne */
package leon
package utils
import java.io.File
import java.nio.file._
import scala.collection.JavaConversions._
import java.security.MessageDigest
import java.math.BigInteger
case class FilesWatcher(ctx: LeonContext, files: Seq[File]) {
val toWatch = files.map(_.getAbsolute... |
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: | /*
* 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 de.leanovate.play.etcd
import java.time.Instant
import play.api.libs.json._
sealed trait EtcdNode
case class EtcdValueNode(
key: String,
value: String,
createdIndex: Option[Long],
modifiedIndex: Option[Lon... |
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 quickcheck
import org.scalacheck.Arbitrary._
import org.scalacheck.Gen._
import org.scalacheck.Prop._
import org.scalacheck._
abstract class QuickCheckHeap extends Properties("Heap") with IntHeap {
lazy val genHeap: Gen[H] = oneOf(
const(empty),
for {
x <- arbitrary[Int]
y <- oneOf(con... |
Explain and rewrite the following Scala code: | /*
* Copyright (c) 2018 OVO Energy
*
* 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, publish,... |
Explain and rewrite the following Scala code: | /*
* Copyright 2011 javaBin
* 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: | /*
* Copyright (c) 2014-2020 by The Monix Project Developers.
* See the project homepage at: https://monix.io
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache... |
Explain and rewrite the following Scala code: | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... |
Explain and rewrite the following Scala code: | package au.com.nicta.postmark
package sending
/**
* Data type wrapping different responses from postmark
* @tparam A successful response value from postmark. For single emails, this would be a SentEmail. For batch emails,
* this would be a List[SentEmail]
*/
sealed trait PostmarkResponse[+A]
/**
* Post... |
Explain and rewrite the following Scala code: | package com.nulabinc.backlog.r2b.mapping.collector.modules
import com.nulabinc.backlog.r2b.redmine.conf.RedmineApiConfiguration
import com.nulabinc.backlog.r2b.redmine.modules.RedmineDefaultModule
/**
* @author
* uchida
*/
private[collector] class RedmineModule(apiConfig: RedmineApiConfiguration)
extends Red... |
Explain and rewrite the following Scala code: | package org.nexbook.app
import org.nexbook.tags.Integration
import org.scalatest.{FlatSpec, Matchers}
/**
* Created by milczu on 1/1/16.
*/
class AppConfig2IntegrationTest extends FlatSpec with Matchers {
"AppConfig" should "return name empty2" taggedAs Integration in {
System.setProperty("config.name", "empt... |
Explain and rewrite the following Scala code: | package dotty.tools.dotc
package util
import language.implicitConversions
/** Position format in little endian:
* Start: unsigned 26 Bits (works for source files up to 64M)
* End: unsigned 26 Bits
* Point: unsigned 12 Bits relative to start
* NoPosition encoded as -1L (this is a normally invalid position
* b... |
Explain and rewrite the following Scala code: | package org.marxc.ast
import org.objectweb.asm.{Opcodes, MethodVisitor, Label}
import org.objectweb.asm.Opcodes._
import org.marxc.SymbolTable
case class OrNode(expression: AstNode, operand: AstNode) extends ExpressionNode {
def generate(mv: MethodVisitor, symbolTable: SymbolTable) {
val eitherTrue = new Labe... |
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.tools.nsc
impor... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.