instruction stringclasses 1
value | output stringlengths 5 1M |
|---|---|
Explain and rewrite the following Scala code: | package edu.gemini.model.p1.dtree.inst
import edu.gemini.model.p1.dtree._
import edu.gemini.model.p1.immutable._
object Trecs {
import InstrumentMode._
def apply() = new ModeNode
class ModeNode extends SingleSelectNode[Unit, InstrumentMode, Unit](()) with InstrumentModeNode {
def instrumentName = "T-ReCS"... |
Explain and rewrite the following Scala code: | package scales.query
import org.scalajs.dom.{ Element, NodeSelector }
trait CachedNodeProvider[A <: NodeSelector] extends NodeProvider[A] {
private var cache: Map[String, Seq[Element]] = Map.empty
override def querySelector[T <: Element](selectors: String): Option[T] =
cache.get(selectors) match {
... |
Explain and rewrite the following Scala code: | /*
* Licensed to Intel Corporation under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* Intel Corporation licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use t... |
Explain and rewrite the following Scala code: | /*
* Copyright 2011-2022 GatlingCorp (https://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: | /*
*
* 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 com.github.twinra.lendmanager.rest
import com.github.twinra.lendmanager.domain.Item
import com.github.twinra.lendmanager.repo.ItemRepository
import com.typesafe.scalalogging.LazyLogging
import org.json4s.{DefaultFormats, Formats}
import org.scalatra.ScalatraServlet
import org.scalatra.json.JacksonJsonSupport
... |
Explain and rewrite the following Scala code: | package org.jetbrains.plugins.scala.testingSupport.scalatest.fileStructureView
import org.jetbrains.plugins.scala.lang.structureView.elements.impl.TestStructureViewElement._
import org.jetbrains.plugins.scala.testingSupport.scalatest.ScalaTestTestCase
/**
* @author Roman.Shein
* @since 20.04.2015.
*/
trait FunS... |
Explain and rewrite the following Scala code: | package lila.report
sealed trait Reason {
def name = toString.toLowerCase
}
object Reason {
case object Cheat extends Reason
case object Insult extends Reason
case object Troll extends Reason
case object Other extends Reason
val communication: Set[Reason] = Set(Insult, Troll, Other)
val all = List(C... |
Explain and rewrite the following Scala code: | package ru.ispras.textnormalization.tokenizer
/**
* Created by padre on 02.12.15
*/
trait AbstractTokenizer {
def apply(string: String): Seq[String]
}
|
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.roundeights.isred
import scala.concurrent.{Future, Promise, ExecutionContext}
import scala.util.{Success, Failure}
/**
* Executes a list of methods in the order they are queued
*/
class WorkList[T] ( implicit context: ExecutionContext ) {
type WorkType = Function0[Future[T]]
/** The list of wo... |
Explain and rewrite the following Scala code: | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... |
Explain and rewrite the following Scala code: | /*
* Copyright 2016 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) 2012, 2013 Roberto Tyley
*
* This file is part of 'BFG Repo-Cleaner' - a tool for removing large
* or troublesome blobs from Git repositories.
*
* BFG Repo-Cleaner is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* ... |
Explain and rewrite the following Scala code: | package com.nikolastojiljkovic.quilltrait
import io.getquill.dsl.{ MetaDsl, MetaDslLowPriorityImplicits }
import scala.language.experimental.macros
trait AnnotatedTraitSupportMetaDslHighPriorityImplicits extends MetaDslLowPriorityImplicits {
this: MetaDsl =>
implicit def materializeRefinedTypeQueryMeta[T]: Quer... |
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 oauthorize.test
import org.specs2.mutable._
import org.specs2.runner._
import org.junit.runner._
import oauth2.spec.Req._
import oauthorize.utils._
import oauthorize.model._
import oauth2.spec.GrantTypes._
import oauth2.spec.AccessTokenErrors._
import oauth2.spec.Error._
import oauth2.spec.ResponseType
import ... |
Explain and rewrite the following Scala code: | package ru.maizy.cheesecake.core.utils
/**
* Copyright (c) Nikita Kovaliov, maizy.ru, 2016
* See LICENSE.txt for details.
*/
import scala.util.matching.Regex.Match
object StringUtils {
private val upperCaseChars = "A-Z"
private val endWithUpperCase = s"([$upperCaseChars]+$$)".r
private val upperCaseRe = s"([... |
Explain and rewrite the following Scala code: | package discord.commands
import common.DefaultLang
import common.api.commands.HelpCommand
import common.ref.MtrConfigRef
import discord.api.DiscordCommand
import discord.event.DiscordCommandExecutionEvent
import discord.util.DiscordMessageUtil
import javax.inject.Inject
class DiscordHelpCommand @Inject()(implicit val... |
Explain and rewrite the following Scala code: | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... |
Explain and rewrite the following Scala code: | package com.lucidchart.open.nark.offline
import akka.actor.Actor
import akka.actor.Props
import com.lucidchart.open.nark.utils.Graphite
import com.lucidchart.open.nark.models.HostModel
import com.lucidchart.open.nark.models.MutexModel
import com.lucidchart.open.nark.models.records.Host
import com.lucidchart.open.nark... |
Explain and rewrite the following Scala code: | /*
* Copyright 2014 Joshua R. Rodgers
*
* 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: | /*
* Copyright (c) 2014-2021 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: | package com.rxbytes.splitpal.receivers
import android.content.{Intent, Context, BroadcastReceiver}
/**
* Created by pnagarjuna on 15/12/15.
*/
class BootReceiver extends BroadcastReceiver {
override def onReceive(context: Context, intent: Intent): Unit = {
if (intent.getAction == Intent.ACTION_BOOT_COMPLETE... |
Explain and rewrite the following Scala code: | /*
* This file is part of EasyForger which is released under GPLv3 License.
* See file LICENSE.txt or go to http://www.gnu.org/licenses/gpl-3.0.en.html for full license details.
*/
package com.easyforger.items
import net.minecraft.item.Item.ToolMaterial
import net.minecraft.item.ItemPickaxe
class EFItemPickaxe(val... |
Explain and rewrite the following Scala code: | package com.azavea.keras.raster
import geotrellis.raster._
object NDWI extends (MultibandTile => Tile) {
def apply(tile: MultibandTile): Tile =
tile.convert(DoubleCellType).combineDouble(1, 3) { (g, nir) =>
(g - nir) / (g + nir)
}
}
|
Explain and rewrite the following Scala code: | package wandou.astore
import akka.actor.ActorSystem
import akka.http.Http
import akka.http.model.headers.RawHeader
import akka.http.server.Directives
import akka.stream.ActorFlowMaterializer
import akka.util.Timeout
import scala.concurrent.duration._
import wandou.astore.http.RestRouteAkka
/**
* AStore REST service
... |
Explain and rewrite the following Scala code: | main()
def main() {
var nombres = new Array[String](50)
var precios = new Array[Float](50)
var codigos = new Array[String](50)
catalogo(nombres, precios, codigos)
}
def catalogo(
nombres: Array[String],
precios: Array[Float],
codigos: Array[String]
) {
var opcion = 3
var cantidadProductos = 0
var... |
Explain and rewrite the following Scala code: | package slinkydemo.view
import xml.Elem
final case class ConferenceContent(title: String, content: Elem) extends HtmlContent {
override def head = <title>Scalaz Conference: {title}</title>
override def body =
<div id="content">
<h1>Scalaz Conference: {title}</h1>
{content}
</div>
}
|
Explain and rewrite the following Scala code: | package filodb.prometheus.ast
import filodb.query.{Aggregate, AggregationOperator, PeriodicSeriesPlan}
sealed trait AggregateGrouping {
def labels: Seq[String]
}
case class Without(labels: Seq[String]) extends AggregateGrouping
case class By(labels: Seq[String]) extends AggregateGrouping
case class AggregateExp... |
Explain and rewrite the following Scala code: | package pl.writeonly.son2.funs.streamers
import java.io.FileNotFoundException
import java.net.URI
import org.scalatest.Outcome
import pl.writeonly.son2.apis.converters.ConverterFake
import pl.writeonly.scalaops.specs.fixture.GrayScalarSpec
import pl.writeonly.scalaops.pipe.Pipe
class StreamerPipeForeachScalarSpec ex... |
Explain and rewrite the following Scala code: | package gapt.cutintro
import gapt.expr._
import gapt.expr.formula.Formula
/**
* Computes the unified literals, i.e. the set of literals that are used to contruct the cut formula
*/
object gStarUnify {
/**
* Computes the unified literals, i.e. the set of literals that are used to contruct the cut formula
* @... |
Explain and rewrite the following Scala code: | package blended.util.logging
import org.slf4j.{ Logger => Slf4jLogger }
class LoggerSlf4j(underlying: Slf4jLogger) extends Logger {
override def name: String = underlying.getName()
override def isErrorEnabled: Boolean = underlying.isErrorEnabled()
override def isWarnEnabled: Boolean = underlying.isWarnEnabled... |
Explain and rewrite the following Scala code: | /*package beam.agentsim.agents.vehicles
import beam.agentsim.agents.vehicles.BeamVehicle.FuelConsumptionData
import com.univocity.parsers.csv.CsvParser
import java.io.ByteArrayInputStream
import beam.agentsim.agents.vehicles.ConsumptionRateFilterStore.Primary
import org.scalatest.mockito.MockitoSugar
import org.scala... |
Explain and rewrite the following Scala code: | package com.lucidchart.relate
import java.net.URL
import java.nio.ByteBuffer
import java.sql._
import java.time.{LocalDate, LocalTime}
import java.util.UUID
trait Parameterizable[-A] {
final def contraMap[B](f: B => A) = Parameterizable((statement, i, value: B) => set(statement, i, f(value)), setNull)
def set(sta... |
Explain and rewrite the following Scala code: | package infrastructure.user
import domain.ApplicationException
import domain.user.{ User, UserAuthority, UserId, UserRepository }
import model.{ LoginUserAppendix, LoginUserInfo, LoginUserPassword }
import scalikejdbc.DBSession
import skinny.logging.Logger
import util.{ CurrentDateUtil, PasswordDigestUtil }
import sc... |
Explain and rewrite the following Scala code: | package backup
import algebras.{ReceiptStoreAlg, RemoteFileAlg}
import java.nio.charset.StandardCharsets
import cats.Monad
import cats.effect.{ConcurrentEffect, ContextShift}
import io.circe.syntax._
import cats.implicits._
import fs2.Stream
import receipt.{FileEntity, ReceiptEntity, RemoteFileId}
import user.UserId
... |
Explain and rewrite the following Scala code: | package org.http4s
package headers
import org.http4s.parser.HttpHeaderParser
import org.http4s.util.Writer
object Referer extends HeaderKey.Internal[Referer] {
override def parse(s: String): ParseResult[Referer] =
HttpHeaderParser.REFERER(s)
}
final case class Referer(uri: Uri) extends Header.Parsed {
overri... |
Explain and rewrite the following Scala code: | package glint.models.client.buffered
import akka.util.Timeout
import breeze.linalg.Vector
import glint.models.client.BigMatrix
import scala.concurrent.{ExecutionContext, Future}
import scala.reflect.ClassTag
/**
* A [[glint.models.client.BigMatrix BigMatrix]] that buffers numerous pushes before sending them in one... |
Explain and rewrite the following Scala code: | /**
* scala-xml-diff
* Copyright (c) 2014, Andrey Onistchuk, All rights reserved.
*
* This library 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.0 of the License, or (... |
Explain and rewrite the following Scala code: | package io.github.mandar2812.dynaml.graphics.plot3d
import org.jzy3d.analysis.AbstractAnalysis
import org.jzy3d.chart.factories.AWTChartComponentFactory
import org.jzy3d.maths.Coord3d
import org.jzy3d.maths.algorithms.interpolation.algorithms.BernsteinInterpolator
import org.jzy3d.plot3d.primitives.{LineStripInterpola... |
Explain and rewrite the following Scala code: | package chapter.ten
object ExerciseFive extends App {
}
|
Explain and rewrite the following Scala code: | /*
* Part of NDLA learningpath-api.
* Copyright (C) 2016 NDLA
*
* See LICENSE
*
*/
package no.ndla.learningpathapi.controller
import org.scalatra.{Ok, ScalatraServlet}
trait HealthController {
val healthController: HealthController
class HealthController extends ScalatraServlet {
get("/") {
Ok(... |
Explain and rewrite the following Scala code: | package org.jetbrains.plugins.scala
package findUsages
import com.intellij.openapi.application.QueryExecutorBase
import com.intellij.openapi.util.text.StringUtil
import com.intellij.psi._
import com.intellij.psi.search._
import com.intellij.psi.search.searches.ReferencesSearch
import com.intellij.util.Processor
import... |
Explain and rewrite the following Scala code: | /*
This file is part of Intake24.
Copyright 2015, 2016 Newcastle University.
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 appl... |
Explain and rewrite the following Scala code: | /*
* BiformFanInShape.scala
* (FScape)
*
* Copyright (c) 2001-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.fscape.str... |
Explain and rewrite the following Scala code: | // #43896
trait M extends DelayedInit {
def delayedInit(body : => Unit) {
println("hallo")
body
println("bye")
}
}
class C(init : Int) extends M {
def foo = init
println("constructor")
var x = init
println("out:"+x)
}
// #4380
object Main {
def main(argv: Array[String... |
Explain and rewrite the following Scala code: | package models.actor
import models.binding._
import models.provider._
import akka.actor._
import akka.pattern.ask
import scala.xml._
import scala.concurrent._
import scala.concurrent.duration._
import scalaxb.DataRecord
import java.util.{
Calendar,
Date,
GregorianCalendar}
import java.text.{
DateFormat, Simple... |
Explain and rewrite the following Scala code: | import sbt._
object Version {
final val Scala = "2.11.8"
final val ScalaTest = "3.0.0"
final val Spark = "2.0.2"
}
object Library {
val scalaTest = "org.scalatest" %% "scalatest" % Version.ScalaTest
val spark = "org.apache.spark" %% "spark-core" % Version.Spark
val sparkSql = "org.apache.spark" %% ... |
Explain and rewrite the following Scala code: | /* Code Pulse: a real-time code coverage tool, for more information, see <http://code-pulse.com/>
*
* Copyright (C) 2014-2017 Code Dx, Inc. <https://codedx.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 ... |
Explain and rewrite the following Scala code: | /*
* Copyright 2001-2011 Stephen Colebourne
*
* 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: | package ru.biocad.ig.regions
import ru.biocad.ig.regions.annotators.{RegionAnnotatorUtils, RegionAnnotator}
import ru.biocad.ig.common.io.fasta.FastaReader
import java.io.{FileWriter, BufferedWriter, File}
import ru.biocad.ig.common.io.CachedMkdir
import ru.biocad.ig.alicont.algorithms.AlgorithmType._
import ru.biocad... |
Explain and rewrite the following Scala code: | package rsce.valueobject
import java.nio.{ ByteBuffer, Buffer }
import scala.language.implicitConversions
class Packet(val opcode: Int, val length: Int, val payload: Payload)
class Payload(buf: ByteBuffer) {
implicit def toPayload(buf: Buffer): Payload = this
def readByte = buf.get
def readBytes(a: Array[Byt... |
Explain and rewrite the following Scala code: |
package com.signalcollect.dcop.evaluation.dsa
object DSATest extends App {
} |
Explain and rewrite the following Scala code: | package com.eevolution.context.dictionary.domain.api.service
import com.eevolution.context.dictionary.api
import com.eevolution.context.dictionary.domain.model.ElementTrl
/**
* Copyright (C) 2003-2017, e-Evolution Consultants S.A. , http://www.e-evolution.com
* This program is free software: you can redistribute ... |
Explain and rewrite the following Scala code: | /*
* Licensed to the Programming Language and Software Methodology Lab (PLSM)
* under one or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information regarding copyright
* ownership.
* The PLSM licenses this file to You under the Apache License, Version 2.0
... |
Explain and rewrite the following Scala code: | package org.mozartoz.bootcompiler
package ast
import symtab._
trait RawDeclarationOrVar extends Node
trait RawDeclaration extends RawDeclarationOrVar
trait InfixSyntax extends Node {
protected val left: Node
protected val right: Node
protected val opSyntax: String
def syntax(indent: String) = {
val unti... |
Explain and rewrite the following Scala code: | package com.tresata.spark.kafka
import java.util.Properties
import kafka.utils.VerifiableProperties
object SimpleConsumerConfig {
def apply(originalProps: Properties): SimpleConsumerConfig = new SimpleConsumerConfig(new VerifiableProperties(originalProps))
val SocketTimeout = 30 * 1000
val SocketBufferSize = 6... |
Explain and rewrite the following Scala code: | package sjc.delta.circe
import io.circe.{Printer ⇒ PrettyParams, Encoder ⇒ EncodeJson, Json, JsonObject}
import io.circe.Json.{fromString ⇒ jString}
import sjc.delta.Delta.Aux
import sjc.delta.std.list.patience.{Removed, Equal, Inserted, Replaced}
import sjc.delta.{Patch, Delta}
import scala.reflect.ClassTag
object... |
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: | /*
* EditExprMap.scala
* (LucreSwing)
*
* Copyright (c) 2014-2021 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.lucre.swing.ed... |
Explain and rewrite the following Scala code: | package im.actor.server.mtproto.codecs
import scodec._
import scodec.bits._
object StringCodec extends Codec[String] {
def sizeBound = SizeBound.unknown
def encode(str: String) = {
val strBytes = str.getBytes
for { length ← varint.encode(strBytes.length.toLong) }
yield length ++ BitVector(strBytes)... |
Explain and rewrite the following Scala code: | package exercises.ch02
object Ex01 {
def fib(n: Int): Int = {
@annotation.tailrec
def fibHelper(prev: Int, curr: Int, remaining: Int): Int = {
if(remaining == 0) curr
else fibHelper(curr, curr + prev, remaining - 1)
}
if(n <= 1) 0
else if(n == 2) 1
else fibHelper(0, 1, n - 2)
... |
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 spatial.lang.static
import argon.core._
import forge._
import spatial.lang.BitOps._
trait BitOpsApi { this: SpatialApi =>
// TODO: Proper way to define conversion ops on vars?
implicit class VarDataConversionOps[A:Type:Bits](x: Var[A]) {
@api def reverse: A = readVar(x).reverse
}
implicit class ... |
Explain and rewrite the following Scala code: | package aecor.data
final case class ConsumerId(value: String) extends AnyVal
final case class TagConsumer(tag: EventTag, consumerId: ConsumerId)
|
Explain and rewrite the following Scala code: |
import _root_._ // _root_.java._ is OK
object Test extends App {
println(java.util.Locale.getDefault().toString) // static call
}
|
Explain and rewrite the following Scala code: | /*
* Copyright © 2014 TU Berlin (emma@dima.tu-berlin.de)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by app... |
Explain and rewrite the following Scala code: | /*
* Copyright 2013 - 2020 Outworkers 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... |
Explain and rewrite the following Scala code: | /**
* Licensed to Big Data Genomics (BDG) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The BDG licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use ... |
Explain and rewrite the following Scala code: | // bug 1183 from in the old tracker, not in Trac
object Test {
class Foo(j:Int) {
object Baz
class Bam
object Bar
case class Bar(i:Int)
}
class Test717 {
val foo1 = new Foo(1)
def runTest() = {
val res = (foo1.Bar(2):Any @unchecked) match {
case foo1.Bar(2) => true // ... |
Explain and rewrite the following Scala code: | /*
* This file is part of the Linux Variability Modeling Tools (LVAT).
*
* Copyright (C) 2011 Steven She <shshe@gsd.uwaterloo.ca>
*
* LVAT 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 v... |
Explain and rewrite the following Scala code: | package common
object CommonMessages {
case object Received
case object GetState
case object KillYourself
case class ProcessLine(line: String)
val fileProcessingTopic = "fileProcessing"
}
|
Explain and rewrite the following Scala code: | package chess
import chess.Pos._
class CastleTest extends ChessTest {
"king side" should {
val goodHist = """
PPPPPPPP
R QK R"""
val badHist = goodHist updateHistory (_ withoutCastles White)
"impossible" in {
"standard chess" in {
"near bishop in the way" in {
goodHist place(... |
Explain and rewrite the following Scala code: | package sp.optimization
import akka.actor._
import sp.domain.logic.IDAbleLogic
import scala.concurrent._
import sp.system.messages._
import sp.system._
import sp.domain._
import sp.domain.Logic._
object OptimizationService extends SPService {
// The KeyDefinitions are used by a UI to know what type the service ... |
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 _root_.servlet.{BasicAuthenticationFilter, TransactionFilter}
import app._
//import jp.sf.amateras.scalatra.forms.ValidationJavaScriptProvider
import org.scalatra._
import javax.servlet._
import java.util.EnumSet
class ScalatraBootstrap extends LifeCycle {
override def init(context: ServletContext) {
// R... |
Explain and rewrite the following Scala code: | package com.conekta
import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner
import org.scalatest.FunSuite
import org.scalatest.matchers.ShouldMatchers
import java.util.UUID
import com.typesafe.scalalogging.slf4j
import com.typesafe.scalalogging.slf4j.Logger
import org.slf4j.LoggerFactory
@RunWith(class... |
Explain and rewrite the following Scala code: | /*
* Scala (https://www.scala-lang.org)
*
* Copyright EPFL and Lightbend, Inc.
*
* Licensed under Apache License 2.0
* (http://www.apache.org/licenses/LICENSE-2.0).
*
* See the NOTICE file distributed with this work for
* additional information regarding copyright ownership.
*/
package scala.tools.nsc
packag... |
Explain and rewrite the following Scala code: | package actorthread.v1
import akka.actor.ActorLogging
import akka.actor.Actor
import akka.actor.ActorRef
object Forwarder {
case class Ping(id: Int, origin: ActorRef)
}
class Forwarder(returner: ActorRef) extends Actor with ActorLogging {
import Forwarder._
def receive: Receive = {
case p: Ping =>
... |
Explain and rewrite the following Scala code: | package com.amichalo.smooolelo
import akka.actor.ActorSystem
import akka.stream.ActorMaterializer
import com.amichalo.smooolelo.actors.{HeartbeatActor, RegistrationActor}
import com.amichalo.smooolelo.config.{MoooleloClientConfig, MoooleloServiceConfig}
import com.amichalo.smooolelo.gateway.MoooleloServerGateway
impor... |
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 io.buoyant.namerd.iface
import com.twitter.conversions.time._
import com.twitter.finagle._
import com.twitter.finagle.naming.NameInterpreter
import com.twitter.finagle.stats.NullStatsReceiver
import com.twitter.util._
import io.buoyant.namer.{ConfiguredDtabNamer, DelegateTree, Metadata, RichActivity}
import io... |
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: | ///////////////////////////////////////////////////////////////////////////////
// math.scala
//
// Copyright (C) 2011-2014 Ben Wing, The University of Texas at Austin
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You ma... |
Explain and rewrite the following Scala code: | package org.hammerlab.guacamole.jointcaller.kryo
import com.esotericsoftware.kryo.Kryo
import org.apache.spark.serializer.KryoRegistrator
import org.hammerlab.guacamole.jointcaller.Parameters.SomaticGenotypePolicy
import org.hammerlab.guacamole.jointcaller.annotation.{InsufficientNormal, MultiSampleAnnotations, Single... |
Explain and rewrite the following Scala code: | package geometry.structures
import org.salgo.geometry.structures.Vector2D
import org.scalatest.{FunSuite, Matchers}
class Vector2DSpec extends FunSuite with Matchers {
test("Angle of 0 degrees") { Vector2D.getAngleInDegrees(Vector2D(0,1), Vector2D(0,1)) shouldEqual 0.0}
test("Angle of 90 degrees") { Vector2D.getA... |
Explain and rewrite the following Scala code: | package mesosphere.marathon
package storage
import akka.actor.{ActorSystem, Scheduler}
import akka.stream.Materializer
import mesosphere.marathon.core.storage.backup.PersistentStoreBackup
import mesosphere.marathon.core.storage.store.PersistenceStore
import mesosphere.marathon.core.storage.store.impl.cache.LoadTimeCac... |
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 scalan
/** Scala specific trick to appease erasure of methods argument types.
* Example usage:
* def m1(l: List[Int])(implicit o: Overloaded1)
* def m2(l: List[String])(implicit o: Overloaded2)
* Without the implicit arguments the methods would have identical signatures
* after erasure, which is a co... |
Explain and rewrite the following Scala code: | package nfn.service
// ActorRef is the reference to an Akka Actor where you can send messages to
// It is used to have access to the client-library style interface to CCN where you can send interests to and
// receive content from (as well as access to the management interface and more)
// This service will no make us... |
Explain and rewrite the following Scala code: | package scalacss
sealed abstract class LengthUnit(val value: String)
object LengthUnit {
case object cm extends LengthUnit("cm")
case object ch extends LengthUnit("ch")
case object em extends LengthUnit("em")
case object ex extends LengthUnit("ex")
case object in extends LengthUnit("in")
case obj... |
Explain and rewrite the following Scala code: | /***********************************************************************
* Copyright (c) 2013-2018 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: | /*
* Copyright 2017-2020 47 Degrees, LLC. <http://www.47deg.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: | /*
* 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: | /*
* Copyright 2017 HM Revenue & Customs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or a... |
Explain and rewrite the following Scala code: | /*
* Copyright 2014–2018 SlamData 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 org.fayalite.repl
import java.io.{BufferedReader, InputStreamReader, PipedInputStream, PipedOutputStream}
import scala.tools.nsc.interpreter.JPrintWriter
/**
* In theory this is for a really low level wrapper around the REPL
* IOStream for elegant patching of the spark REPL.
* In practice I'm not even sur... |
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.enginyoyen.statsd.metrics
import akka.actor.Props
import akka.testkit.TestActorRef
import com.enginyoyen.statsd.metrics.utils.BaseSpec
import scala.concurrent.duration._
import com.enginyoyen.statsd.model.Statistic
import com.enginyoyen.statsd.Flush
/**
* Created by Engin Yoeyen on 03/09/14.
*/
class Gau... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.