instruction stringclasses 1
value | output stringlengths 5 1M |
|---|---|
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 net.sansa_stack.query.spark.sparqlify
import org.aksw.jenax.arq.util.binding.ResultSetUtils
import org.aksw.jenax.arq.util.execution.QueryExecutionAdapter
import org.aksw.sparqlify.core.domain.input.SparqlSqlStringRewrite
import org.apache.jena.query.{Query, ResultSetCloseable}
import org.apache.jena.sparql.en... |
Explain and rewrite the following Scala code: | package cafesat.asts
package fol
import Trees._
import core.Trees._
object Trees {
object ConstantSymbol {
def apply(name: String, sort: Sort) = FunctionSymbol(name, Nil, sort)
def unapply(symbol: FunctionSymbol): Option[(String, Sort)] = symbol match {
case FunctionSymbol(n, Nil, s) => Some((n, s))... |
Explain and rewrite the following Scala code: | package unfiltered.oauth
import unfiltered.response._
import unfiltered.request.{HttpRequest => Req}
/** Represents the `User` in an oauth interaction */
trait UserLike {
val id: String
}
/** Provides a means of host-specific hooks into providing user interfaces */
trait HostResponses {
/** @return a function th... |
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 jsky.app.ot.vcs
import edu.gemini.pot.sp.ISPProgram
import edu.gemini.pot.sp.version.VersionMap
import edu.gemini.pot.spdb.IDBDatabaseService
import edu.gemini.shared.util.VersionComparison
import edu.gemini.shared.util.VersionComparison.{Same, Older, Newer, Conflicting}
import edu.gemini.sp.vcs.reg.VcsRegistr... |
Explain and rewrite the following Scala code: | /*
* If.scala
* Conditional elements.
*
* Created By: Avi Pfeffer (apfeffer@cra.com)
* Creation Date: Oct 10, 2010
*
* Copyright 2013 Avrom J. Pfeffer and Charles River Analytics, Inc.
* See http://www.cra.com or email figaro@cra.com for information.
*
* See http://www.github.com/p2t2/figaro for a copy... |
Explain and rewrite the following Scala code: | /**
* Created by mindwing on 2015-08-25.
*/
object Scat {
def main(args: Array[String]) {
println("It's Scat!!!")
}
}
|
Explain and rewrite the following Scala code: | package org.jetbrains.plugins.dotty.lang.psi.types
import com.intellij.openapi.util.Computable
import com.intellij.psi.PsiClass
import org.jetbrains.plugins.scala.lang.psi.types._
/**
* @author adkozlov
*/
object Conformance extends api.Conformance {
override implicit lazy val typeSystem = DottyTypeSystem
ov... |
Explain and rewrite the following Scala code: | package at.forsyte.apalache.tla.bmcmt.rules
import at.forsyte.apalache.tla.bmcmt._
import at.forsyte.apalache.tla.bmcmt.types._
import at.forsyte.apalache.tla.lir.oper.TlaFunOper
import at.forsyte.apalache.tla.lir.{OperEx, TlaEx}
import at.forsyte.apalache.tla.lir.convenience.tla
/**
* Rewrites a tuple or sequence ... |
Explain and rewrite the following Scala code: | import scalaz.\/
package object wrangler {
type Error[T] = Throwable \/ T
}
|
Explain and rewrite the following Scala code: | import org.apache.spark.{SparkContext, SparkConf}
/**
* Created by ma on 15-1-27.
*/
class QueryT15 extends BaseQuery{
System.setProperty("spark.cores.max",String.valueOf(ParamSet.cores))
val conf = new SparkConf()
conf.setAppName("TPCH-Q15")
val sc = new SparkContext(conf)
val sqlContext = new org.ap... |
Explain and rewrite the following Scala code: | package scala.math
import org.junit.Test
import scala.annotation.unused
class PartialOrderingTest {
import EquivTest._
@Test
def testOrderingToPartialOrderingResolution(): Unit = {
implicit val o: Ordering[Box[Int]] = intBoxOrdering
assert(PartialOrdering[Box[Int]] == intBoxOrdering)
}
@Test
de... |
Explain and rewrite the following Scala code: | // See LICENSE for license details.
package diplomacy
import Chisel._
import chisel3.internal.sourceinfo.{SourceInfo, SourceLine, UnlocatableSourceInfo}
abstract class LazyModule
{
protected[diplomacy] var bindings = List[() => Unit]()
protected[diplomacy] var children = List[LazyModule]()
protected[diplomacy]... |
Explain and rewrite the following Scala code: | package org.jetbrains.plugins.scala.codeInsight.hint
import com.intellij.codeInsight.hint.DeclarationRangeHandler
import com.intellij.openapi.util.TextRange
import com.intellij.psi.{PsiElement, PsiMethod}
import org.jetbrains.plugins.scala.lang.psi.api.statements.ScFunction
/**
* @author Alefas
* @since 29/06/16
... |
Explain and rewrite the following Scala code: | package org.apress.prospark
import scala.reflect.ClassTag
import org.apache.spark.Logging
import org.apache.spark.storage.StorageLevel
import org.apache.spark.streaming.StreamingContext
import org.apache.spark.streaming.api.java.JavaDStream
import org.apache.spark.streaming.api.java.JavaDStream.fromDStream
import org... |
Explain and rewrite the following Scala code: | package uk.gov.gds.ier.transaction.ordinary.dateOfBirth
import uk.gov.gds.ier.test.ControllerTestSuite
import org.joda.time.DateTime
class DateOfBirthControllerTests extends ControllerTestSuite {
behavior of "DateOfBirthController.get"
it should "display the page" in {
running(FakeApplication()) {
val ... |
Explain and rewrite the following Scala code: | package lore.compiler.typing.synthesizer
import lore.compiler.feedback.Reporter
import lore.compiler.semantics.expressions.Expression
import lore.compiler.types.BasicType
import lore.compiler.typing.InferenceVariable
import lore.compiler.typing.InferenceVariable.Assignments
import lore.compiler.typing.checker.Checker
... |
Explain and rewrite the following Scala code: | /*
* Copyright (c) 2013 Aviat Networks.
* This file is part of DocReg+Web. Please refer to the NOTICE.txt file for license details.
*/
package vvv.docreg.util
import java.text._
import java.util.Date
import java.util.TimeZone
import vvv.docreg.model.User
import net.liftweb.common.Full
object DatePresentation {
... |
Explain and rewrite the following Scala code: | package com.aughma.library
import com.aughma.dataflow.TransformBlock
import scala.io.Source
import java.util.logging.Level
class FetchURLBlock extends TransformBlock {
val INPUTURL = "url"
val OUTPUTRESPONSE = "Response"
val errorPort = new LogOutputPort("ERROR", Level.SEVERE)
val inputPorts = Map(INPUTURL->n... |
Explain and rewrite the following Scala code: | @scala.annotation.tailrec
def findSquareToPrecision(num: Long, precision: Double = 0.000001, workingRoot: Double = 0.0): Double = {
val working = if (workingRoot == 0.0) (num / 2.0) else (workingRoot)
val workingSquare = working * working
val difference = scala.math.abs(workingSquare - num)
if (difference < pre... |
Explain and rewrite the following Scala code: | package org.raisercostin.jedi
import java.io.File
object FileUtils {
import org.apache.commons.io.{ FileUtils => FileUtilsCommons }
def moveFile(srcFile: File, destFile: File) = {
Locations.file(destFile).parent.existing
if (srcFile.isDirectory())
FileUtilsCommons.moveDirectory(srcFile, destFile)
... |
Explain and rewrite the following Scala code: | package esclient
import org.specs2.mutable.Specification
import play.api.test.{WithApplication, FakeApplication}
import org.elasticsearch.client.Client
import org.elasticsearch.client.transport.TransportClient
class ElasticsearchSpec extends Specification {
val nodeConfig: Map[String, _] = Map(
"esclient.embed... |
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 2012 Twitter, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distr... |
Explain and rewrite the following Scala code: | package apdl
abstract class ApdlBaseException(msg: String) extends Throwable {
def this() = this("")
override def toString: String = {
s"$msg ${super.toString}"
}
}
class ApdlDslException(s: String) extends ApdlBaseException(s)
class ApdlParserException(s: String) extends ApdlBaseException(s)
class ApdlA... |
Explain and rewrite the following Scala code: | /*
Copyright 2015 Sensatus UK 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 agreed to in writing, so... |
Explain and rewrite the following Scala code: | package loader.parsers
import loader.core.ParserSpawner
import utils.parsers.CharProcessor
/*
class Obj() extends HandlerBridge {self=>
def apply(start:BaseProcessor#Launcher[Kind]):Parser = new Parser(start)
class Parser(val start:BaseProcessor#Launcher[Kind]) extends super.Parser { self=>
def... |
Explain and rewrite the following Scala code: | /*
* Copyright 2014 Dennis Vis
*
* 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: | package spark.rdd
import org.apache.hadoop.conf.Configuration
import org.apache.hadoop.io.Writable
import org.apache.hadoop.mapreduce.InputFormat
import org.apache.hadoop.mapreduce.InputSplit
import org.apache.hadoop.mapreduce.JobContext
import org.apache.hadoop.mapreduce.JobID
import org.apache.hadoop.mapreduce.Recor... |
Explain and rewrite the following Scala code: | package org.scalatra
object ScalatraKernel
{
@deprecated("Use org.scalatra.MultiParams", "2.1.0")
type MultiParams = util.MultiMap
@deprecated("Use org.scalatra.Action", "2.1.0")
type Action = () => Any
@deprecated("Use HttpMethod.methods", "2.0.0")
val httpMethods = HttpMethod.methods map { _.toString }... |
Explain and rewrite the following Scala code: | /***********************************************************************
* Copyright (c) 2013-2022 Commonwealth Computer Research, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Apache License, Version 2.0
* which accompanies this distribution and... |
Explain and rewrite the following Scala code: | /*
* CodeFrame.scala
* (Mellite)
*
* Copyright (c) 2012-2022 Hanns Holger Rutz. All rights reserved.
*
* This software is published under the GNU Affero General Public License v3+
*
*
* For further information, please contact Hanns Holger Rutz at
* contact@sciss.de
*/
package de.sciss.mellite
import ... |
Explain and rewrite the following Scala code: | /*
* 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: | /*
* 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 core
class TreasureStagePlayer(player: Player) extends SubReceiver {
def receive(message: Message, context: DispatchContext) { message match {
case Perform =>
player.pushSub(new Selector(player, "Select treasure cards to play",
player.hand.toVector.map(card => new Selection(card.name, card.... |
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: | package less
import java.io.File
import sbt.IO
private [less] object Files {
val ImportsDelimiter = "\\n"
}
class LessSourceMapping(
val lessFile: File, sourcesDir: File,
targetDir: File, cssDir: File) {
import sbt.Path._ // File -> RichFile
val relPath = IO.relativize(sourcesDir, lessFile).get
lazy val ... |
Explain and rewrite the following Scala code: | sealed trait Input
case object Coin extends Input
case object Turn extends Input
case class Machine(locked: Boolean, candies: Int, coins: Int)
object Candy {
def update = (i: Input) => (s: Machine) =>
(i, s) match {
case (_, Machine(_, 0, _)) => s
case (Coin, Machine(false, _, _)) => s
case (T... |
Explain and rewrite the following Scala code: | // minimization of failure in run/t4813.scala related to the special
// case for default methods that override methods owned by Object.class in
// Java interfaces.
trait C[A >: Null <: AnyRef] { override def clone(): A = null }
trait X extends C[X]
class D extends X { def foo = (this: X).clone() }
object Test {
def m... |
Explain and rewrite the following Scala code: | package threesixty.persistence.cassandra
import java.sql.Timestamp
import java.util.{UUID, Calendar}
import com.websudos.phantom.dsl._
import play.api.libs.json._
import org.scalatest.{BeforeAndAfterAll, FunSpec}
import threesixty.data.Data.ValueType
import threesixty.data.metadata.{ActivityType, CompleteInputMetad... |
Explain and rewrite the following Scala code: | package edu.msstate.dasi.csb.model
/**
* The states of a connection.
*/
object ConnStates extends Enumeration {
/** Connection status unknown or invalid. */
val UNKNOWN = Value
/** Connection attempt seen, no reply. */
val S0 = Value
/** Connection established, not terminated. */
val S1 = Value
/**
... |
Explain and rewrite the following Scala code: | /**
* Copyright (c) 2007-2011 Eric Torreborre <etorreborre@yahoo.com>
*
* 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: | /*
*
* (C) Copyright 2015 Atomic BITS (http://atomicbits.io).
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Affero General Public License
* (AGPL) version 3.0 which accompanies this distribution, and is available in
* the LICENSE file or... |
Explain and rewrite the following Scala code: | package com.github.verhoevenv.fiasco.transform.json
import com.github.verhoevenv.fiasco.domain.{Product, ProductSauces, ProductComposition}
import spray.json._
object JsonProduct {
def asJson(product: Product) : JsonProduct = {
new JsonProduct(product.id, product.category.id, product.name, product.composition, ... |
Explain and rewrite the following Scala code: | package com.jeffrey.bowling
import org.scalatest.junit.JUnitRunner
import org.scalatest.FunSpec
import org.scalatest.matchers.ShouldMatchers
import org.junit.runner.RunWith
@RunWith(classOf[JUnitRunner])
class BowlingGameSpec extends FunSpec with ShouldMatchers {
trait WithGame {
val game = new BowlingGam... |
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: | package com.blinkbox.books.auth.server.sso
import spray.http.StatusCodes
class TokenStatusSpecs extends SpecBase {
import env._
"The SSO client" should "return a successful future if the SSO service replies with a 204" in {
ssoSessionInfo(SsoTokenStatus.Valid, SsoTokenElevation.Critical)
whenReady(sso.... |
Explain and rewrite the following Scala code: | package com.rainm.scanote.db
import java.text.SimpleDateFormat
import java.util
import java.util.Date
import android.content.{ContentValues, Context}
import android.database.Cursor
import android.database.sqlite.SQLiteDatabase
import com.rainm.scanote.model.SimpleNote
/**
* Created by hackeris on 16/1/14.
*/
cla... |
Explain and rewrite the following Scala code: | package com.github.andyglow.config
import java.time.temporal.TemporalAmount
import java.time.{Period, Duration => JDuration}
import com.typesafe.config._
import scala.collection.generic.CanBuildFrom
import scala.concurrent.duration.{Duration, FiniteDuration}
import scala.language.{higherKinds, implicitConversions}
... |
Explain and rewrite the following Scala code: | package v2d2.actors.comedy
object Answers {
val answers: List[String] = List(
"Aardvark a hundred miles for one of your smiles!",
"Aaron on the side of caution!",
"Abbott time you answered the door!",
"Abe C D E F G H...! ",
"Abyssinia behind bars one of these days!",
"Acid down and be quiet... |
Explain and rewrite the following Scala code: | package org.hibernate.cache.rediscala.client
import java.util.concurrent.TimeUnit
import org.hibernate.cache.rediscala.serializer.SnappyFstCacheEntryFormatter
import org.hibernate.cache.rediscala.utils.Promises
import org.slf4j.LoggerFactory
import redis.RedisClient
import redis.api.Limit
import redis.commands.Transac... |
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 com.github.chengpohi.parser.config
import com.typesafe.config.ConfigFactory
/**
* secer
* Created by chengpohi on 3/18/16.
*/
object ParserConfig {
lazy val PARSER_CONFIG = ConfigFactory.load("parser")
lazy val PARSER_POOL = PARSER_CONFIG.getConfig("threads").getInt("parser")
}
|
Explain and rewrite the following Scala code: | // Copyright: 2010 - 2017 https://github.com/ensime/ensime-server/graphs
// License: http://www.gnu.org/licenses/gpl-3.0.en.html
package org.ensime.core
import java.io.File
import java.util.jar.JarFile
import org.ensime.api.EnsimeConfig
import org.ensime.config.richconfig._
import org.ensime.util.io._
trait DocJarRe... |
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) 2013-2020 Commonwealth Computer Research, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Apache License, Version 2.0
* which accompanies this distribution and... |
Explain and rewrite the following Scala code: | package scalaz.stream.mongodb.aggregate
import com.mongodb.{BasicDBObject, DBObject}
/** limits returned results from pipeline **/
case class LimitPipeline (count:Int) extends PipelineOperator {
lazy val asDBObject : DBObject =
new BasicDBObject().append("$limit", count)
}
|
Explain and rewrite the following Scala code: | /**
* Swaggy Jenkins
* Jenkins API clients generated from Swagger / Open API specification
*
* The version of the OpenAPI document: 1.1.2-pre.0
* Contact: blah@cliffano.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not ed... |
Explain and rewrite the following Scala code: | /*
* Copyright (c) 2014.
*
* This file is part of picture-classifier.
*
* picture-classifier 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 ... |
Explain and rewrite the following Scala code: | /*package test
import jm.JMC
import jm.music.data._
import jm.util._
import jm.constants.Pitches._
import jm.constants.Durations._
import jm.constants.ProgramChanges._
//Helper Subclass for infix operations
//| is for adding Notes
//& is for adding chords, and harmonies
class MyChord(pitchesList: List[Int], rhythmL... |
Explain and rewrite the following Scala code: | package org.jetbrains.plugins.scala.debugger.ui
import com.intellij.debugger.ui.tree.{FieldDescriptor, NodeDescriptor, NodeDescriptorNameAdjuster}
import com.sun.jdi.{ClassType, ReferenceType}
import org.jetbrains.plugins.scala.debugger.ScalaSyntheticProvider
import org.jetbrains.plugins.scala.debugger.evaluation.util... |
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 agreed to in writ... |
Explain and rewrite the following Scala code: | package com.monovore.coast
package core
import com.monovore.coast.wire.{Partitioner, BinaryFormat}
sealed trait Node[A, +B]
case class Source[A, B](
source: String
)(
implicit val keyFormat: BinaryFormat[A],
val valueFormat: BinaryFormat[B]
) extends Node[A, B]
case class Clock(seconds: Long) extends Node[Uni... |
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 demo
package routes
import demo.components.{ReactGeomIconInfo, ReactGeomIconDemo}
import demo.pages.ReactGeomIconPage
import japgolly.scalajs.react.extra.router.RouterConfigDsl
object ReactGeomIcontRouteModule {
case object Info extends LeftRoute("Info", "info", () => ReactGeomIconInfo())
case object De... |
Explain and rewrite the following Scala code: | package org.bitcoins.server.util
case class WsServerConfig(wsBind: String, wsPort: Int)
|
Explain and rewrite the following Scala code: | import sbt._
import Keys._
case class ScalaVersionStr(major : Int, minor : Int, patchlevel : Int) {
val featureVersionStr = major.toString() + "." + minor.toString()
val fullVersionStr = featureVersionStr + "." + patchlevel
}
object ExampleBuild extends Build {
val appScalaVersion = ScalaVersionStr(2, 10, 0)
... |
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.junit
import or... |
Explain and rewrite the following Scala code: | package io.byzantium
import io.byzantium.importers.eagle.EagleImporter
import io.byzantium.model.{BoardItem, Trace}
import scalax.collection.edge.LHyperEdge
import scalax.collection.immutable.Graph
/**
* @author Scott Mansfield
*/
object Main {
def main(args: Array[String]) {
val brdGraph = EagleImporter("sr... |
Explain and rewrite the following Scala code: | package be.wegenenverkeer.atomium.format.pub
case class Control(draft: Draft)
|
Explain and rewrite the following Scala code: | package com.twitter.scalding
import org.scalatest.{Matchers, WordSpec}
class TypedPipeCheckerTest extends WordSpec with Matchers {
import TypedPipeChecker._
"TypedPipeChecker" should {
"run asserts on pipe" in {
checkOutput(TypedPipe.from(List(1, 2, 3, 4))) { rows =>
assert(rows.size == 4)
... |
Explain and rewrite the following Scala code: | package net.bmjames.opts.extra
import net.bmjames.opts.builder._
import net.bmjames.opts.common._
import net.bmjames.opts.helpdoc._
import net.bmjames.opts.internal._
import net.bmjames.opts.types._
import net.bmjames.opts.builder.internal.OptionFields
import scalaz.{Const, ~>, -\/, \/-}
import scalaz.syntax.applicat... |
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: | /*
* 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 scala.scalajs.js.typedarray
import sc... |
Explain and rewrite the following Scala code: | import sbt._
import Keys._
import play.Project._
object ApplicationBuild extends Build {
val appName = "enq"
val appVersion = "1.0-SNAPSHOT"
val appDependencies = Seq(
// Add your project dependencies here,
"org.apache.velocity" % "velocity" % "1.7",
"com.google.code.gson" % "gson" % "... |
Explain and rewrite the following Scala code: | package com.scopely.affqis
import java.io.File
import org.apache.commons.io.FileUtils
import org.specs2.matcher.Scope
import org.specs2.mutable.After
trait WithRouterAndClient extends Scope with After {
def dbc: WampDBClient
def dbName: String
val router = JawampaRouter(Seq("derby"))
def after = {
print... |
Explain and rewrite the following Scala code: | package recipes
import java.nio.ByteBuffer
import java.io.FileInputStream
import java.nio.channels.DatagramChannel
import java.util.concurrent.ThreadLocalRandom
import java.net.{InetAddress, InetSocketAddress}
import java.util.concurrent.atomic.AtomicInteger
import akka.NotUsed
import akka.actor._
import akka.actor.Ac... |
Explain and rewrite the following Scala code: | /*
Copyright 2016 Tunalytics Foundation
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: | import sbt._
object Dependencies {
val finagleVersion = "6.5.1"
val finagleCore = "com.twitter" %% "finagle-core" % finagleVersion
val finagleHttp = "com.twitter" %% "finagle-http" % finagleVersion
val finagleRedis = "com.twitter" %% "finagle-redis" % finagleVersion
val finagleOstrich4 = "com.twitter" %% "... |
Explain and rewrite the following Scala code: | package sbtspg
import sbt.Keys._
import sbt._
object SPGPlugin extends AutoPlugin {
object autoImport {
import java.io.File
val siteSource = settingKey[File]("Base directory for the site files")
val siteArticles = settingKey[File]("Articles folder")
val siteDrafts = settingKey[File]("Draft articl... |
Explain and rewrite the following Scala code: | package java.util
abstract class AbstractSequentialList[E] protected () extends AbstractList[E] {
def get(index: Int): E = {
val iter = listIterator(index)
if (iter.hasNext) iter.next()
else throw new IndexOutOfBoundsException(index.toString)
}
override def set(index: Int, element: E): E = {
va... |
Explain and rewrite the following Scala code: | /**
* Copyright 2011-2017 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: | /*
* Copyright 2021 HM Revenue & Customs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or a... |
Explain and rewrite the following Scala code: | /*
* Copyright (C) 2009-2017 Lightbend Inc. <https://www.lightbend.com>
*/
package play.core.routing
import play.api.http.HttpErrorHandler
import play.api.mvc._
import play.api.routing.{ HandlerDef, Router }
/**
* A route
*/
object Route {
/**
* Extractor of route from a request.
*/
trait ParamsExtract... |
Explain and rewrite the following Scala code: | package system.simulation.strategy
import akka.actor.ActorRef
import shared.map.Road
import system.simulation.Car
import scala.collection.immutable.Queue
case class RandomLightsStrategy(waitingCars: Queue[Car], allowedRoads: List[(ActorRef, Int)]) extends CrossingStrategy {
override def addCar(car: Car): CrossingS... |
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 scutil.guid
import java.security.SecureRandom
import scutil.core.implicits._
import scutil.lang._
object Guid extends GuidBase {
// NOTE SecureRandom getInstance "SHA1PRNG" works. too
// NOTE SecureRandom.getInstanceStrong() make this hang
// NOTE SecureRandom is guaranteed to be thread safe
private val ... |
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: | /**
* For copyright information see the LICENSE document.
*/
package entice.server.world.systems
import entice.server._, Net._
import entice.server.test._
import entice.server.utils._
import entice.server.world._
import entice.protocol._
import akka.actor._
import akka.testkit._
import com.typesafe.config.ConfigFa... |
Explain and rewrite the following Scala code: | package mergesort
import math.Ordering
object MergeSort {
def msort[T](xs: List[T])(implicit ord: Ordering[T]): List[T] = {
val n = xs.length / 2
if (n == 0) xs
else {
def merge(xs: List[T], ys: List[T]): List[T] = (xs, ys) match {
case (Nil, ys) => ys
case (xs, Nil) => xs
... |
Explain and rewrite the following Scala code: | package skarn.push
import com.typesafe.config.ConfigFactory
import org.scalatest.{MustMatchers, WordSpecLike}
/**
* Created by yusuke on 15/07/08.
*/
class PushServiceInfoTest extends WordSpecLike with MustMatchers{
object PushServiceInfo extends PushServiceInfo {
val config = ConfigFactory.parseString(
... |
Explain and rewrite the following Scala code: | /*
* Artificial Intelligence for Humans
* Volume 2: Nature Inspired Algorithms
* Java Version
* http://www.aifh.org
* http://www.jeffheaton.com
*
* Code repository:
* https://github.com/jeffheaton/aifh
*
* Copyright 2014 by Jeff Heaton
*
* Licensed under the Apache License, Version 2.0 (the "License");
* y... |
Explain and rewrite the following Scala code: | /**
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed ... |
Explain and rewrite the following Scala code: | /*
* Copyright 2011-2013 the original author or 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 app... |
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.getjenny.starchat.services
import com.getjenny.starchat.TestBase
import com.getjenny.starchat.entities.io.RefreshPolicy
class BayesOperatorCacheTest extends TestBase {
private[this] val bayesOperatorCache = BayesOperatorCacheService
private[this] val indexName = "index"
"StarChat" should {
"... |
Explain and rewrite the following Scala code: | /*
*
* Copyright 2015.
*
* 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 org.jetbrains.plugins.scala.lang.macros
import com.intellij.openapi.util.text.StringUtil
import com.intellij.psi.util.PsiTreeUtil
import org.jetbrains.plugins.scala.DependencyManagerBase._
import org.jetbrains.plugins.scala.base.ScalaLightCodeInsightFixtureTestAdapter
import org.jetbrains.plugins.scala.base.li... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.