instruction stringclasses 1
value | output stringlengths 5 1M |
|---|---|
Explain and rewrite the following Scala code: | package pl.iterators.kebs.instances.time
import pl.iterators.kebs.instances.InstanceConverter
import pl.iterators.kebs.instances.time.LocalDateString.{LocalDateFormat, formatter}
import java.time.LocalDate
import java.time.format.DateTimeFormatter
trait LocalDateString {
implicit val localDateFormatter: InstanceCo... |
Explain and rewrite the following Scala code: | package colossus.core.server
import akka.actor._
import java.net.{InetSocketAddress, ServerSocket, StandardSocketOptions}
import java.nio.channels.{SelectionKey, Selector, ServerSocketChannel, SocketChannel}
import java.util.concurrent.atomic.AtomicReference
import colossus.core.{IOSystem, _}
import colossus.metrics.... |
Explain and rewrite the following Scala code: | package io.skysail.api.ddd
trait DddElement
trait Entity[T] extends DddElement {
def id: Option[T]
override def hashCode(): Int = id.hashCode()
override def equals(obj: scala.Any): Boolean = {
if (!obj.isInstanceOf[Entity[T]]) {
return false
}
val otherEntity = obj.asInstanceOf[Entity[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 ... |
Explain and rewrite the following Scala code: | package com.landoop.streamreactor.connect.hive.sink
import com.landoop.streamreactor.connect.hive.formats.{OrcHiveFormat, ParquetHiveFormat}
import com.landoop.streamreactor.connect.hive.{PartitionField, TableName, Topic}
import com.landoop.streamreactor.connect.hive.sink.config.HiveSinkConfig
import com.landoop.strea... |
Explain and rewrite the following Scala code: | object Strings extends App {
println("Joining " + "strings.")
val value = 3
println(s"The value $value is interpolated")
} |
Explain and rewrite the following Scala code: | /*
Copyright (c) 2017, Robby, Kansas State University
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of cond... |
Explain and rewrite the following Scala code: | import scala.collection.SeqLike
import perfplot._
import HWCounters.IvyBridge;
import java.io._
import java.util.regex.Pattern
import java.util.regex.Matcher
object AdvancedRoofline {
def main( args: Array[String] ) {
def extractName( raw_name:String ) = {
val pattern = Pattern.compile("bst_\\\\d+")
val m = p... |
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.transf... |
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 edu.ucsb.apss.compartmentalize
import edu.ucsb.apss.util.VectorWithNorms
import org.apache.spark.rdd.RDD
import scala.collection.mutable.ArrayBuffer
/**
* Created by dimberman on 4/15/16.
*/
class BucketCompartmentalizer(cSize: Int) extends Serializable {
def aggregateBucket(input:RDD[((Int,Int), Ve... |
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.apache.oodt.cas.resource.examples;
import org.apache.oodt.cas.resource.structs.SparkInstance;
import org.apache.oodt.cas.resource.structs.JobInput;
import org.apache.oodt.cas.resource.structs.NameValueJobInput;
import org.apache.spark.SparkContext;
/**
* @author starchmd
*
* An example class for use with t... |
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: | package security
import javax.inject.Singleton
import be.objectify.deadbolt.scala.{HandlerKey, DeadboltHandler}
import be.objectify.deadbolt.scala.cache.HandlerCache
/**
* @author Steve Chaloner (steve@objectify.be)
*/
@Singleton
class MyHandlerCache extends HandlerCache {
val defaultHandler: DeadboltHandler = ... |
Explain and rewrite the following Scala code: | package protocols
import models.misc._
import play.api.mvc.{Call, RequestHeader}
/**
* @author zepeng.li@gmail.com
*/
trait LinkHeader extends ExtHeaders {
/**
* Create link header for pagination.
*
* first and last are not supported yet.
*
* @param page current page
* @param call the function ... |
Explain and rewrite the following Scala code: | package a3 {
class Foo {
import b3.C
println(/* */C.getClass)
println(classOf[/* line: 8 */C])
}
package b3 {
case class C
}
} |
Explain and rewrite the following Scala code: | package nl.rabobank.oss.rules.testutils.nl
import nl.rabobank.oss.rules.dsl.nl.grammar.Berekening
import nl.rabobank.oss.rules.engine.FactEngine
import nl.rabobank.oss.rules.utils.PrettyPrinter
import nl.rabobank.oss.rules.engine.Context
import nl.rabobank.oss.rules.facts.Fact
import nl.rabobank.oss.rules.services._
... |
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 2016, deepsense.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 applicable law or agreed ... |
Explain and rewrite the following Scala code: | package com.wavesplatform.transaction
import com.wavesplatform.account.Address
case class AssetAcc(account: Address, assetId: Option[Asset])
|
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 writin... |
Explain and rewrite the following Scala code: | /*
* Copyright (C) 2015 Cotiviti Labs (nexgen.admin@cotiviti.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 req... |
Explain and rewrite the following Scala code: | def f(f: => Unit) = {}
println(/* */f {})
println(/* */f {1}) |
Explain and rewrite the following Scala code: | package com.twitter.jvm
import org.scalatest.funsuite.AnyFunSuite
class NumProcsTest extends AnyFunSuite {
test("return the number of available processors according to the runtime by default") {
assert(System.getProperty("com.twitter.jvm.numProcs") == null)
assert(numProcs() == Runtime.getRuntime().availab... |
Explain and rewrite the following Scala code: | import BIDMat.{CMat,CSMat,DMat,Dict,FMat,FND,GMat,GDMat,GIMat,GLMat,GSMat,GSDMat,GND,HMat,IDict,Image,IMat,LMat,Mat,SMat,SBMat,SDMat,TMat}
import BIDMat.MatFunctions._
import BIDMat.SciFunctions._
import BIDMat.Solvers._
import BIDMat.Plotting._
Mat.checkMKL(false)
Mat.checkCUDA(true)
|
Explain and rewrite the following Scala code: | /*
* Copyright (C) 2017 HAT Data Exchange Ltd
* SPDX-License-Identifier: AGPL-3.0
*
* This file is part of the Hub of All Things project (HAT).
*
* HAT 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 Founda... |
Explain and rewrite the following Scala code: | package eu.akkamo
import akka.actor.ActorSystem
import akka.event.{Logging}
import eu.akkamo.LoggingAdapter.LogLevel
import scala.util.Try
/**
* This module provides `eu.akkamo.LoggingAdapterFactory` via the ''Akkamo'' context, allowing to use
* the configured logging system outside ''Akka'' actors.
*
* @aut... |
Explain and rewrite the following Scala code: | /*
* Copyright (c) 2015-2017 Toby Weston
*
* 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 modules
import akka.actor.{ActorRef, Props, Actor, ActorLogging}
object StatisticsProvider {
def props = Props[StatisticsProvider]
}
class StatisticsProvider extends Actor with ActorLogging {
var reachComputer: ActorRef = _
var storage: ActorRef = _
var followersCounter: ActorRef = _
override de... |
Explain and rewrite the following Scala code: | package sharry.backend.alias
import cats.data.OptionT
import cats.effect._
import cats.implicits._
import fs2.Stream
import sharry.backend.alias.OAlias.{AliasDetail, AliasInput}
import sharry.common._
import sharry.common.syntax.all._
import sharry.store.AddResult
import sharry.store.Store
import sharry.store.records... |
Explain and rewrite the following Scala code: | package org.jetbrains.plugins.scala.lang.formatting.processors
import java.awt.Point
import com.intellij.application.options.CodeStyle
import com.intellij.lang.ASTNode
import com.intellij.openapi.project.Project
import com.intellij.openapi.ui.MessageType
import com.intellij.openapi.ui.popup.{Balloon, JBPopupFactory}
... |
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 de.zalando.beard.renderer
import java.io.StringWriter
import monifu.reactive.subjects.ReplaySubject
import monifu.reactive.{Observable, Subject}
/**
* @author dpersa
*/
trait RenderResult[T] {
def write(string: String): Unit
def complete(): Unit = {}
def result: T
}
case class StringWriterRenderRe... |
Explain and rewrite the following Scala code: | /*
* Copyright 2015-2016 IBM Corporation
*
* 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 org.jetbrains.plugins.scala.runner
import com.intellij.execution._
import com.intellij.execution.actions.ConfigurationContext
import com.intellij.execution.application.{ApplicationConfiguration, ApplicationConfigurationType}
import com.intellij.execution.configurations.ConfigurationUtil
import com.intellij.exe... |
Explain and rewrite the following Scala code: | package equations.monooperation
import equations.monooperation.MonoOperation.productList
import org.scalatest.{FlatSpec, Matchers}
/**
* Created by kasonchan on 11/26/15.
*/
class ProductListSpec extends FlatSpec with Matchers {
"Test 1" should "pass" in {
productList(List()) shouldBe 1.00
}
"Test 2" sh... |
Explain and rewrite the following Scala code: | package cn.commercial.controller
import com.twitter.finagle.Service
import com.twitter.finagle.http.{Request, Response}
import com.twitter.util.Future
/**
* Created by yangguo on 14-11-3.
*/
object FamilyService extends Service[Request,Response]{
override def apply(request: Request): Future[Response] = ???
}
|
Explain and rewrite the following Scala code: | /*******************************************************************************
* Copyright (C) 2012 Łukasz Szpakowski.
*
* 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 ver... |
Explain and rewrite the following Scala code: | package at.logic.gapt.proofs.expansion
import at.logic.gapt.expr.fol.{ Numeral, isFOLPrenexSigma1 }
import at.logic.gapt.expr._
import at.logic.gapt.provers.escargot.Escargot
import at.logic.gapt.utils.SatMatchers
import org.specs2.mutable.Specification
class PrenexifyETTest extends Specification with SatMatchers {
... |
Explain and rewrite the following Scala code: | package com.shashank.semistructured
import org.apache.spark.{SparkConf, SparkContext}
/**
* Created by shashank on 10/2/16.
*/
case class Person3(name: String, age: Int)
object DownCast {
def main(args: Array[String]) {
val sc: SparkContext = new SparkContext("local","meetup",new SparkConf())
val sqlCo... |
Explain and rewrite the following Scala code: | /***********************************************************************
* Copyright (c) 2017 IBM
* Copyright (c) 2013-2017 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 accompa... |
Explain and rewrite the following Scala code: | package rtgui.panels
import scalafx.stage.Stage
import scalafx.scene.layout.Pane
import scalafx.scene.shape.Rectangle
import rtgui.controls.{ModelAdapter, ToolControls}
import rtgui.model.RangeTreeModel
import javafx.scene.input.MouseEvent
import javafx.event.EventHandler
/**
* Created with IntelliJ IDEA.
* User: p... |
Explain and rewrite the following Scala code: | package mesosphere.marathon
package api.akkahttp
import akka.actor.ActorSystem
import akka.http.scaladsl.model._
import akka.http.scaladsl.server.Route
import ch.qos.logback.classic.{ Level, Logger, LoggerContext }
import com.typesafe.config.{ Config, ConfigRenderOptions }
import com.typesafe.scalalogging.StrictLoggin... |
Explain and rewrite the following Scala code: | /*
* Copyright © 2015 Lukas Rosenthaler, Benjamin Geer, Ivan Subotic,
* Tobias Schweizer, André Kilchenmann, and Sepideh Alassi.
*
* This file is part of Knora.
*
* Knora 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 F... |
Explain and rewrite the following Scala code: | package com.greencatsoft.angularjs.core
import com.greencatsoft.angularjs.injectable
import scala.language.implicitConversions
import scala.scalajs.js
/**
* \\$sce is a service that provides Strict Contextual Escaping services to AngularJS.
*
* @see https://docs.angularjs.org/api/ng/service/\\$sce
*/
@js.native
... |
Explain and rewrite the following Scala code: | /*
* Copyright (c) 2014-2015 by its authors. Some rights reserved.
* See the project homepage at: http://www.monifu.org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://... |
Explain and rewrite the following Scala code: | /**
* 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 oxalis.security
import com.mohiva.play.silhouette.api.actions.{SecuredRequest, UserAwareRequest}
import com.scalableminds.util.requestlogging.AbstractRequestLogging
import play.api.mvc.{Request, Result}
import scala.concurrent.{ExecutionContext, Future}
trait UserAwareRequestLogging extends AbstractRequestLo... |
Explain and rewrite the following Scala code: | package com.github.j5ik2o.forseti.domain.client
import com.github.j5ik2o.forseti.domain.support.EntityReader
import com.github.j5ik2o.forseti.domain.user.UserId
import scala.concurrent.{ExecutionContext, Future}
import scalaz._
trait ClientSessionReader extends EntityReader[ClientSessionId, ClientSession] {
def r... |
Explain and rewrite the following Scala code: | package mr.merc.ui.world
import mr.merc.economics.WorldStateEnterpriseActions
import mr.merc.local.Localization
import mr.merc.politics.Province
import scalafx.scene.control.TableView
import scalafx.scene.layout.Pane
import scalafx.Includes._
import scalafx.beans.property.ReadOnlyObjectProperty
import scalafx.collecti... |
Explain and rewrite the following Scala code: | import com.yahoo.platform.yui.compressor.{CssCompressor, JavaScriptCompressor, YUICompressor}
import org.mozilla.javascript.{ErrorReporter, EvaluatorException}
import sbt._
import sbt.Keys._
import sbt.plugins.JvmPlugin
import Path.rebase
object YUICompressPlugin extends AutoPlugin {
object autoImport {
lazy va... |
Explain and rewrite the following Scala code: | package scala.util.concurrent.locks
import java.util.concurrent.locks.{ReentrantReadWriteLock => JReentrantReadWriteLock}
object ReentrantReadWriteLock {
def apply(lock: JReentrantReadWriteLock): ReentrantReadWriteLock =
new JavaReentrantReadWriteLock(lock)
def apply(fair: Boolean /* = false */): ReentrantRea... |
Explain and rewrite the following Scala code: | /**
* @author suitougreentea
*/
package io.github.suitougreentea.VariousMinos
import org.newdawn.slick.AppGameContainer
object VariousMinos {
def main(args: Array[String]) {
val game = new GameVariousMinos("VariousMinos Alpha-0.1")
val app = new AppGameContainer(game)
app.setDisplayMode(800, 600, fals... |
Explain and rewrite the following Scala code: | package shared
import java.io.File
import collection.{FeatureSet, GTF22FeatureSet}
import feature._
/**
* Created by prussell on 12/28/16.
*/
object GTF22Data {
val chr20_21_22: FeatureSet[Feature] =
new GTF22FeatureSet(new File(getClass.getResource("/Homo_sapiens.GRCh38.86.chr_20_21_22.gtf").getPath))
... |
Explain and rewrite the following Scala code: | package io.circe.tests
import algebra.Eq
import org.scalacheck.Arbitrary
import shapeless._
trait MissingInstances {
implicit def eqBigDecimal: Eq[BigDecimal] = Eq.fromUniversalEquals
implicit def arbitraryTuple1[A](implicit A: Arbitrary[A]): Arbitrary[Tuple1[A]] =
Arbitrary(A.arbitrary.map(Tuple1(_)))
im... |
Explain and rewrite the following Scala code: | package org.ruivieira.ssm.test
import breeze.linalg.DenseMatrix
import org.ruivieira.ssm.MatrixUtils
import org.scalatest.{FlatSpec, Matchers}
/*
* 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 Licen... |
Explain and rewrite the following Scala code: | package value
import javax.xml.bind.annotation._
object ApiResponse {
val ERROR = 1
val WARNING = 2
val INFO = 3
val OK = 4
val TOO_BUSY = 5
}
@XmlRootElement
class ApiResponse(@XmlElement var code: Int, @XmlElement var message: String) {
def this() = this(0, null)
@XmlTransient
def getCode(): Int =... |
Explain and rewrite the following Scala code: | /*
* Copyright 2013 Filippo De Luca - me@filippodeluca.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
*
* Unles... |
Explain and rewrite the following Scala code: | package com.andre_cruz.concurrent
import org.scalatest.concurrent.ScalaFutures
import org.scalatest.{Matchers, WordSpecLike}
import scala.concurrent.Future
import scala.util.Try
class FutureUtilsTest extends WordSpecLike with Matchers with ScalaFutures {
import com.andre_cruz.concurrent.FutureUtils._
"tryToFu... |
Explain and rewrite the following Scala code: | package clide.client.codemirror
import scala.scalajs.js.annotation.JSExport
import scala.scalajs.js
import scala.scalajs.js.RegExp
trait Mode[S] {
@JSExport def startState(): S = js.undefined.asInstanceOf[S]
@JSExport def token(stream: Stream, state: S): String
}
trait BlankLineBehavior[S] { self: Mode[S] =>
... |
Explain and rewrite the following Scala code: | package examples.phonebook
object phonebook {
val labPhoneBook =
<phonebook>
<descr>
This is the <b>phonebook</b> of the
<a href="http://acme.org">ACME</a> corporation.
</descr>
<entry>
<name>Burak</name>
<phone where="work"> +41 21 693 68 67</phone>
... |
Explain and rewrite the following Scala code: | package com.deductions.bankplus.model
object ConnecteurBanqueCA {
val comptes = List(Compte.compteBidon)
} |
Explain and rewrite the following Scala code: | package com.socrata.bq
import com.rojoma.simplearm.util._
import java.nio.charset.StandardCharsets
object Version {
def apply(name: String) = for {
stream <- managed(getClass.getClassLoader.getResourceAsStream(s"$name.json"))
reader <- managed(new java.io.InputStreamReader(stream, StandardCharsets.UTF_8))
... |
Explain and rewrite the following Scala code: | package hephaestus
package skybox
import hephaestus.platform._
import hephaestus.io.Buffer
import java.nio.{ByteBuffer, ByteOrder}
import java.io.File
import java.io.InputStream
import java.nio.file.Files
import javax.imageio._
import java.awt.image._
import scodec.codecs._
import scodec.stream._
import cats.implic... |
Explain and rewrite the following Scala code: | package mimir.algebra;
import mimir.util.ListUtils
import mimir.views.ViewAnnotation
import mimir.algebra.sampling.SamplingMode
/**
* Abstract parent class of all relational algebra operators
*/
sealed abstract class Operator
extends Serializable
with OperatorConstructors
{
/**
* Convert the operator int... |
Explain and rewrite the following Scala code: | package com.ponkotuy.restype
import com.netaporter.uri.Uri
import com.ponkotuy.config.ClientConfig
import com.ponkotuy.data
import com.ponkotuy.data.{Auth, MyFleetAuth}
import com.ponkotuy.http.MFGHttp
import com.ponkotuy.parser.Query
import com.ponkotuy.value.KCServer
import org.json4s._
import org.json4s.native.Seri... |
Explain and rewrite the following Scala code: | package org.orbeon.oxf.xml
import java.util.{List ⇒ JList}
import javax.xml.transform.{Source, SourceLocator}
import org.orbeon.oxf.util.XPath._
import org.orbeon.oxf.util.{IndentedLogger, Logging}
import org.orbeon.saxon.Configuration
import org.orbeon.saxon.expr._
import org.orbeon.saxon.functions.{FunctionLibrary,... |
Explain and rewrite the following Scala code: | package io.plasmap.geo.mappings.impl.test
import io.plasmap.geo.mappings._
import io.plasmap.geo.mappings.impl.MySQLMappingService
import io.plasmap.model.OsmId
import org.joda.time.DateTime
import org.scalacheck.Arbitrary
import org.scalacheck.Arbitrary.arbitrary
import org.specs2.ScalaCheck
import org.specs2.mutable... |
Explain and rewrite the following Scala code: | /***********************************************************************
* Copyright (c) 2013-2016 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 is ... |
Explain and rewrite the following Scala code: | package rpgboss.model.resource
import rpgboss.model._
case class BattleBackgroundMetadata()
case class BattleBackground(proj: Project, name: String,
metadata: BattleBackgroundMetadata)
extends ImageResource[BattleBackground, BattleBackgroundMetadata] {
def meta = BattleBackground
}
... |
Explain and rewrite the following Scala code: | package io.herd.scala
import java.util.function.{ Function ⇒ JFunction }
package object interop {
//usage example: `i: Int ⇒ 42`
implicit def toJavaFunction[A, B](f: Function1[A, B]) = new JFunction[A, B] {
override def apply(a: A): B = f(a)
}
} |
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 redis.api.sets
import redis._
import akka.util.ByteString
case class Sadd[K, V](key: K, members: Seq[V])(implicit redisKey: ByteStringSerializer[K], convert: ByteStringSerializer[V]) extends RedisCommandIntegerLong {
val isMasterOnly = true
val encodedRequest: ByteString = encode("SADD", redisKey.serializ... |
Explain and rewrite the following Scala code: | package org.bfn.ninetynineprobs
object P59 {
// TODO
}
|
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: | /*
* 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) 2009-2013 Typesafe Inc. <http://www.typesafe.com>
*/
package play.core.actions
import play.api.mvc._
import play.api.libs.iteratee._
import play.api.http.{ HttpProtocol, HeaderNames, DefaultWriteables }
import play.api.mvc.Result
import scala.concurrent.Future
import HeaderNames._
/**
* RFC261... |
Explain and rewrite the following Scala code: | package unfiltered.util
class MIMEType(val major: String,
val minor: String,
val params: Map[String, String]) {
def includes(mt: MIMEType) = {
(major, minor) match {
case ("*", "*") => true
case (maj, "*") => mt.major == maj
case (maj, min) => mt.major == maj &... |
Explain and rewrite the following Scala code: | /*
* Odessa State environmental University
* Copyright (C) 2014
*/
package ua.edu.odeku.ceem.mapRadar.tools.adminBorder.viewManager
import java.awt.event.{ActionEvent, ActionListener}
import ua.edu.odeku.ceem.mapRadar.tools.adminBorder.models.{CountryBorders, ProvinceBorders}
/**
* Обработчик
*
* Created by ... |
Explain and rewrite the following Scala code: | /*
* Copyright (C) 2010 Romain Reuillon
*
* 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.
*
* This progra... |
Explain and rewrite the following Scala code: | package org.jetbrains.plugins.scala.lang.typeInference
package generated
class TypeInferenceBugs4Test extends TypeInferenceTestBase {
//This class was generated by build script, please don't change this
override def folderPath: String = super.folderPath + "bugs4/"
def testSCL2164() {doTest()}
def testSCL2298... |
Explain and rewrite the following Scala code: | /* - Coeus web framework -------------------------
*
* Licensed under the Apache License, Version 2.0.
*
* Author: Spiros Tzavellas
*/
package com.tzavellas.coeus.mvc.view.helper
import javax.servlet.ServletContext
/**
* The view helpers that are registered by default in <code>DispatcherConfig</code>.
*/
class... |
Explain and rewrite the following Scala code: | /*
* Copyright (C) 2009-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 a... |
Explain and rewrite the following Scala code: | package com.sksamuel.scapegoat.inspections.collections
import com.sksamuel.scapegoat._
/**
* @author
* Stephen Samuel
*/
class PreferSeqEmpty
extends Inspection(
text = "Prefer Seq.empty",
defaultLevel = Levels.Info,
description = "Checks for use of Seq().",
explanation =
"`Se... |
Explain and rewrite the following Scala code: | /**
* Copyright (C) 2011 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: | /*
* 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.apache.spark.ml.bundle.ops.clustering
import ml.combust.bundle.BundleContext
import ml.combust.bundle.dsl._
import ml.combust.bundle.op.{OpModel, OpNode}
import org.apache.spark.ml.bundle.{ParamSpec, SimpleParamSpec, SimpleSparkOp, SparkBundleContext}
import org.apache.spark.ml.clustering.BisectingKMeansMo... |
Explain and rewrite the following Scala code: | /**
* Copyright (C) 2014 the original author or authors and Enernoc Inc.
* See the LICENCE.txt file distributed with this work for additional
* information regarding copyright ownership.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the L... |
Explain and rewrite the following Scala code: | package io.iohk.ethereum.jsonrpc.client
import akka.util.ByteString
import io.circe._
import io.circe.syntax._
import io.iohk.ethereum.domain.Address
import io.iohk.ethereum.mallet.common.StringUtil
import io.iohk.ethereum.utils.NumericUtils._
import org.bouncycastle.util.encoders.Hex
import scala.util.Try
object Co... |
Explain and rewrite the following Scala code: | package com.seanshubin.todo.persistence.domain
trait LoadingInterpreterMarker extends Interpreter
|
Explain and rewrite the following Scala code: | /*
* Copyright 2016-2017 Chris de Vreeze
*
* 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) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package play.api.inject
import javax.inject.{ Singleton, Inject, Provider }
import play.api._
import play.api.http._
import play.api.libs.{ CryptoConfig, Crypto, CryptoConfigParser }
import play.core.Router
class BuiltinModule extends Module {... |
Explain and rewrite the following Scala code: | package com.snapswap.layer
import java.util.UUID
import com.snapswap.layer.webhooks.EnumEventType._
import com.snapswap.layer.webhooks.{EnumWebhookStatus, Webhook, WebhookId}
import org.joda.time.{DateTime, DateTimeZone}
import spray.json.{JsonFormat, JsonReader}
import scala.concurrent.Future
class FakeLayerClient... |
Explain and rewrite the following Scala code: | /*
* Copyright (c) 2013-2015 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 is available at
* http://www.opensource.org/licenses/apache2.0.php.
... |
Explain and rewrite the following Scala code: | package com.catinthedark.lib.constants
import com.badlogic.gdx.math.{Rectangle, Vector2}
/**
* Created by over on 11.12.15.
*/
sealed trait Tweak {
type T
var now: T
def apply[T]() = now
def set(value: T) = now = value
}
case class OnOff(name: String, var now: Boolean) extends Tweak {
type T = Boolean... |
Explain and rewrite the following Scala code: | package mesosphere.marathon
package api.v2.json
import mesosphere.UnitTest
import mesosphere.marathon.api.v2.{AppHelpers, AppNormalization}
import mesosphere.marathon.raml.AppUpdate
import mesosphere.marathon.state.ResourceRole
import play.api.libs.json.Json
class AppUpdateFormatTest extends UnitTest {
def normali... |
Explain and rewrite the following Scala code: | package hulk.ratelimiting
import akka.http.scaladsl.model.HttpHeader
import akka.http.scaladsl.model.headers.HttpCookiePair
import hulk.filtering.Filter
import hulk.filtering.Filter.Next
import hulk.http.{HulkHttpRequest, HulkHttpResponse, TooManyRequests}
import scala.concurrent.ExecutionContext.Implicits.global
imp... |
Explain and rewrite the following Scala code: | /* Copyright 2014 Nest Labs
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... |
Explain and rewrite the following Scala code: | package personalizedAssignment.stepDefs
import cucumber.api.java.en.{Given, Then}
import java.security.cert.X509Certificate
import org.apache.http.client.methods.HttpGet
import org.apache.http.conn.ssl.TrustStrategy
import org.apache.http.impl.client.HttpClientBuilder
import org.apache.http.ssl.SSLContexts
import scal... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.