instruction stringclasses 1
value | output stringlengths 5 1M |
|---|---|
Explain and rewrite the following Scala code: | package com.arcusys.valamis.lesson.scorm.service.sequencing
import com.arcusys.valamis.lesson.scorm.model.sequencing.{ NavigationResponse, NavigationRequestType }
import com.arcusys.valamis.lesson.scorm.model.tracking.{ ActivityStateNode, ActivityStateTree }
import com.arcusys.valamis.util.CollectionExtensions._
/**
... |
Explain and rewrite the following Scala code: | package tests
import scala.collection.mutable
import scala.reflect.ClassTag
final case object AssertionFailed extends Exception
final case class Test(name: String, run: () => Boolean)
abstract class Suite {
private val tests = new mutable.UnrolledBuffer[Test]
def assert(cond: Boolean): Unit =
if (!cond) th... |
Explain and rewrite the following Scala code: | package org.bitcoins.node
import akka.actor.Cancellable
import org.bitcoins.core.crypto.{DoubleSha256Digest, DoubleSha256DigestBE}
import org.bitcoins.core.currency._
import org.bitcoins.node.networking.peer.DataMessageHandler
import org.bitcoins.server.BitcoinSAppConfig
import org.bitcoins.testkit.BitcoinSTestAppConf... |
Explain and rewrite the following Scala code: | /*
* Copyright (c) 2014-2020 by The Monix Project Developers.
* See the project homepage at: https://monix.io
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache... |
Explain and rewrite the following Scala code: | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you... |
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 ... |
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 agr... |
Explain and rewrite the following Scala code: | package lila.opening
import scala.util.{ Try, Success, Failure }
import org.joda.time.DateTime
import play.api.libs.json._
import scalaz.Validation.FlatMap._
private[opening] case class Generated(
fen: String,
moves: Map[String, Generated.Move]) {
def toOpening: Try[Opening.ID => Opening] =
(chess.for... |
Explain and rewrite the following Scala code: | package wvlet.airframe
import wvlet.airframe.DesignTest.Alias.{HelloRef, StringHello}
import wvlet.airframe.tracing.DefaultTracer
import wvlet.airframe.surface.Surface
import wvlet.airspec.AirSpec
/**
*/
object DesignTest extends AirSpec {
trait Message
case class Hello(message: String) extends Message
obje... |
Explain and rewrite the following Scala code: | package system.cell.sensormanagement.sensors
import java.util.concurrent.{Executors, TimeUnit}
import io.reactivex.{BackpressureStrategy, Flowable}
import system.ontologies.sensor.{SensorCategory, Threshold}
/**
* A trait for a sensor, it's implementation should have only a public getter method of the current val... |
Explain and rewrite the following Scala code: | /*
* Copyright 2014 http4s.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://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... |
Explain and rewrite the following Scala code: | /*
* Copyright (C) 2014 AyaIB Developers (http://github.com/fauu/ayaib)
*
* This software is licensed under the GNU General Public License
* (version 3 or later). See the COPYING file in this distribution.
*
* You should have received a copy of the GNU Library General Public License
* along with this software. I... |
Explain and rewrite the following Scala code: | package lila.mod
object AutoAnalysis {
sealed trait Reason
object Reason {
case object HoldAlert extends Reason
case object WhiteMoveTime extends Reason
case object BlackMoveTime extends Reason
case object Blurs extends Reason
case object WinnerRatingProgress extends Reason
case object N... |
Explain and rewrite the following Scala code: | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... |
Explain and rewrite the following Scala code: | /*
* Copyright (c) 2016, Groupon, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditio... |
Explain and rewrite the following Scala code: | /*
* Copyright (C) 2014-2015 by Nokia.
* 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 License.
* You may obtain a copy o... |
Explain and rewrite the following Scala code: | /*
* Copyright (c) 2015,
* Ilya Sergey, Christopher Earl, Matthew Might and David Van Horn
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain t... |
Explain and rewrite the following Scala code: | package org.shapelogic.sc.operation
import org.shapelogic.sc.image.BufferImage
import org.shapelogic.sc.pixel.PixelOperation
import scala.reflect.ClassTag
import scala.reflect.runtime.universe._
import org.shapelogic.sc.pixel.PixelHandlerSame
/**
* This idea is that you can run over an image
*
* Many input channel... |
Explain and rewrite the following Scala code: | // scalac: -Xfatal-warnings -Xno-patmat-analysis
//
// test that none of these warn due to -Xno-patmat-analysis
// tests taken from test/files/neg/patmatexhaust.scala, test/files/neg/pat_unreachable.scala
class TestSealedExhaustive { // compile only
sealed abstract class Foo
case class Bar(x:Int) extends Foo
... |
Explain and rewrite the following Scala code: | package org.akkatrading.backtest
import java.text.DecimalFormat
import java.time.format.DateTimeFormatter
import akka.actor.{Actor, ActorLogging, Props, ReceiveTimeout}
import org.akkatrading.backtest.PriceDataCsvReader.{PriceTicks, ReadTicksFromCsv}
import org.akkatrading.backtest.model.LogMessage
import org.akkatra... |
Explain and rewrite the following Scala code: | package com.nthportal.versions
package semver
package compat
import com.nthportal.versions.v3.compat.VersionFactory
/**
* A factory for for parsing version strings into [[SemanticVersion SemVer versions]]..
*
* @param factory the [[VersionFactory]] with which to parse the version
* and its extensio... |
Explain and rewrite the following Scala code: | package org.eknet.sitebag.rest
import akka.actor.{ActorRef, ActorRefFactory}
import akka.pattern.ask
import akka.util.Timeout
import org.eknet.sitebag._
import org.eknet.sitebag.model.{Page, PageEntry, Token, Tag}
import org.eknet.sitebag.ui.{WebDirectives, WebSettings}
import org.parboiled.common.Base64
import scala.... |
Explain and rewrite the following Scala code: | /**
* Defines node ranking methods
*/
package uk.ac.cdrc.mintsearch.ranking
import org.neo4j.graphdb.Node
import uk.ac.cdrc.mintsearch.index.{BaseIndexReader, LabelTypeContext}
import uk.ac.cdrc.mintsearch.{NodeId, WeightedLabelSet}
trait NodeSearchResultContext {
self: LabelTypeContext =>
case class NodeSear... |
Explain and rewrite the following Scala code: | package com.collective.modelmatrix
import java.time.temporal.ChronoField
import java.time.{DayOfWeek, Instant, ZoneId}
class ModelMatrixFunctions {
def nvl[T](v: T, default: T): T = {
if (v == null) default else v
}
def dayOfWeek(epochMilli: Long, zoneId: ZoneId): Int = {
DayOfWeek.from(Instant.ofEpo... |
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 sample.blog
import org.scalatest.{ BeforeAndAfterAll, WordSpecLike }
import org.scalatest.Matchers
import akka.remote.testkit.MultiNodeSpecCallbacks
/**
* Hooks up MultiNodeSpec with ScalaTest
*/
trait STMultiNodeSpec extends MultiNodeSpecCallbacks
with WordSpecLike with Matchers with BeforeAndAfterAll {
... |
Explain and rewrite the following Scala code: | package com.github.skozlov.ai
import javax.swing.table.DefaultTableModel
import scala.swing.BorderPanel.Position._
import scala.swing._
import scala.swing.event.ButtonClicked
class ProgressUI(implicit model: Model) extends BorderPanel{
private val tactNumber = new Label
model.tactNumber.foreach{ n => Swing.onEDT{... |
Explain and rewrite the following Scala code: | /*
* Copyright 2022 HM Revenue & Customs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or a... |
Explain and rewrite the following Scala code: | package edu.scalanus.parser
import org.antlr.v4.runtime.Token
object ScalanusLexerUtil {
private val _keywordTokens = Set(
ScalanusLexer.AND,
ScalanusLexer.AS,
ScalanusLexer.BREAK,
ScalanusLexer.CASE,
ScalanusLexer.CLASS,
ScalanusLexer.CONST,
ScalanusLexer.CONTINUE,
ScalanusLexer.DO... |
Explain and rewrite the following Scala code: | package skinny.exception
/**
* Represents that route's metadata is invalid.
*
* @param message message
* @param cause cause
*/
case class RouteMetadataException(message: String, cause: Throwable = null) extends RuntimeException(message, cause)
|
Explain and rewrite the following Scala code: | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... |
Explain and rewrite the following Scala code: | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you ... |
Explain and rewrite the following Scala code: | /***********************************************************************
* Copyright (c) 2013-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: | /*
* 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.cloudray.scalapress.security
import org.springframework.security.core.userdetails.{UsernameNotFoundException, UserDetails, UserDetailsService}
import org.springframework.beans.factory.annotation.Autowired
import scala.collection.JavaConverters._
import org.springframework.stereotype.Component
import com.cl... |
Explain and rewrite the following Scala code: | /*
* Copyright 1998-2019 Linux.org.ru
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable... |
Explain and rewrite the following Scala code: | /*
* 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 2014 DataGenerator 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 l... |
Explain and rewrite the following Scala code: | object Test extends dotty.runtime.LegacyApp {
42 match {
case Extractor(a @ Extractor(b @ Extractor(c))) => println(a); println(b); println(c)
}
}
|
Explain and rewrite the following Scala code: | /*
* Copyright (C) 2016 Eugene Yokota
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed t... |
Explain and rewrite the following Scala code: | package com.nyavro.manythanks.ws.auth
import spray.json.DefaultJsonProtocol
trait TokenFormat extends DefaultJsonProtocol {
implicit val tokensFormat = jsonFormat3(Token)
}
|
Explain and rewrite the following Scala code: | package polyite.export
import java.io.BufferedWriter
import java.io.File
import java.io.FileWriter
import java.io.IOException
import java.util.logging.Level
import java.util.logging.Logger
import scala.collection.mutable.HashMap
import polyite.ScopInfo
import polyite.config.Config
import polyite.config.ConfigRand
im... |
Explain and rewrite the following Scala code: | /**
* Copyright (C) 2015 DANS - Data Archiving and Networked Services (info@dans.knaw.nl)
*
* 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 uScheduler.core
import org.scalatest._
import java.io.{File, BufferedWriter, FileWriter}
import scala.sys.process._
import uScheduler.core.reader.DataReader
class LPWriterSpec extends FlatSpec with Matchers {
val dates = "./testdata/CourseData.csv"
val regs = "./testdata/StudentData.csv"
val dataCo... |
Explain and rewrite the following Scala code: | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... |
Explain and rewrite the following Scala code: | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you ... |
Explain and rewrite the following Scala code: | /*
* Copyright (C) 2014 - 2017 Contributors as noted in the AUTHORS.md file
*
* 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)... |
Explain and rewrite the following Scala code: | package org.GutenburgNLP.utils
import org.apache.spark.sql.types.{IntegerType, StringType, StructField, StructType}
/**
* Created by dan.dixey on 05/04/2017.
*/
object schema {
val docId: StructField = StructField("docId", StringType)
val book: StructField = StructField("book", StringType)
val struct: Stru... |
Explain and rewrite the following Scala code: | import language.experimental.erasedDefinitions
erased val x: A = A()
|
Explain and rewrite the following Scala code: | package pureconfig
import scala.collection.JavaConverters._
import com.typesafe.config.{ConfigValueFactory, ConfigValueType}
import org.scalacheck.Arbitrary
import pureconfig.error._
import pureconfig.generic.auto._
class TupleConvertersSuite extends BaseSuite {
case class Foo(a: Int, b: String)
implicit val a... |
Explain and rewrite the following Scala code: | /*
* Copyright (c) 2017 Xavier Defago (Tokyo Institute of Technology)
*
* 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 re... |
Explain and rewrite the following Scala code: | /*
* Copyright 2013-2015 Websudos, Limited.
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of c... |
Explain and rewrite the following Scala code: | package org.cloudio.morpheus.chat
import org.morpheus.{dimension, fragment}
/**
* Created by zslajchrt on 21/03/15.
*/
class Utils {
}
case class EmailMessage(to: String, from: String, subject: String, body: String)
@dimension
trait EmailService {
def sendEmailMessage(message: EmailMessage)
}
@fragment
trait ... |
Explain and rewrite the following Scala code: | package io.iohk.ethereum.vm
import Generators._
import akka.util.ByteString
import org.scalacheck.Gen
import org.scalatestplus.scalacheck.ScalaCheckPropertyChecks
import org.scalatest.flatspec.AnyFlatSpec
import org.scalatest.matchers.should.Matchers
class ProgramSpec extends AnyFlatSpec with Matchers with ScalaCheck... |
Explain and rewrite the following Scala code: | package monocle.function
import monocle.{Iso, PTraversal, Traversal}
import scala.annotation.implicitNotFound
import scala.collection.immutable.ListMap
import cats.{Applicative, Order, Traverse}
/**
* Typeclass that defines a [[Traversal]] from a monomorphic container `S` to all of its elements of type `A`
* @tp... |
Explain and rewrite the following Scala code: | package com.nthportal.shell
package impl
class TestCommand(override val name: String) extends Command {
def this() = this(TestCommand.name)
private var _executed: Boolean = false
def executed: Boolean = _executed
override def execute(args: ImmutableSeq[String])(implicit sink: OutputSink): Unit = _executed =... |
Explain and rewrite the following Scala code: | package monocle.state
import monocle.Getter
import cats.data.State
trait StateGetterSyntax {
@deprecated("no replacement", since = "3.0.0-M1")
implicit def toStateGetterOps[S, A](getter: Getter[S, A]): StateGetterOps[S, A] =
new StateGetterOps[S, A](getter)
}
@deprecated("no replacement", since = "3.0.0-M1"... |
Explain and rewrite the following Scala code: | package aerospikez.util
import org.specs2.mutable.Specification
import aerospikez.{ AerospikeClient, Namespace }
import scalaz.syntax.monoid._
import scalaz.std.AllInstances._
import scalaz.concurrent.Task
import scalaz._, Scalaz._
class ParallelSpec extends Specification {
val client = AerospikeClient()
val ... |
Explain and rewrite the following Scala code: | package de.htwg.zeta.common.format.project.gdsl.shape.geoModel
import de.htwg.zeta.common.format.project.gdsl.style.StyleFormat
import de.htwg.zeta.common.models.project.gdsl.shape.geomodel.Polyline
import play.api.libs.json.JsObject
import play.api.libs.json.JsResult
import play.api.libs.json.JsValue
import play.api.... |
Explain and rewrite the following Scala code: | /*
,i::,
:;;;;;;;
;:,,::;.
1ft1;::;1tL
t1;::;1,
:;::; _____ __ ___ __
fCLff ;:: tfLLC / ___/ / |/ /____ _ _____ / /_
CLft11 :,, i1tffLi \\__ \\ ____ / /|_/ ... |
Explain and rewrite the following Scala code: | package zzb.rest
import akka.actor._
import akka.util.Timeout
import spray.http.Uri
import spray.http.Uri.Path
import zzb.util.MdcLoggingContext
import zzb.util.log.{ HeritLogAdapter, HeritLog }
import scala.concurrent.{ Future, Promise }
import scala.util.{ Failure, Success }
/**
* Created with IntelliJ IDEA.
* U... |
Explain and rewrite the following Scala code: | // vim: expandtab shiftwidth=2 softtabstop=2
/*
* Copyright 2011 杨博 (Yang Bo)
*
* 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: | abstract sealed trait AST
abstract sealed trait AExpr extends AST
case class AAssign(name: String, v: AExpr) extends AExpr
case class AConstBool(v: Boolean) extends AExpr
trait Ty {}
case class TInt() extends Ty
case class TBool() extends Ty
object Foo {
def checkExpr(ast: AExpr): Ty =... |
Explain and rewrite the following Scala code: | import com.cave.metrics.data.Role
import controllers.Alerts
import data.UserData
import org.joda.time.DateTime
import org.mockito.Matchers._
import org.mockito.{Matchers, Mockito}
import org.mockito.Mockito._
import play.api.libs.json.Json
import play.api.mvc.Results
import play.api.test._
import scala.concurrent.{Fut... |
Explain and rewrite the following Scala code: | package gitbucket.core.util
import java.net.{URLDecoder, URLEncoder}
import java.util.Base64
import org.mozilla.universalchardet.UniversalDetector
import SyntaxSugars._
import org.apache.commons.io.input.BOMInputStream
import org.apache.commons.io.IOUtils
import scala.util.control.Exception._
object StringUtil {
... |
Explain and rewrite the following Scala code: | /* Copyright 2017 Christopher Boucher
*
* 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: | /*
* 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: | import SummonJsonEncoderTest._
case class PersonSimple(name:String, age:Int)
object Test {
val stuff = PersonSimple("Joe", 123)
def main(args: Array[String]):Unit = {
println(SummonJsonEncoderTest.encodeAndMessAroundType(stuff) )
}
} |
Explain and rewrite the following Scala code: | package io.kaitai.struct.format
import io.kaitai.struct.datatype.DataType.{UserType, UserTypeInstream}
import io.kaitai.struct.exprlang.Ast
import io.kaitai.struct.format
import io.kaitai.struct.formats.JavaKSYParser
import io.kaitai.struct.problems.CompilationProblemException
import org.scalatest.FunSpec
import org.s... |
Explain and rewrite the following Scala code: | package ${package}.snippet
import _root_.scala.xml.{NodeSeq, Text}
import _root_.net.liftweb.util._
import _root_.net.liftweb.common._
import _root_.java.util.Date
import ${package}.lib._
import Helpers._
class HelloWorld {
lazy val date: Box[Date] = DependencyFactory.inject[Date] // inject the date
def howdy(in... |
Explain and rewrite the following Scala code: | package org.jetbrains.plugins.scala
package compiler
import java.io.{File, IOException}
import javax.swing.event.HyperlinkEvent
import com.intellij.compiler.server.BuildManager
import com.intellij.ide.plugins.{IdeaPluginDescriptor, PluginManager}
import com.intellij.notification.{Notification, NotificationListener, N... |
Explain and rewrite the following Scala code: | /*
* This file is part of Alpha.
*
* Alpha 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
* any later version.
*
* Foobar is distributed in the hope that it will be... |
Explain and rewrite the following Scala code: | package form
import play.api.mvc._
import play.api.data.format.Formatter
import play.api.data.{FormError, Forms, Mapping}
/**
* @copyright https://github.com/leon/play-enumeration.git
*
*/
package object form {
/**
* Constructs a simple mapping for a text field (mapped as `scala.Enumeration`)
*
* For exam... |
Explain and rewrite the following Scala code: | /*
* bytefrog: a tracing framework for the JVM. For more information
* see http://code-pulse.com/bytefrog
*
* Copyright (C) 2014 Applied Visions - http://securedecisions.avi.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
... |
Explain and rewrite the following Scala code: | /*
* Copyright 2019 Spotify AB.
*
* 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: | package uk.ac.ed.inf.mois
import spire.algebra.{Order, Rig, Ring, Field}
final class RigVarSyntax[T : Rig](v: Var[T]) {
def += (y: T) { v.update(Rig[T].plus(v.value, y)) }
def *= (y: T) { v.update(Rig[T].times(v.value, y)) }
}
final class RingVarSyntax[T: Ring](v: Var[T]) {
def -= (y: T) { v.update(Ring[T].plus... |
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 polyite.util
import java.io.File
import scala.collection.Iterator
import java.io.BufferedReader
import java.io.FileReader
import scala.collection.mutable.StringBuilder
import java.io.IOException
import java.time.format.DateTimeFormatter
import java.text.ParsePosition
import java.time.LocalDateTime
object LogF... |
Explain and rewrite the following Scala code: | package tk.monnef.randomrenamer
import java.io.{ByteArrayOutputStream, PrintWriter, File}
import scalaz._
import Scalaz._
import scala.sys.process.ProcessLogger
import scala.sys.process._
object Utils {
def getListOfFiles(dir: String): List[File] = {
val d = new File(dir)
if (d.exists && d.isDirectory) {
... |
Explain and rewrite the following Scala code: | package scala.tools.nsc
package backend.jvm
package opt
import org.junit.Assert._
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.JUnit4
import scala.tools.asm.Opcodes._
import scala.tools.testkit.ASMConverters._
import scala.tools.testkit.AssertUtil._
import scala.tools.testkit.Bytecod... |
Explain and rewrite the following Scala code: | package org.scalaide.extensions
package autoedits
import org.eclipse.jface.text.{Document => EDocument}
import org.scalaide.core.internal.text.TextDocument
import org.scalaide.core.{text => impl}
import org.scalaide.core.text.CursorUpdate
import org.scalaide.core.text.Document
import org.scalaide.core.text.LinkedModel... |
Explain and rewrite the following Scala code: | package org.scalawiki.dto.markup
import org.scalawiki.dto.Image
import org.specs2.matcher.ContentMatchers._
import org.specs2.mutable.Specification
import org.scalawiki.dto.markup.LineUtil._
class GalleryHtmlSpec extends Specification {
"gallery as html" should {
"be without descriptions" in {
val title... |
Explain and rewrite the following Scala code: | package com.gravity.hbase.schema
import scala.collection.mutable.Buffer
import org.apache.hadoop.hbase.client.Put
import org.joda.time.DateTime
import scala.collection.Map
/* )\\._.,--....,'``.
.b--. /; _.. \\ _\\ (`._ ,.
`=,-,-'~~~ `----(,_..'--(,_..'`-.;.' */
/**
* A Put operation. Ca... |
Explain and rewrite the following Scala code: | package jsky.app.ot.vcs
import edu.gemini.spModel.core.{SPProgramID, Peer}
import jsky.app.ot.userprefs.observer.ObservingPeer
import jsky.app.ot.viewer.SPViewer
import java.awt.{Point, Toolkit, Color}
import javax.swing.{UIManager, BorderFactory}
import scala.collection.JavaConverters._
import scala.swing._
import ... |
Explain and rewrite the following Scala code: | /** Copyright 2014 TappingStone, 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 ... |
Explain and rewrite the following Scala code: | package reactor.core.scala.publisher
import reactor.core.scala.{Scannable, VersionedScannable}
import scala.collection.JavaConverters._
trait VersionedFluxProcessor[IN, OUT] extends VersionedScannable { self: FluxProcessor[IN, OUT] =>
override def inners(): Stream[_ <: Scannable] = jFluxProcessor.inners().iterator... |
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.
*/
import scala.language.implicit... |
Explain and rewrite the following Scala code: | package de.htw.pgerhard
trait WithUser {
this: MyTwitterFeature with MyTwitterSteps ⇒
beforeEachScenario (
register_a_user(handle = "@test", name = "Test User", alias = "test-user")
)
afterEachScenario (
delete_user("<test-user>")
)
}
|
Explain and rewrite the following Scala code: | package screact.swing.ext
import screact.*
final class SwingSignalExt[T](delegate:Signal[T]) extends EdtReactive {
/** ensure current is called inside the EDT */
def currentInEdt:T = readInEdt { decouple { delegate.current } }
}
|
Explain and rewrite the following Scala code: | package chapter06
// Write an enumeration describing the four playing card suits
// so that the toString method returns ♣, ♦, ♥, or ♠.
object Exercise6 extends App {
object Suits extends Enumeration {
val Hearts = Value("♥")
val Spades = Value("♠")
val Diamonds = Value("♦")
val Clubs = Value("♣")
... |
Explain and rewrite the following Scala code: | package org.finra.datagenerator.scaffolding.random
import org.springframework.stereotype.Service
import java.util.Random
/**
* Created by dkopel on 9/30/16.
*/
@Service
trait RandomProvider {
def nextObject[T](clazz: Class[T], args: Parameter[_]*): T
def nextObject[T](clazz: Class[T]): T
def next(bits... |
Explain and rewrite the following Scala code: | /**
* Copyright (C) 2007 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 prog... |
Explain and rewrite the following Scala code: | package deburnat.transade.core.storages._storages
import collection.mutable.ListBuffer
import deburnat.transade.core.admins.CoreAdmin.{tb1, tb3, tb4, tb5, tb6, a, c, cc, br, brr}
import deburnat.transade.core.storages.AbsStorage
/**
* Project name: transade
* @author Patrick Meppe (tapmeppe@gmail.com)
* Descriptio... |
Explain and rewrite the following Scala code: | package xyz.hyperreal.sprayapp
import akka.actor.{Actor, ActorSystem, Props, ActorRefFactory}
import akka.io.IO
import akka.pattern.ask
import akka.util.Timeout
import spray.can.Http
import spray.routing._
import concurrent.duration._
trait SprayApp extends App with HttpService {
@volatile private[this] var _ref... |
Explain and rewrite the following Scala code: | package de.hpi.asg.breezetestgen.actors
import akka.actor.{ActorRef, Props, Terminated}
import de.hpi.asg.breezetestgen.actors.HandshakeActor.{Decision, GetState, MyState}
import de.hpi.asg.breezetestgen.domain
import de.hpi.asg.breezetestgen.domain.Channel.{CompEndpoint, PortEndpoint}
import de.hpi.asg.breezetestgen.... |
Explain and rewrite the following Scala code: | package org.jetbrains.plugins.scala
package testingSupport.test.specs2
import com.intellij.execution.actions.RunConfigurationProducer
import com.intellij.execution.configurations.ConfigurationFactory
import com.intellij.psi.util.PsiTreeUtil
import org.jetbrains.plugins.scala.extensions._
import org.jetbrains.plugins.s... |
Explain and rewrite the following Scala code: | object ScalaTutorial1{
def main(args: Array[String]){
var i = 0
//List Generator
var evenList = for{i <- 1 to 20 if i % 2 == 0} yield i
for(i <- evenList){
println(i)
}
println("=======================")
// Mutiple iteration
for( i <- 1 to 5; j <- 6 to 10){
println(i);
... |
Explain and rewrite the following Scala code: | package com.boldradius.astrolabe.client.components
import scala.scalajs.js
import scala.scalajs.js.annotation.JSName
@JSName("stubs")
object Stubs extends js.Object {
val SvgIcon: js.Dynamic = js.native
}
|
Explain and rewrite the following Scala code: | package latis.writer
import latis.dm._
import java.io.OutputStream
/**
* Writer to present a Dataset in a way that reflects how it is modeled.
*/
class AsciiWriter extends TextWriter {
override def makeHeader(dataset: Dataset): String = dataset.toString + newLine
override lazy val delimiter = " -> "
... |
Explain and rewrite the following Scala code: | package controllers.io
import java.net.{MalformedURLException, URL, URLDecoder}
import java.nio.charset.StandardCharsets
import javax.inject.Inject
import com.mohiva.play.silhouette.api.Environment
import com.mohiva.play.silhouette.impl.authenticators.CookieAuthenticator
import controllers.{ResultFormat, ViewContext}... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.