instruction stringclasses 1
value | output stringlengths 5 1M |
|---|---|
Explain and rewrite the following Scala code: | /**
* Copyright (c) 2013, The National Archives <digitalpreservation@nationalarchives.gov.uk>
* http://www.nationalarchives.gov.uk
*
* 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://mozi... |
Explain and rewrite the following Scala code: | /*
* Copyright 2015 RONDHUIT Co.,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 or agre... |
Explain and rewrite the following Scala code: |
import sbt._
import Keys._
object LazyglotBuild extends Build {
val hwsettings = Defaults.defaultSettings ++ Seq(
)
lazy val project = Project (
"project",
file ("."),
settings = hwsettings ++ Seq()
)
} |
Explain and rewrite the following Scala code: | package slick.jdbc
import java.sql.PreparedStatement
import slick.util.{TableDump, SlickLogger, CloseableIterator}
import org.slf4j.LoggerFactory
import scala.collection.compat._
import scala.collection.mutable.ArrayBuffer
private[jdbc] object StatementInvoker {
val maxLogResults = 5
lazy val tableDump = new Tabl... |
Explain and rewrite the following Scala code: | trait IOI {
def ioi = 2
}
trait E extends IOI {
trait FF {
def ioi = 1
}
trait F extends FF {
def foo = {
E.super.ioi
"stop here"
}
}
def moo {new F{}.foo}
}
object Sample extends A {
def main(args: Array[String]) {
new E {}.moo
}
} |
Explain and rewrite the following Scala code: | package slick.basic
import scala.language.experimental.macros
import scala.annotation.{StaticAnnotation, Annotation}
import scala.reflect.ClassTag
import scala.reflect.macros.blackbox.Context
import scala.util.control.NonFatal
import java.net.{URL, URI}
import slick.util.{SlickLogger, ClassLoaderUtil}
import slick.u... |
Explain and rewrite the following Scala code: | package coursier.parse
import coursier.core.{
Attributes,
Classifier,
Configuration,
Dependency,
Extension,
Module,
ModuleName,
Organization,
Publication,
Type
}
import coursier.util.ValidationNel
import coursier.util.Traverse._
object DependencyParser {
def dependency(
input: String,
d... |
Explain and rewrite the following Scala code: | package debop4s.mongo.spring
import java.util
import java.util.concurrent.ConcurrentHashMap
import org.slf4j.LoggerFactory
import org.springframework.beans.factory.DisposableBean
import org.springframework.cache.{Cache, CacheManager}
import org.springframework.data.mongodb.core.MongoTemplate
object MongoCacheManager... |
Explain and rewrite the following Scala code: | package im.actor.server.push.actor
import akka.NotUsed
import akka.actor._
import akka.event.Logging
import akka.stream.{ ActorMaterializer, OverflowStrategy }
import akka.stream.scaladsl.{ Flow, Sink, Source }
import im.actor.server.db.DbExtension
import im.actor.server.model.push.ActorPushCredentials
import im.actor... |
Explain and rewrite the following Scala code: | /* __ *\\
** ________ ___ / / ___ __ ____ Scala.js Test Suite **
** / __/ __// _ | / / / _ | __ / // __/ (c) 2013, LAMP/EPFL **
** __\\ \\/ /__/ __ |/ /__/ __ |/_// /_\\ \\ http://scala-js.org/ **
** /____/\\___/... |
Explain and rewrite the following Scala code: | package dk.tennis.compare.rating.multiskill.model.pointcormodel
import dk.bayes.math.gaussian.canonical.DenseCanonicalGaussian
trait PointCorModel {
/**
* Returns posterior marginals for player1 and player2 given player1 is a winner or loser.
*
* @param directSkills Skills for players 1 and 2
* @param... |
Explain and rewrite the following Scala code: | package dao
import javax.inject.{Inject, Singleton}
import models.Token
import models.Token._
import play.api.Logger
import play.api.libs.json.Json
import play.modules.reactivemongo.json.collection.JSONCollection
import play.modules.reactivemongo.{ReactiveMongoComponents, ReactiveMongoApi}
import reactivemongo.bson.B... |
Explain and rewrite the following Scala code: | package models
import scalikejdbc._
import skinny.orm.{Alias, SkinnyJoinTable, SkinnyNoIdCRUDMapper}
case class MissionStation(missionId: Long, stationId: Long) {
def save()(implicit session: DBSession): Unit = MissionStation.save(this)
}
object MissionStation extends SkinnyNoIdCRUDMapper[MissionStation] with Skin... |
Explain and rewrite the following Scala code: | package xyz.seto.obscene.example
import scala.collection.JavaConversions._
import com.badlogic.gdx.Gdx
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.graphics.g2d.Batch
import com.badlogic.gdx.graphics.glutils.ShapeRenderer
import com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType
import com.ba... |
Explain and rewrite the following Scala code: | package com.equalinformation.interview.algo.scala.misc
/**
* Created by bpupadhyaya on 6/10/16.
*/
class Counter {
private var value = 0
def increment(): Unit = {
value += 1
}
def current() = value
}
|
Explain and rewrite the following Scala code: | package com.github.mogproject.redismock.util
package object ops {
implicit class IdOps[A](val self: A) extends AnyVal {
/**
* pipeline processing
* @param f function
* @tparam B return type
* @return
*/
final def |>[B](f: A => B): B = f(self)
/**
* do the side effect with ... |
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 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: | object MyApp extends App {
hi
println("i'm here!")
def hi = println("Hello there!")
} |
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 unfiltered.util
trait IO {
/** Manage the usage of some object that must be closed after use */
def use[C <: { def close() }, T](c: C)(f: C => T): T = try {
f(c)
} finally {
c.close()
}
}
object IO extends IO |
Explain and rewrite the following Scala code: | package controllers.circs.start_of_process
import app.ReportChange._
import controllers.CircumstancesScenarioFactory
import org.openqa.selenium.By
import org.specs2.mutable._
import utils.WithBrowser
import utils.pageobjects.circumstances.origin.GOriginPage
import utils.pageobjects.{TestData, PageObjects}
import utils... |
Explain and rewrite the following Scala code: | package dotty.tools.dotc
package util
import java.util.NoSuchElementException
// test
class SparseIntArray:
import SparseIntArray._
private var siz: Int = 0
private var root: Node = LeafNode()
private def grow() =
val newRoot = InnerNode(root.level + 1)
newRoot.elems(0) = root
root = newRoot
... |
Explain and rewrite the following Scala code: | /**
* Copyright (C) 2010 Orbeon, Inc.
*
* This program 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.1 of the License, or (at your option) any later version.
*
* This program i... |
Explain and rewrite the following Scala code: | /**
* This file is part of the TA Buddy project.
* Copyright (c) 2013-2015 Alexey Aksenov ezh@ezh.msk.ru
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Global License version 3
* as published by the Free Software Foundation with the addition... |
Explain and rewrite the following Scala code: | package org.nedervold.grammareditor
/**
* A grammar of grammars
*
* @author nedervold
*/
package object grammar {
/**
* Alternates (joins with [[Or]]) the given terms into a single one.
* @param ts the terms to alternate
* @return an alternated term or [[Fail]]
*/
def alternate(ts: Term... |
Explain and rewrite the following Scala code: | package com.github.bespalovdn.asteriskscala.agi.handler.impl
import com.github.bespalovdn.asteriskscala.agi.command.AgiCommand
import com.github.bespalovdn.asteriskscala.agi.command.response.{AgiResponse, FailResponse}
import com.github.bespalovdn.asteriskscala.agi.handler.{AgiHandler, ChannelHandlerContextProvider}
i... |
Explain and rewrite the following Scala code: | package com.rasterfoundry.datamodel
import com.typesafe.scalalogging.LazyLogging
import geotrellis.vector.{Geometry, Projected}
import io.circe.{Decoder, Encoder}
import io.circe.generic.JsonCodec
import io.circe.generic.semiauto._
import java.sql.Timestamp
import java.util.UUID
import com.rasterfoundry.JsonCodecs
@... |
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: | /**
* Intel Intrinsics for Lightweight Modular Staging Framework
* https://github.com/ivtoskov/lms-intrinsics
* Department of Computer Science, ETH Zurich, Switzerland
* __ _ __ _ _
* / /____ ___ _____ (_)____ / /_ _____ (_)____ __... |
Explain and rewrite the following Scala code: | package bc
import vm.VirtualMachine
/**
* An exception representing an invalid bytecode. This can be used
* in any circumstance where a bytecode might be invalid.
*
* @param msg the exception message
*/
class InvalidBytecodeException(msg: String) extends Exception(msg)
/**
* [[ByteCodeValues]] is a trait... |
Explain and rewrite the following Scala code: | package io.dylemma.spac
package xml
import javax.xml.stream.{XMLEventReader, XMLStreamException}
private class WrappedEventReader(reader: XMLEventReader) extends Iterator[XmlEvent] with AutoCloseable {
def close() = reader.close()
def hasNext: Boolean = {
while(nextEvent.isEmpty && reader.hasNext) advance()
ne... |
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.ubirch.backend.storage
import java.net.URL
import com.typesafe.config.ConfigFactory
import com.typesafe.scalalogging.LazyLogging
import com.ubirch.backend.storage.config.{ServerConfig, ServerConst}
import uk.co.bigbeeconsultants.http.HttpClient
/**
* author: cvandrei
* since: 2016-08-19
*/
trait St... |
Explain and rewrite the following Scala code: | /*
* Copyright (c) 2012 Dame Ningen.
* All rights reserved.
*
* This file is part of Gausel.
*
* Gausel is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your o... |
Explain and rewrite the following Scala code: | package part1
object Exercise3bRecursion {
def contains(numbers: List[Int], num: Int): Boolean = {
???
}
def doubleEachNumber(numbers: List[Int]): List[Int] = {
???
}
def total(numbers: List[Int]): Int = {
???
}
def range(from: Int, to: Int): List[Int] = {
???
}
def append(a: List... |
Explain and rewrite the following Scala code: | package com.blinkbox.books.elasticsearch.client
import spray.http.StatusCode
case class GetResponse[T](
found: Boolean,
_index: String,
_type: String,
_id: String,
_version: Option[Long],
_source: Option[T]
)
case class MultiGetResponse[T](docs: Seq[GetResponse[T]])
case class ShardsStats(total: Int, su... |
Explain and rewrite the following Scala code: | class C1(var p: Int)
class C2 extends C1(1) {
println(/* line: 1 */ p)
} |
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: | package pl.pholda.malpompaaligxilo.form.action
import pl.pholda.malpompaaligxilo.form.{FormAction, FormInstance}
import pl.pholda.malpompaaligxilo.googleapi.Spreadsheet
case class AddToGoogleSpreadsheetFormAction(spreadsheet: Spreadsheet, worksheetTitle: String) extends FormAction {
override def run(formInstance: ... |
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: | import scala.reflect.runtime.universe._
import scala.reflect.runtime.{currentMirror => cm}
class A
trait B
object Test extends App {
val mutant = new A with B
val c = cm.classSymbol(mutant.getClass)
println(c)
println(c.fullName)
println(c.info)
}
|
Explain and rewrite the following Scala code: | package nasa.nccs.edas.engine.spark.api
import nasa.nccs.cdapi.data.RDDataManager
import nasa.nccs.edas.engine.EDASExecutionManager
import nasa.nccs.edas.rdd.CDRecord
import nasa.nccs.edas.sources.Collections
import org.apache.spark.rdd.RDD
import ucar.nc2
import ucar.nc2.constants.AxisType
abstract class EDASparkDat... |
Explain and rewrite the following Scala code: | package wandou.util.pinyin
import java.io.FileNotFoundException
import java.io.IOException
import scala.xml.Elem
import scala.xml.Node
import scala.xml.Text
import scala.xml.XML
/**
* A class contains logic that translates from Hanyu Pinyin to Gwoyeu Romatzyh
*
*
*/
object GwoyeuRomatzyhConverter {
... |
Explain and rewrite the following Scala code: | import java.nio.charset.StandardCharsets._
import javax.inject.{ Inject, Singleton }
import models.Token
import org.asynchttpclient.util.Base64
import play.api.Configuration
import play.api.cache.{ CacheApi, _ }
import play.api.http.HeaderNames._
import play.api.libs.ws.WSClient
import scala.concurrent.{ ExecutionCon... |
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 org.tensorflow.contrib
import com.twitter.bijection._
import org.tensorflow.Tensor
package object scala {
/**
* The element type of a ByteString tensor.
*
* @tparam T the embedded type that the bytestring represents.
*/
type ByteString[T] = Array[Byte] @@ T
/**
* Tensor tagging sup... |
Explain and rewrite the following Scala code: | package models.pagination
case class PageRequest(
val offset: Int,
val limit: Int,
val reverse: Boolean
)
|
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 ... |
Explain and rewrite the following Scala code: | /**
* Copyright (C) 2013 Kaj Magnus Lindberg (born 1979)
*
* This program 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.
... |
Explain and rewrite the following Scala code: | package viewmodels
import models.AccessRule
/**
* Created by Christian on 21.10.2016.
*/
object GeneralViewModels {
/*
* Permissions / Access Rules
*/
type PermissionMap = Map[String, AccessRuleViewModel]
type OptPermissionMap = Option[PermissionMap]
case class AccessRuleViewModel... |
Explain and rewrite the following Scala code: | /*
* Copyright (C) 2011 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 agreed... |
Explain and rewrite the following Scala code: | package se.uglisch.schematron.iso
import org.junit.Test
import org.junit.Assert._
import se.uglisch.xpathnode.XpathNode
import se.uglisch.resource.Resource
import java.io.File
import javax.xml.transform.stream.StreamSource
class SchemaTest {
@Test
def xpathQueryBinding: Unit = {
val sourceResource = Resource... |
Explain and rewrite the following Scala code: | /*
* Copyright © 2014 TU Berlin (emma@dima.tu-berlin.de)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by app... |
Explain and rewrite the following Scala code: | package com.stovokor.util
import com.jme3.scene.Spatial
import com.simsilica.lemur.event.CursorButtonEvent
import com.simsilica.lemur.event.CursorEventControl
import com.simsilica.lemur.event.DefaultCursorListener
import com.simsilica.lemur.event.CursorMotionEvent
import com.simsilica.lemur.input.InputMapper
import co... |
Explain and rewrite the following Scala code: | /*
* Copyright (C) Lightbend Inc. <https://www.lightbend.com>
*/
package play.core.routing
import java.util.Optional
import java.util.OptionalInt
import java.util.OptionalLong
import java.util.OptionalDouble
import play.api.http.HttpErrorHandler
import play.api.mvc._
import play.api.routing.HandlerDef
import play.... |
Explain and rewrite the following Scala code: | /**
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
*/
package akka.util
import akka.config.Config
import akka.actor.Actor
/*
* This class is responsible for booting up a stack of bundles and then shutting them down
*/
class AkkaLoader {
private val hasBooted = new Switch(false)
... |
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.partest
c... |
Explain and rewrite the following Scala code: | package reasonably.interact
import reasonably.Algebra._
import InteractAlgebra._
object Console extends (Interact ~> EitherType) {
def apply[A](i: Interact[A]) = i match {
case Ask(prompt) =>
println(prompt)
Right(scala.io.StdIn.readLine)
case Tell(msg) =>
Right(println(msg))
case End ... |
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 konstructs.shard
import scala.collection.mutable
import akka.actor.ActorRef
import konstructs.Db
import konstructs.api.{Position, LightLevel, Colour, BlockFactory}
object Light {
// A specific block which should be flooded by ambient light
case class AmbientLightFlood(position: Position, from: Position, ... |
Explain and rewrite the following Scala code: | package object random {
private val a = 1664525
private val b = 1013904223
private var seed = 0
def setSeed(seed:Int) {
this.seed = seed
}
def nextInt = {
seed = (seed * a + b)
seed
}
def nextDouble = 1.0 / nextInt
}
package random {}
object Test extends App {
random.setSeed(100)
... |
Explain and rewrite the following Scala code: | /*
* Copyright (C) 2016 Department for Business, Energy and Industrial Strategy
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) an... |
Explain and rewrite the following Scala code: | package com.alanjz.meerkat.app
import java.awt.FlowLayout
import javax.swing.JFrame
/**
* Created by alan on 12/22/14.
*/
class MCFrame extends Runnable {
private val frame = new JFrame("Meerkat chess")
val board = new MCBoardPane
val menuBar = new MCMenuBar
val tabs = new MCTabbedPane
private val th = ne... |
Explain and rewrite the following Scala code: | package name.abhijitsarkar.scala.scalaimpatient.traits
import java.io.InputStream
/* If we were to do an early initialization here, it'd be within curly braces after 'extends' and InputStream
* would become 'with'. Note that despite the keyword with, the class needs to be in the first position
* and you cannot ex... |
Explain and rewrite the following Scala code: | package org.ensime.sexp
import org.scalatest._
class SexpSpec extends FunSpec with Matchers {
val foostring = SexpString("foo")
val barstring = SexpString("bar")
val foosym = SexpSymbol("foo")
val barsym = SexpSymbol("bar")
val fookey = SexpSymbol(":foo")
val barkey = SexpSymbol(":bar")
describe("Sexp... |
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: | object approximateUnion {
trait C[+T]
trait D
trait E
trait X[-T]
{
trait A extends C[A] with D
trait B extends C[B] with D
val coin = true
val x = if (coin) new A{} else new B{}
val y = Some(if (coin) new A{} else new B{} )
val xtest: C[A | B] & D = x
val ytest: Some[C[A | B] ... |
Explain and rewrite the following Scala code: | package suiryc.scala.util
import org.scalatest.matchers.should.Matchers
import org.scalatest.wordspec.AnyWordSpec
import java.io.ByteArrayOutputStream
// scalastyle:off magic.number non.ascii.character.disallowed
class HexUndumperSpec extends AnyWordSpec with Matchers {
import HexUndumper._
// 00: 1CCC 54C6 88... |
Explain and rewrite the following Scala code: | package org.scalatra.test
import javax.servlet.{DispatcherType, Filter}
import javax.servlet.http.HttpServlet
import java.util.EnumSet
import org.eclipse.jetty.servlet._
object JettyContainer {
private val DefaultDispatcherTypes: EnumSet[DispatcherType] =
EnumSet.of(DispatcherType.REQUEST, DispatcherType.ASYNC)... |
Explain and rewrite the following Scala code: | package io.getquill.context
import scala.reflect.macros.whitebox.{ Context => MacroContext }
import io.getquill.ast._
import io.getquill.quotation.ReifyLiftings
import io.getquill.util.Messages._
import io.getquill.norm.BetaReduction
import io.getquill.util.EnableReflectiveCalls
class ActionMacro(val c: MacroContext)... |
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 com.github.gdefacci.briscola.presentation.game
import org.obl.raz.Api.PathMatchDecoder
import org.obl.raz.Api.PathCodec
import com.github.gdefacci.briscola.game.GameId
import com.github.gdefacci.briscola.player.PlayerId
trait GameRoutes {
def Games: PathMatchDecoder
def GameById: PathCodec.Symmetric[GameI... |
Explain and rewrite the following Scala code: | package wdl
import cats.data.Validated.Valid
import cats.syntax.validated._
import common.collections.EnhancedCollections._
import common.validation.ErrorOr.{ErrorOr, ShortCircuitingFlatMap}
import wdl.AstTools.{EnhancedAstNode, VariableReference}
import wdl.Declaration.{GraphOutputDeclarationNode, InputDeclarationNod... |
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: | sealed trait T
trait Trait extends T
class Clazz extends T
object Obj extends T
trait OpenTrait
trait OpenTrait2
class OpenClass
trait Unrelated
object Test {
type Alias1 = OpenTrait
def traitAndClass(s: T & Alias1) = s match {
case _: Unrelated => ;
}
type Alias2 = OpenTrait & OpenClass
def classOnly... |
Explain and rewrite the following Scala code: | package kornell.server.jdbc.repository
import java.math.BigDecimal
import java.math.BigDecimal._
import java.util.Date
import kornell.core.entity.ContentSpec._
import kornell.core.entity.{Assessment, ChatThreadType, Enrollment}
import kornell.core.lom.ContentsOps
import kornell.server.jdbc.SQL._
import kornell.server... |
Explain and rewrite the following Scala code: | package util.security
import collins.permissions.{PermissionsHelper, Privileges}
import collins.validation.File
import play.api.Logger
import com.google.common.cache.CacheLoader
import java.io.{File => IoFile}
case class PermissionsLoader(privileges: Privileges) extends CacheLoader[String, Privileges] {
private[t... |
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.opensplice.mobile.dev.dadds
import org.omg.dds.core.ServiceEnvironment
object Status {
import org.omg.dds.core.ServiceEnvironment
def AllStatus(implicit env: ServiceEnvironment) = env.getSPI.allStatusKinds()
def NoStatus(implicit env: ServiceEnvironment) = env.getSPI.noStatusKinds()
}
|
Explain and rewrite the following Scala code: | /**
* This file is part of the TA Buddy project.
* Copyright (c) 2014 Alexey Aksenov ezh@ezh.msk.ru
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Global License version 3
* as published by the Free Software Foundation with the addition of t... |
Explain and rewrite the following Scala code: | /**
* Copyright 2017 Interel
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed t... |
Explain and rewrite the following Scala code: | package com.danielasfregola.twitter4s.entities.authentication
import com.danielasfregola.twitter4s.http.serializers.FromMap
final case class OAuthRequestToken(token: RequestToken, oauth_callback_confirmed: Boolean)
final case class RequestToken(key: String, secret: String)
object OAuthRequestToken {
implicit val... |
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 n... |
Explain and rewrite the following Scala code: | package lara.epfl.scalasca.tests.unit.rules
import lara.epfl.scalasca.core._
import lara.epfl.scalasca.rules._
import scala.reflect.runtime.universe._
import org.junit._
trait UselessAssignmentTest extends BasicTest {
def runUATest(test: String) = super.runTest("uselessassignment", test)
@Test def UAFlatTest: Uni... |
Explain and rewrite the following Scala code: | package ch.uzh.ifi.pdeboer.pplib.patterns.pruners
/**
* Created by pdeboer on 27/11/14.
* Only makes sense if data is normally distributed.
*/
class SigmaCalculator(data: List[Double], numSigmas: Int = 3) {
assert(numSigmas >= 0)
lazy val sum: Double = data.reduce(_ + _)
lazy val mean: Double = sum / data.lengt... |
Explain and rewrite the following Scala code: | package de.frosner.ddq.constraints
import de.frosner.ddq.core.Check
import de.frosner.ddq.testutils.{SparkContexts, TestData}
import org.apache.spark.sql.AnalysisException
import org.scalatest.{FlatSpec, Matchers}
class AnyOfConstraintTest extends FlatSpec with Matchers with SparkContexts {
"An AnyOfConstraint" sh... |
Explain and rewrite the following Scala code: | class Foo[A] {
def baz(foo: Foo[_]): Unit = bar(foo)
def bam(foo: => Foo[_]) = bar(foo)
def bar[A](foo: Foo[A]): A = ???
}
|
Explain and rewrite the following Scala code: | /*
* Copyright (C) 2016 University of Basel, Graphics and Vision Research Group
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) an... |
Explain and rewrite the following Scala code: | package lila.pref
import play.api.libs.json.Json
import scala.concurrent.duration.Duration
import lila.db.BSON
import lila.db.Types._
import lila.memo.AsyncCache
import lila.user.User
import lila.hub.actorApi.SendTo
import reactivemongo.bson._
final class PrefApi(
coll: Coll,
cacheTtl: Duration,
bus: lil... |
Explain and rewrite the following Scala code: | /*
* Scala.js (https://www.scala-js.org/)
*
* Copyright EPFL.
*
* Licensed under Apache License 2.0
* (https://www.apache.org/licenses/LICENSE-2.0).
*
* See the NOTICE file distributed with this work for
* additional information regarding copyright ownership.
*/
package org.scalajs.testsuite.javalib.lang
im... |
Explain and rewrite the following Scala code: | /**
* Created on: Dec 15, 2013
*/
package com.tubros.constraints.api
import java.lang.ref.WeakReference
import java.util.concurrent._
/**
* The '''FastSymbol''' type is an optimized version of [[scala.Symbol]]. It
* benchmarks at 3x faster for existing instance lookup and just under 2x
* faster when creating a... |
Explain and rewrite the following Scala code: | package akka.persistence.kafka.snapshot
import com.typesafe.config.ConfigFactory
import akka.persistence._
import akka.persistence.SnapshotProtocol._
import akka.persistence.snapshot.SnapshotStoreSpec
import akka.persistence.kafka.KafkaCleanup
import akka.persistence.kafka.server._
import akka.testkit.TestProbe
clas... |
Explain and rewrite the following Scala code: | package com.gilt.opm.query
import com.gilt.opm.utils.MongoHelper
import com.mongodb.casbah.commons.{MongoDBList, MongoDBObject}
import MongoHelper.toMongo
/**
* Case class representing the logic to filter a property that is between the given values, exclusive.
*
* @param valueTranslator: see [[com.gilt.opm.query.O... |
Explain and rewrite the following Scala code: | package jk_5.nailed.util
import net.minecraft.server.MinecraftServer
import net.minecraft.network.packet.Packet
import net.minecraft.util.ChatMessageComponent
/**
* No description given
*
* @author jk-5
*/
object ServerUtils {
def broadcastChatMessage(msg: String) = MinecraftServer.getServer.getConfigurationMan... |
Explain and rewrite the following Scala code: | package com.example.swagger.sample.data
import com.example.swagger.sample.models._
object FlowerData {
var all = List(
Flower("yelow-tulip", "Yellow Tulip"),
Flower("red-rose", "Red Rose"),
Flower("black-rose", "Black Rose")
)
}
|
Explain and rewrite the following Scala code: | package glasskey.config
import com.typesafe.config.ConfigFactory
import org.scalatest.{FlatSpec, Matchers}
/**
* Created by loande on 2/26/15.
*/
class HttpConfigSpec extends FlatSpec with Matchers {
val httpConfigObj = ConfigFactory.parseString(" http {\\n interface = \\"0.0.0.0\\"\\n port = 8080\\n }")
... |
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 collins.util
import play.api.libs.json.Format
import play.api.libs.json.JsObject
import play.api.libs.json.JsSuccess
import play.api.libs.json.JsValue
import play.api.libs.json.Json
import collins.models.lldp.Interface
import collins.models.lldp.Interface.InterfaceFormat
import collins.models.lldp.LldpAttribu... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.