instruction stringclasses 1
value | output stringlengths 5 1M |
|---|---|
Explain and rewrite the following Scala code: | /**
* Copyright 2015 Mohiva Organisation (license at mohiva dot com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless req... |
Explain and rewrite the following Scala code: | class Foo[A]
object ParserInput { implicit def apply(string: String): ParserInput = ??? }
trait ParserInput
// overloaded with default arg
class JsonParser(input: ParserInput, settings: String = null) { def this(input: ParserInput) = this(input, null) }
class Test {
def append(a: Foo[String]): Unit = ()
def appe... |
Explain and rewrite the following Scala code: | /*
* Copyright 2016 Nicolas Rinaudo
*
* 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.nitin.nizhawan.decompiler.structures.clazz
import com.nitin.nizhawan.decompiler.structures.constantpool.ConstantPool
/**
* Created by nitin on 13/12/15.
*/
class ClassObj(index:Int,cp:ConstantPool){
val class_string = cp.poolEntries(index).info
val pkg = ("/"+class_string).substring(1,("/"+class_str... |
Explain and rewrite the following Scala code: | package com.eevolution.context.dictionary.domain.model
import ai.x.play.json.Jsonx
import com.eevolution.context.dictionary.api.{ActiveEnabled, DomainModel, Identifiable, Traceable}
import org.joda.time.DateTime
/**
* Copyright (C) 2003-2017, e-Evolution Consultants S.A. , http://www.e-evolution.com
* This progra... |
Explain and rewrite the following Scala code: | /*
* Ported from https://github.com/junit-team/junit
*/
package org.junit.runner
import org.junit.runner.notification.RunNotifier
abstract class Runner extends Describable {
def getDescription(): Description
def run(notifier: RunNotifier): Unit
def testCount(): Int = getDescription().testCount()
}
|
Explain and rewrite the following Scala code: | package net.lshift.diffa.kernel.config
import net.lshift.diffa.kernel.StoreReferenceContainer
import org.junit.{AfterClass, Before, Test}
import org.junit.Assert.assertEquals
import org.junit.Assert
import net.lshift.diffa.kernel.frontend.{PairDef, EndpointDef}
import org.junit.runner.RunWith
import org.junit.experim... |
Explain and rewrite the following Scala code: | package controllers.tabs
import de.fuberlin.wiwiss.silk.workspace.User
import de.fuberlin.wiwiss.silk.linkagerule.evaluation.DetailedEvaluator
import controllers.util.{Stream, Widgets}
import play.api.mvc.{Controller, Action}
import models.{LinkSorter, CurrentGenerateLinksTask,EvalLink}
import models.EvalLink.{Unknown... |
Explain and rewrite the following Scala code: | package com.github.mrpowers.spark.examples.benchmarking
import com.holdenkarau.spark.testing.DataFrameSuiteBase
import org.scalatest._
class BaseballBattingSpec extends FunSpec with DataFrameSuiteBase {
// describe(".fluidRun") {
//
// it("does a fluid run without breaks") {
// BaseballBatting.fluidRun()
//... |
Explain and rewrite the following Scala code: | package unfiltered.request
class Method(val method: String) {
def unapply[T](req: HttpRequest[T]) =
if (req.method.equalsIgnoreCase(method)) Some(req)
else None
}
object GET extends Method("GET")
object POST extends Method("POST")
object PUT extends Method("PUT")
object DELETE extends Method("DELETE")
objec... |
Explain and rewrite the following Scala code: | package ru.pavlenov.scala.homework.coursera
import ru.pavlenov.scala.libs.genome.DNA
/**
* ⓭ + 57
* Какой сам? by Pavlenov Semen 24.10.14.
*/
object Quiz1_4 {
/**
* What is the reverse complement of GATTACA?
*/
def start(): Unit = {
val text = "GATTACA"
println(DNA.reverse(text))
}
}
|
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 model
import skinny.orm._, feature._
import scalikejdbc._
import org.joda.time._
case class Instructor(
id: Long,
accountId: Option[String] = None,
firstName: Option[String] = None,
middleName: Option[String] = None,
lastName: Option[String] = None,
email: Option[String] = None,
imgBucket: Optio... |
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: | package org.kapunga.fredconnect
import java.util.Date
import org.kapunga.fredconnect.EventRating._
import org.kapunga.fredconnect.QueryEval._
import org.kapunga.fredconnect.SearchAgeLimit._
import org.kapunga.fredconnect.SearchGender._
import org.kapunga.fredconnect.Weapon._
/**
*
*/
class TournamentQueryParams ex... |
Explain and rewrite the following Scala code: | package tierney.free.github
import play.api.libs.json._
import cats.Applicative
import cats.`~>`
import play.api.libs.json._
import scala.concurrent.Future
import tierney.free._
sealed trait GitHub[A]
case class GetComments(owner: Owner, repo: Repo, issue: Issue)
extends GitHub[List[Comment]]
case cl... |
Explain and rewrite the following Scala code: | /*
* This file is part of the "silex" library of helpers for Apache Spark.
*
* Copyright (c) 2015 Red Hat, 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.... |
Explain and rewrite the following Scala code: | /*
* Copyright (C) 2015 Vladimir Konstantinov, Yuriy Gintsyak
*
* 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 3 of the License, or
* (at your option) any later ver... |
Explain and rewrite the following Scala code: | /**
* Copyright 2015 Mohiva Organisation (license at mohiva dot com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless require... |
Explain and rewrite the following Scala code: | package reductions
import org.scalameter._
import common._
import scala.annotation.tailrec
object LineOfSightRunner {
val standardConfig = config(
Key.exec.minWarmupRuns -> 40,
Key.exec.maxWarmupRuns -> 80,
Key.exec.benchRuns -> 100,
Key.verbose -> true
) withWarmer(new Warmer.Default)
def ... |
Explain and rewrite the following Scala code: | package com.twitter.server.view
import com.twitter.finagle.Http
import com.twitter.finagle.Name
import com.twitter.finagle.Service
import com.twitter.finagle.http.Request
import com.twitter.finagle.http.Response
import com.twitter.finagle.loadbalancer.BalancerRegistry
import com.twitter.finagle.loadbalancer.Balancers
... |
Explain and rewrite the following Scala code: | package com.ing.baker.runtime.common
import com.ing.baker.il.CompiledRecipe
import com.ing.baker.il.failurestrategy.ExceptionStrategyOutcome
import com.ing.baker.runtime.common.LanguageDataStructures.LanguageApi
// TODO: rename subtypes of BakerEvent to resamble the new names
trait BakerEvent extends LanguageApi {
... |
Explain and rewrite the following Scala code: | package com.tothferenc.templateFX.base
import com.tothferenc.templateFX.base.attribute.Attribute
import com.tothferenc.templateFX.change.Change
final case class Fixture[Item, U](item: Item, attribute: Attribute[Item, U]) {
def reconcile(template: Template[U]): Unit = changes(template).foreach(_.execute())
privat... |
Explain and rewrite the following Scala code: | package glint.models.client.async
import java.util.concurrent.TimeUnit
import akka.pattern.{AskTimeoutException, ask}
import akka.actor.ActorRef
import akka.util.Timeout
import com.typesafe.config.Config
import glint.exceptions.PushFailedException
import glint.messages.server.logic._
import scala.concurrent.{Future,... |
Explain and rewrite the following Scala code: | package forimpatient.chapter04
import scala.collection.mutable.Map
import scala.io.Source
/**
* Created by Iryna Kharaborkina on 7/29/16.
*
* Solution to the Chapter 04 Exercise 02 'Scala for the Impatient' by Horstmann C.S.
*
* Write a program that reads words from a file. Use a mutable map to count how o... |
Explain and rewrite the following Scala code: | /*
* Copyright 2016 rdbc contributors
*
* 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 lila.game
import akka.actor._
import akka.pattern.pipe
import com.typesafe.config.Config
import lila.common.PimpedConfig._
final class Env(
config: Config,
db: lila.db.Env,
mongoCache: lila.memo.MongoCache.Builder,
system: ActorSystem,
hub: lila.hub.Env,
getLightUser: String => Option... |
Explain and rewrite the following Scala code: | package godot.imperative
import godot.imperative.Flow._
import junit.framework.TestCase
import org.junit.Assert._
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.Future
import scala.language.implicitConversions
class AsyncTest extends TestCase{
val FLOW_INNER_VALUE: Int = 42
va... |
Explain and rewrite the following Scala code: | package de.fosd.typechef.typesystem.linker
import de.fosd.typechef.error.Position
import de.fosd.typechef.featureexpr.FeatureExprFactory.{False, True}
import de.fosd.typechef.featureexpr.{FeatureExpr, FeatureExprFactory, FeatureModel}
import de.fosd.typechef.typesystem.{CInt, CSigned, _}
/**
* linking can... |
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: | /*
* La Trobe University - Distributed Deep Learning System
* Copyright 2014 Matthias Langer (t3l@threelights.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.apa... |
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.javac
import com.sun.source.tree._
import com.sun.source.util.SourcePositions
import com.sun.source.util.TreePath
import com.sun.source.util.TreePathScanner
import sc... |
Explain and rewrite the following Scala code: | /**
*
* No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
*
* OpenAPI spec version: 1.0
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*... |
Explain and rewrite the following Scala code: | package com.invincea.spark.hash
import org.apache.spark.mllib.linalg.SparseVector
import org.apache.spark.rdd.RDD
import scala.collection.mutable.ListBuffer
import org.apache.spark.SparkContext._
class LSHModel(p : Int, m : Int, numRows : Int) extends Serializable {
/** generate rows hash functions */
private... |
Explain and rewrite the following Scala code: | /*
* Copyright (c) 2015-2017 EpiData, Inc.
*/
package com.epidata.spark.utils
import java.sql.Timestamp
import com.epidata.lib.models._
import com.epidata.lib.models.util.{ TypeUtils, JsonHelpers, Binary }
import com.epidata.spark.models.MeasurementDB
object ConvertUtils {
def optionNoneToString(string: Option[... |
Explain and rewrite the following Scala code: | /**
* Copyright 2011-2012 eBusiness Information, Groupe Excilys (www.excilys.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*... |
Explain and rewrite the following Scala code: | package com.simple.simplespec.matchers
import org.hamcrest.{Description, BaseMatcher}
import com.simple.simplespec.{Outcome, Failure}
class ThrownExceptionMatcher(expectedException: Class[_]) extends BaseMatcher[Outcome[Any]] {
def describeTo(description: Description) {
description.appendText("throws an excepti... |
Explain and rewrite the following Scala code: | package com.seanshubin.builder.domain
import java.nio.file.Paths
trait SystemSpecificDependencyInjection {
val system: SystemContract = SystemDelegate
val map: Map[String, SystemSpecific] = Map(
"/Users/sshubin" -> SystemSpecific(
commandPrefix = Seq(),
githubDirectory = Paths.get("/Users/sshubin/... |
Explain and rewrite the following Scala code: | /*
* Copyright 2015 Netflix, 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 t... |
Explain and rewrite the following Scala code: | package teststate.run
import japgolly.microlibs.name_fn._
import teststate.core.CoreExports._
import teststate.core.CoreExports3._
import teststate.typeclass.PolyComposable
import teststate.typeclass.PolyComposable._
trait RunImplicits {
implicit def testStatePlanComposable[F[_], R, O, S, E]: Mono[SeqOp, Plan[F, R... |
Explain and rewrite the following Scala code: | /*
* This file is part of SmartDiet.
*
* Copyright (C) 2011, Aki Saarinen.
*
* SmartDiet was developed in affiliation with Aalto University School
* of Science, Department of Computer Science and Engineering. For
* more information about the department, see <http://cse.aalto.fi/>.
*
* SmartDiet is free softwar... |
Explain and rewrite the following Scala code: | /*
* Copyright 2014-2021 Netflix, 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 agr... |
Explain and rewrite the following Scala code: | package io.mpjsons.impl.deserializer.immutables
import io.mpjsons.impl.deserializer.jsontypes.AbstractJsonMapDeserializer
import io.mpjsons.impl.util.Context
import io.mpjsons.impl.{DeserializerFactory, StringIterator}
import scala.collection.immutable.HashMap
import scala.reflect.runtime.universe._
/**
* @author M... |
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 eu.ace_design.island.game
import eu.ace_design.island.bot.IExplorerRaid
import eu.ace_design.island.map.IslandMap
import eu.ace_design.island.stdlib.PointOfInterests.Creek
import eu.ace_design.island.stdlib.Biomes._
import eu.ace_design.island.stdlib.Resources.WOOD
import org.specs2.mutable._
import org.specs2... |
Explain and rewrite the following Scala code: | package cwe.scala.library.runtime
import cwe.scala.library.runtime.test.audit._
import cwe.scala.library.runtime.test._
import cwe.scala.library.runtime.test.math.bignumbers._
import cwe.scala.library.runtime.test.math._
import cwe.scala.library.runtime.exploration.cweExplore
import cwe.scala.library.runtime.test.boxes... |
Explain and rewrite the following Scala code: | /* Title: Pure/Isar/outer_syntax.scala
Author: Makarius
Isabelle/Isar outer syntax.
*/
package isabelle
import scala.util.parsing.input.{Reader, CharSequenceReader}
import scala.collection.mutable
object Outer_Syntax
{
def quote_string(str: String): String =
{
val result = new StringBuilder(... |
Explain and rewrite the following Scala code: |
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
/** @author John Miller
* @version 1.3
* @date Tue May 13 16:18:42 EDT 2014
* @see LICENSE (MIT style license file).
* -----------------------------------------------------------------------------
* The scala2d package d... |
Explain and rewrite the following Scala code: | /*
* DirichletParameter.scala
* Elements representing learnable Dirichlet parameters.
*
* Created By: Michael Howard (mhoward@cra.com)
* Creation Date: Jul 17, 2013
*
* Copyright 2013 Avrom J. Pfeffer and Charles River Analytics, Inc.
* See http://www.cra.com or email figaro@cra.com for information.
*
... |
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.github.jancajthaml.money
import org.scalatest.{FlatSpec, Matchers}
class ComparationSpecs extends FlatSpec with Matchers {
val run = true
if (run) "Trivia" should "parse 1" in {
val left = Money("40", "EUR")
val right = Money("39", "EUR")
assert(left >= right)
assert(left > right)
... |
Explain and rewrite the following Scala code: | package com.kubukoz.adventofcode2016
/**
* Created by kubukoz on 25/12/2016.
*/
object Day12 {
type State = Map[Char, Int]
def transformInput(instructions: List[String], startMap: State): State = {
val cpyNumber = """cpy (\\d+) (\\w)""".r
val cpyRegister = """cpy (\\w) (\\w)""".r
val incRegister ... |
Explain and rewrite the following Scala code: | package org.scaladebugger.api.debuggers
import com.sun.jdi._
import com.sun.jdi.connect.AttachingConnector
import org.scaladebugger.api.profiles.{ProfileManager, StandardProfileManager}
import org.scaladebugger.api.utils.{Logging, LoopingTaskRunner}
import org.scaladebugger.api.virtualmachines.{ScalaVirtualMachine, Sca... |
Explain and rewrite the following Scala code: | package org.deepdive.test.unit
import org.deepdive.test.helpers._
import org.deepdive.inference._
import org.deepdive.test._
import org.scalatest._
import org.deepdive.datastore._
import org.deepdive.settings._
import java.io._
import org.deepdive.Logging
import akka.actor._
import akka.testkit._
import org.deepdive.... |
Explain and rewrite the following Scala code: | /*
* Copyright 2015 eleflow.com.br.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to ... |
Explain and rewrite the following Scala code: | /*
* Copyright 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 org.zella.io
import java.nio.file._
import com.google.common.truth.Truth.assertThat
import io.reactivex.functions.Consumer
import io.reactivex.schedulers.Schedulers
import io.reactivex.subscribers.TestSubscriber
import okhttp3.OkHttpClient
import org.junit._
import org.junit.rules.TemporaryFolder
import org.z... |
Explain and rewrite the following Scala code: | package tests
import org.scalacheck.Gen
import org.scalacheck.Prop.forAll
import utilities.{CubicCurve, Vec2}
/**
* Created by weijiayi on 3/4/16.
*/
object LetterTests {
val vec2Gen = for{
x <- Gen.choose(0.0,2.0)
y <- Gen.choose(-2.0,2.0)
} yield Vec2(x,y)
val cubicGen = for{
p0 <- vec2Gen
... |
Explain and rewrite the following Scala code: | package com.jackbeasley.enigma.rotors
import com.jackbeasley.enigma.{Rotor, Cipher}
class RotorIV(literalOffset:Int = 1) extends Rotor(
//Steps at 'K'
'K',
//Value pairs
new Cipher(Array(
('A','E'),
('B','S'),
('C','O'),
('D','V'),
('E','P'),
('F','Z'),
('G','J'),
('H','A'),
... |
Explain and rewrite the following Scala code: | package org.receiver2d.engine.ecs.components
import org.lwjgl.opengl.GL11._
import org.lwjgl.opengl.GLContext
import org.receiver2d.engine.Debug
import org.receiver2d.engine.geometry._
import org.receiver2d.engine.graphics._
import org.receiver2d.engine.math.Vec2
/**
* Represents entity morphology. Takes care of ren... |
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 com.seanshubin.learn.spark.core
trait Random {
def nextInt(upperExclusive: Int): Int
}
|
Explain and rewrite the following Scala code: | /**
* Copyright 2017 ZuInnoTe (Jörn Franke) <zuinnote@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by appli... |
Explain and rewrite the following Scala code: | package com.shorrockin.cascal.model
import org.apache.cassandra.thrift.{ColumnOrSuperColumn}
case class SuperKey(val value:String, val family:SuperColumnFamily) extends Key[SuperColumn, Seq[(SuperColumn, Seq[Column[SuperColumn]])]] {
def \\(value:Array[Byte]) = new SuperColumn(value, this)
/**
* converts a ... |
Explain and rewrite the following Scala code: | package io.pipeline.prediction.jvm
trait Initializable {
def initialize(args: java.util.Map[String, Any]): Unit
}
|
Explain and rewrite the following Scala code: | package ls
trait Serializing {
def serialize[T <: AnyRef](o: T): String
}
trait JsonSerializing extends Serializing {
import org.json4s._
import org.json4s.native.Serialization
import org.json4s.native.Serialization.{read, write}
implicit val formats = Serialization.formats(NoTypeHints)
def serialize[T <... |
Explain and rewrite the following Scala code: | /**
*
* HttpClient
* Ledger wallet
*
* Created by Pierre Pollastri on 12/06/15.
*
* The MIT License (MIT)
*
* Copyright (c) 2015 Ledger
*
* 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 S... |
Explain and rewrite the following Scala code: | package lila.game
import chess.variant.Variant
import org.joda.time.DateTime
import scala.util.{ Try, Success, Failure }
import chess._
import lila.db.ByteArray
object BinaryFormat {
object pgn {
def write(moves: PgnMoves): ByteArray = ByteArray {
format.pgn.Binary.writeMoves(moves).get.toArray
}
... |
Explain and rewrite the following Scala code: | /*
* Copyright (c) 2017 Magomed Abdurakhmanov, Hypertino
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
*/
package com.hypertino.facade.integration
import com... |
Explain and rewrite the following Scala code: | /*
* Copyright 2013 Maurício Linhares
*
* Maurício Linhares licenses this file to you under the Apache License,
* version 2.0 (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless ... |
Explain and rewrite the following Scala code: | package org.skycastle.entity.accesscontrol
import org.skycastle.entity.EntityId
/**
* Something that can be granted a users. Ultimately boils down to collections of EntityId:s
*
* @author Hans Haggstrom
*/
@serializable
@SerialVersionUID(1)
trait RoleMember {
def containsEntity(entity: EntityId) : Boolean
}
|
Explain and rewrite the following Scala code: | package bjoveski
import java.io.File
/**
* Created by bojan on 7/1/16.
*/
case class State(store: Map[File, TaggedImage], index: Map[String, Seq[TaggedImage]])
object State {
def apply(): State = new State(Map(), Map())
def apply(dir: File) = {
val images = ImageReader.readFolder(dir.getAbsolutePath)
... |
Explain and rewrite the following Scala code: | package com.nbmfk.sobatch.model
final case class QuestionList(items:Seq[RawQuestion]) |
Explain and rewrite the following Scala code: | package fpinscala.exercises.ch11monads
trait Functor[F[_]] {
def map[A, B](fa: F[A])(f: A => B): F[B]
def distribute[A, B](fab: F[(A, B)]): (F[A], F[B]) = {
(map(fab)(_._1), map(fab)(_._2))
}
def codistribute[A, B](e: Either[F[A], F[B]]): F[Either[A, B]] = e match {
case Left(fa) => map(fa)(Left(_))
... |
Explain and rewrite the following Scala code: | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... |
Explain and rewrite the following Scala code: | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... |
Explain and rewrite the following Scala code: | package org.jetbrains.plugins.scala
package annotator
import org.intellij.lang.annotations.Language
import org.jetbrains.plugins.scala.base.SimpleTestCase
import org.jetbrains.plugins.scala.extensions._
import org.jetbrains.plugins.scala.lang.psi.api.expr.ScTypedStmt
class TypedStatementAnnotatorTest extends SimpleTe... |
Explain and rewrite the following Scala code: | import org.scalatest.{Matchers, FunSuite}
/** @version 1.2.0 */
class RnaTranscriptionTest extends FunSuite with Matchers {
test("RNA complement of cytosine is guanine") {
RnaTranscription.toRna("C") should be(Some("G"))
}
test("RNA complement of guanine is cytosine") {
pending
RnaTranscription.toR... |
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.osu.cse.groenkeb.logic.model
import edu.osu.cse.groenkeb.logic.model.rules.ModelRule
import edu.osu.cse.groenkeb.logic.model.rules.UniversalFalsification
import edu.osu.cse.groenkeb.logic.model.rules.OrFalsification
import edu.osu.cse.groenkeb.logic.model.rules.NegationFalsification
import edu.osu.cse.groe... |
Explain and rewrite the following Scala code: | package at.forsyte.apalache.tla.assignments
import at.forsyte.apalache.tla.lir.convenience.tla
import at.forsyte.apalache.tla.lir.TestingPredefs
import at.forsyte.apalache.tla.lir.storage.{ChangeListener, SourceLocator}
import at.forsyte.apalache.tla.lir.transformations.impl.TrackerWithListeners
import org.junit.runne... |
Explain and rewrite the following Scala code: | /*
* Copyright 2015 HM Revenue & Customs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or a... |
Explain and rewrite the following Scala code: | package week01.json
object QueriesInFor {
case class Baby(name: String, parents: List[String]);import org.scalaide.worksheet.runtime.library.WorksheetSupport._; def main(args: Array[String])=$execute{;$skip(647);
val babies = Set(
Baby(
name = "Julia",
parents = List("Julio", "Marilia")),
Ba... |
Explain and rewrite the following Scala code: | import core.EuclideanDomainModdingContext
/**
* This package contains the EuclideanDomain of integers as well as types for the integers modulo a number.
*
* Note that you are encouraged to use the package-level [[integer.integers]] value as opposed to directly instantiating
* [[integer.Integers]].
*/
package... |
Explain and rewrite the following Scala code: | package io.krom.lsh
import breeze.linalg.DenseVector
import com.redis.RedisClient
import org.scalatest.BeforeAndAfterEach
import org.scalatest.funspec.AnyFunSpec
import org.scalatest.matchers.should.Matchers
import redis.embedded.RedisServer
class RedisLshTableSpec
extends AnyFunSpec
with Matchers
with Be... |
Explain and rewrite the following Scala code: | /*
* Copyright 2016 org.NLP4L
*
* 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 com.twitter.finagle
import com.twitter.util.{Await, Future, Promise}
import org.junit.runner.RunWith
import org.scalacheck.{Arbitrary, Gen}
import org.scalatest.FunSuite
import org.scalatest.junit.{AssertionsForJUnit, JUnitRunner}
import org.scalatest.prop.GeneratorDrivenPropertyChecks
@RunWith(classOf[JUnitR... |
Explain and rewrite the following Scala code: | package scrupal.admin
import play.api.routing.sird._
import scrupal.core._
class AdminProvider(implicit val scrupal: Scrupal) extends { val id = 'admin } with ApplicationProvider {
def name: String = id.name
object moduleProvider extends AdminModuleProvider
object siteProvider extends AdminSiteProvider
obje... |
Explain and rewrite the following Scala code: | package com.github.ldaniels528.trifecta.sjs.services
import io.scalajs.npm.angularjs.Service
import io.scalajs.npm.angularjs.http._
import io.scalajs.dom.html.browser.encodeURI
import com.github.ldaniels528.trifecta.sjs.models._
import scala.scalajs.js
import scala.scalajs.js.Array
/**
* Topic Service
* @author ... |
Explain and rewrite the following Scala code: | package io.udash.properties
import io.udash.testing.UdashCoreTest
class PropertyCreatorTest extends UdashCoreTest {
// DO NOT REMOVE THIS IMPORT!
import io.udash.properties.Properties._
trait T {
def i: Int
def x: Int = 5
val s: String
val l: Long = 8L
}
object T extends HasModelPropertyCre... |
Explain and rewrite the following Scala code: | package org.pico.fp.impl.syntax.toOps
import org.pico.fp.impl.syntax.ops.ApplicativeOps_Gggv37e
import scala.language.implicitConversions
trait ToApplicativeOps extends ToApplyOps {
@inline
final implicit def applicativeOps_Gggv37e[A](self: A): ApplicativeOps_Gggv37e[A] = {
new ApplicativeOps_Gggv37e[A](self... |
Explain and rewrite the following Scala code: | package object drscala {
implicit class RichAny[A](x: A) { def const[B]: B => A = _ => x }
type Column = Int
type Line = Int
type Position = (Line, Column)
type Message = String
type Universe = reflect.api.Universe
class Prefix(value: String) { def unapply(xs: String): Option[String] = if (xs.startsWith... |
Explain and rewrite the following Scala code: | package doodle
package java2d
package algebra
import doodle.java2d.effect.Canvas
import monix.reactive.Observable
trait Redraw extends doodle.interact.algebra.Redraw[Canvas] {
def redraw(canvas: Canvas): Observable[Int] = {
canvas.redraw
}
}
|
Explain and rewrite the following Scala code: | /*
* Copyright (c) 2012 - 2020 Splice Machine, Inc.
*
* This file is part of Splice Machine.
* Splice Machine 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, or (at your option) ... |
Explain and rewrite the following Scala code: | package dotty.tools.languageserver.util
import dotty.tools.languageserver.util.embedded.CodeMarker
import dotty.tools.languageserver.util.server.TestFile
class PositionContext(positionMap: Map[CodeMarker, (TestFile, Int, Int)]) {
private[this] var lastKey: CodeMarker = _
private[this] var lastValue: (TestFile, In... |
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: | /*
* This file is part of KatLib, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 Katrix
*
* 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 w... |
Explain and rewrite the following Scala code: | package util
import play.api.mvc._
object Tool {
trait TxAction[T] extends Action[T] {
}
} |
Explain and rewrite the following Scala code: | /*
* Copyright (c) 2014-2020 by The Monix Project Developers.
* See the project homepage at: https://monix.io
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.