instruction
stringclasses
1 value
output
stringlengths
5
1M
Explain and rewrite the following Scala code:
package playground import ch.weisenburger.uima.FinancialDataPipelineFactory import models.TextRevision import org.specs2.mutable.Specification import play.api.test.WithApplication import scala.concurrent.Await import scala.concurrent.duration._ class TextExtractionTest extends Specification { "Extract" should { ...
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 n...
Explain and rewrite the following Scala code:
package controllers import play.api.data._, Forms._ import play.api.libs.json._ import play.api.mvc._, Results._ import play.api.Play.current import play.api.i18n.Messages.Implicits._ import lila.api.Context import lila.app._ import lila.common.LilaCookie import lila.user.{ UserRepo, User => UserModel } import views....
Explain and rewrite the following Scala code:
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you ...
Explain and rewrite the following Scala code:
package org.moe.ast import org.moe.runtime._ abstract class AST // AST containers case class CompilationUnitNode(body: ScopeNode) extends AST case class ScopeNode(body: StatementsNode) extends AST case class StatementsNode(nodes: List[AST]) extends AST // literals /** * A literal Int node * * @param value The...
Explain and rewrite the following Scala code:
/*********************************************************************** * Copyright (c) 2013-2017 Commonwealth Computer Research, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Apache License, Version 2.0 * which accompanies this distribution and...
Explain and rewrite the following Scala code:
/* * Copyright (C) 2016 Vincibean <Andre Bessi> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This...
Explain and rewrite the following Scala code:
package skuber import akka.Done import akka.stream.scaladsl.{Sink, Source} import org.scalatest.{BeforeAndAfterAll, Matchers} import org.scalatest.concurrent.Eventually import skuber.json.format._ import scala.concurrent.duration._ import scala.concurrent.duration.Duration import scala.concurrent.{Await, Future, Prom...
Explain and rewrite the following Scala code:
/* ************************************************************************************* * Copyright 2016 Normation SAS ************************************************************************************* * * This file is part of Rudder. * * Rudder is free software: you can redistribute it and/or modify * it under the...
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.sksamuel.elastic4s.http.search.aggs import com.sksamuel.elastic4s.searches.aggs._ import com.sksamuel.elastic4s.searches.aggs.pipeline.{CumulativeSumDefinition, MaxBucketDefinition} import org.elasticsearch.common.xcontent.{XContentBuilder, XContentFactory, XContentType} object AggregationBuilderFn { de...
Explain and rewrite the following Scala code:
package gitbucket.core.controller import gitbucket.core.model.Account import gitbucket.core.service.{AccountService, RepositoryService} import gitbucket.core.servlet.Database import gitbucket.core.util._ import gitbucket.core.util.ControlUtil._ import gitbucket.core.util.Directory._ import gitbucket.core.util.Implicit...
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.beaucatcher.mongo import org.beaucatcher.bson._ import org.beaucatcher.driver._ import akka.dispatch.Future /** * Trait expressing all read operations on a collection in asynchronous form, * with wire encoding and decoding delegated to implicit typeclass parameters. * For write operations, see [[org.be...
Explain and rewrite the following Scala code:
package dotty.tools.dotc package transform import core._ import DenotTransformers.InfoTransformer import Symbols._ import Contexts._ import Types._ import core.StdNames.nme import ast.Trees._ /** This phase eliminates ExprTypes `=> T` as types of method parameter references, and replaces them b * nullary function t...
Explain and rewrite the following Scala code:
import scala.quoted.* object Test { def impl(receiver: Expr[StringContext])(using qctx: scala.quoted.Quotes) = { import quotes.reflect.Repeated receiver match { case '{ StringContext(${Repeated(parts, tpt)}*) } => // now OK } } }
Explain and rewrite the following Scala code:
class t1785 { def apply[T](x: Int) = 1 } object test { (new t1785)[Int](1) }
Explain and rewrite the following Scala code:
package se.lu.nateko.cp.meta.instanceserver import org.eclipse.rdf4j.model.IRI import org.eclipse.rdf4j.model.vocabulary.RDF import org.eclipse.rdf4j.model.vocabulary.OWL object InstanceServerUtils { /** * returns Some type IRI if any, None if none, and throws an AssertionError if the instance has more than one t...
Explain and rewrite the following Scala code:
package uk.gov.gds.ier.step import uk.gov.gds.ier.serialiser.WithSerialiser import uk.gov.gds.ier.guice.{WithRemoteAssets, WithEncryption, WithConfig} import uk.gov.gds.ier.controller.routes._ import uk.gov.gds.ier.transaction.ordinary.InprogressOrdinary import uk.gov.gds.ier.transaction.ordinary.confirmation.routes ...
Explain and rewrite the following Scala code:
//package io.soheila.um.vos.accounts // //import java.util.Locale // //import com.mohiva.play.silhouette.api.LoginInfo //import io.soheila.um.entities.User //import io.soheila.um.types.UserRole //import play.api.libs.json.Json // //case class UserCreationVO( // uuid: String, // loginInfo: LoginInfo, // firstNa...
Explain and rewrite the following Scala code:
package com.sksamuel.elastic4s.api import com.sksamuel.elastic4s.requests.searches.{HighlightField, HighlightOptions} trait HighlightApi { def highlightOptions(): HighlightOptions = HighlightOptions() def highlight(field: String): HighlightField = HighlightField(field) }
Explain and rewrite the following Scala code:
package com.twitter.finagle.http2.exp.transport import com.twitter.finagle.Status import com.twitter.finagle.transport.{Transport, TransportProxy} import com.twitter.util.Future import io.netty.handler.codec.http.LastHttpContent /** * `Transport` proxy whos status is closed after reading the `LastHttpContent`. * *...
Explain and rewrite the following Scala code:
// Copyright (c) 2018. Distributed under the MIT License (see included LICENSE file). package cocoa.appkit import scala.language.experimental.macros import scalanative.native._ import objc._ import cocoa.foundation._ @ObjC trait NSImageDelegate extends NSObject { @inline def imageDidNotDraw_rect_(sender: NSImage, ...
Explain and rewrite the following Scala code:
package poly.collection import poly.collection.specgroup._ import poly.collection.exception._ import poly.collection.immut._ import poly.macroutil._ import scala.annotation.unchecked.{uncheckedVariance => uv} import scala.annotation.{unspecialized => unsp} /** * Represents iterators that support an iteration over a...
Explain and rewrite the following Scala code:
package test import org.specs2.mutable.Specification import org.specs2.specification.AllExpectations import com.kolor.docker.api._ import org.specs2.specification.Scope import org.specs2.specification.Before import scala.concurrent.duration.DurationConversions._ import scala.concurrent.duration._ import scala.concurr...
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.teambytes.inflatable.raft.cluster import com.teambytes.inflatable.raft.ClusterRaftSpec import akka.actor.Kill class ClusterRaftActorTest extends ClusterRaftSpec { def initialMembers: Int = 1 behavior of "ClusterRaftActor" it should "stop when the watched raftActor dies" in { // given val ...
Explain and rewrite the following Scala code:
package com.larry.da.parse /** * Created by larry on 28/4/2016. */ object Aguid { }
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.maxpsq.googlemaps.geocoding import org.specs2.runner._ import org.specs2.mutable._ import Parameters._ class ParametersSpec extends Specification { def parStr(lat: Double,lng: Double) = s"latlng=${lat},${lng}" "Parameter LatLngParam " should { " BE valid on CORRECT values" in ...
Explain and rewrite the following Scala code:
package org.jetbrains.sbt.shell import com.intellij.execution.configurations.RemoteConnection import com.intellij.execution.console.LanguageConsoleImpl import com.intellij.execution.filters.UrlFilter.UrlFilterProvider import com.intellij.execution.filters._ import com.intellij.execution.impl.ConsoleViewImpl.ClearAllAc...
Explain and rewrite the following Scala code:
package com.cloudera.sa.apptrans.server.kudu import org.kududb.client.KuduClient object KuduGlobalValues { var appEventTableName = "app_event_kudu" var accountMartTableName = "account_mart_kudu" var kuduClient:KuduClient = null def init(kuduMaster:String, appEventTableName:String, acc...
Explain and rewrite the following Scala code:
package effekt package effects trait Reader[S] { def ask(): Control[S] } trait Writer[S] { def tell(s: S): Control[Unit] } /** * A simple state effect using builtin state. */ trait State[S] extends Reader[S] with Writer[S] { def put(s: S): Control[Unit] def get(): Control[S] def ask() = get() def tell...
Explain and rewrite the following Scala code:
package spire.benchmark import scala.{specialized => spec} import scala.util.Random import Random._ import spire.math.algebraic._ import spire.implicits._ import com.google.caliper.Runner import com.google.caliper.SimpleBenchmark import com.google.caliper.Param object MaybeAddBenchmarks extends MyRunner(classOf[Ma...
Explain and rewrite the following Scala code:
package io.dylemma.spac package impl class ParserFirstOpt[In] extends Parser.Stateless[In, Option[In]] { def step(in: In) = Left(Some(in)) def finish() = None }
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 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:
/* * 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.arcusys.learn.liferay.update.version300 import java.sql.Connection import com.arcusys.learn.liferay.update.version300.migrations.scorm.ActivityStateMigration import com.arcusys.valamis.persistence.common.SlickProfile import com.arcusys.valamis.persistence.impl.scorm.model.{ActivityStateNodeModel, Activity...
Explain and rewrite the following Scala code:
/* * Copyright (C) 2015 Stratio (http://stratio.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 app...
Explain and rewrite the following Scala code:
package slick.util import java.util.concurrent.{ArrayBlockingQueue, TimeUnit, BlockingQueue} import java.util.concurrent.locks._ import java.util._ /** A simplified copy of `java.util.concurrent.ArrayBlockingQueue` with additional logic for * temporarily rejecting elements based on the current size. All features of...
Explain and rewrite the following Scala code:
package repository import scala.concurrent.Future import scala.concurrent.ExecutionContext.Implicits.global class TxManager extends PooledDatabase { def executeInTx[T](f: => T): Future[T] = Future { database withDynTransaction f } }
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 mesosphere.marathon package core.matcher.base.util import akka.actor.ActorRef import akka.testkit.TestActor.AutoPilot import akka.testkit.{ TestActor, TestProbe } import mesosphere.AkkaUnitTest import mesosphere.marathon.core.matcher.base.OfferMatcher.MatchedInstanceOps import mesosphere.marathon.state.Timesta...
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 2011-2018 GatlingCorp (http://gatling.io) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applic...
Explain and rewrite the following Scala code:
package io.skysail.server.demo import io.skysail.api.persistence.DbService import io.skysail.server.demo.domain.Bookmark class DummyDbService extends DbService() { private var bookmarks = scala.collection.mutable.Map[String, Bookmark]() override def createWithSuperClass(superClass: String, vertices: String*): U...
Explain and rewrite the following Scala code:
/* * Copyright 2001-2019 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.wheaties.predicate import com.wheaties.logical._ trait Predicate2[T1, T2] extends Function2[T1, T2, Boolean]{ self => def or[TT1 <: T1, TT2 <: T2](that: Function2[TT1, TT2, Boolean]) = new Predicate2[TT1, TT2]{ def apply(arg1: TT1, arg2: TT2) = self(arg1, arg2) || that(arg1, arg2) } def and[TT1 <: ...
Explain and rewrite the following Scala code:
package net.kemuridama.kafcon.protocol import spray.json._ import net.kemuridama.kafcon.model.APIErrorDetail trait APIErrorDetailJsonProtocol extends JsonProtocol { implicit def apiErrorDetailFormat = jsonFormat7(APIErrorDetail) }
Explain and rewrite the following Scala code:
package coke import Syntax._ object Pretty { def prettyKind(kind: Kind): String = kind match { case KStar => "*" case KRow => "e" } def getTypeVarSimplification(typ: Type): Map[TyVar, String] = { def map2[A, B, C](a: Stream[A], b: Stream[B])(f: (A, B) => C): Stream[C] = a.flatMap { x => b.map...
Explain and rewrite the following Scala code:
package com.xantoria.flippy.serialization import net.liftweb.json._ import org.scalatest._ import com.xantoria.flippy.BaseSpec import com.xantoria.flippy.condition.{Condition, NumberConditions} class NumberSerializerSpec extends BaseSpec { val contextSerializer = new ContextValueSerializer() val engine = Seriali...
Explain and rewrite the following Scala code:
/* * Copyright 2015 Foundational Development * * 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:
package fe.CCC class OList[A] { def size() = OList.size(this) def get(i: Int) = OList.get(this, i) } object OList { val V = FormulaList type VImpl[A] = V.VImpl[A] case class ONil[A]() extends OList[A] case class OCons[A](v: VImpl[Option[A]], next: OList[A]) extends OList[A] def size[A](l: OList[A...
Explain and rewrite the following Scala code:
package chandu0101.scalajs.react.components.demo.components import chandu0101.scalajs.react.components.demo.routes.LeftRoute import japgolly.scalajs.react._ import japgolly.scalajs.react.extra.router2.RouterCtl import japgolly.scalajs.react.vdom.prefix_<^._ import scala.scalajs.js import scalacss.Defaults._ import sc...
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:
/* * 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 Robert Conrad - All Rights Reserved. * Unauthorized copying of this file, via any medium is strictly prohibited. * This file is proprietary and confidential. * Last modified by rconrad, 12/24/14 6:33 PM */ package base.rest.route import base.common.lib.Dispatchable import base.common.logg...
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 org.caseinsensitive.folksent.twitter import _root_.twitter4j._ import scala.collection.JavaConversions._ import scala.annotation.tailrec import java.text.SimpleDateFormat object TwitterUtils { implicit class TwitterStreamQuery(stream: TwitterStream) { def getTopics(topics: String*): Unit = { val ...
Explain and rewrite the following Scala code:
object Test { def main(args: Array[String]) = { val ary: Array[String] = Array("a", "b", "c") val lst: List[String] = List("a", "b", "c") val itr: Iterator[String] = lst.iterator val str: Stream[String] = lst.iterator.toStream Console.println(ary.zipWithIndex.toList) Console.println(lst.zipWi...
Explain and rewrite the following Scala code:
package com.datastax.spark.connector.util import java.util.UUID import com.datastax.spark.connector.util.CqlWhereParser._ import org.scalatest.{Inside, FlatSpec, Matchers} class CqlWhereParserTest extends FlatSpec with Matchers with Inside { var parser = CqlWhereParser "CqlWhereParser" should "parse 'and' ope...
Explain and rewrite the following Scala code:
/* Copyright 2009-2016 EPFL, Lausanne */ import leon.lang._ import leon.proof._ import leon.collection._ object FlatMap { def append[T](l1: List[T], l2: List[T]): List[T] = l1 match { case Cons(head, tail) => Cons(head, append(tail, l2)) case Nil() => l2 } def associative_append_lemma[T](l1: List[T], ...
Explain and rewrite the following Scala code:
/* * Copyright 2012 Eric Olander * * 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 bridge sealed trait Hook { val requestString: String } /** * @author Aleksey Fomkin <aleksey.fomkin@gmail.com> */ object Hook { case object Success extends Hook { val requestString = "@hook_success" } case object Failure extends Hook { val requestString = "@hook_failure" } }
Explain and rewrite the following Scala code:
/* * Copyright (C) 2015 Stratio (http://stratio.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 app...
Explain and rewrite the following Scala code:
package gitbucket.core.api import gitbucket.core.model.IssueComment import gitbucket.core.util.RepositoryName import java.util.Date /** * https://developer.github.com/v3/issues/comments/ */ case class ApiComment( id: Int, user: ApiUser, body: String, created_at: Date, updated_at: Date)(repositoryName: R...
Explain and rewrite the following Scala code:
package name.abhijitsarkar.user import akka.actor.ActorSystem import akka.stream.Materializer import scala.concurrent.ExecutionContextExecutor import com.typesafe.config.Config import akka.event.LoggingAdapter import scala.concurrent.duration.DurationInt import akka.util.Timeout import akka.stream.ActorMaterializer im...
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.interp...
Explain and rewrite the following Scala code:
trait T extends Any { var x = 1 { x += 1 } type T = Int val y: T }
Explain and rewrite the following Scala code:
package org.ucf.scala.extractor /** * @author */ object ScalaApp { def printHello() = println("Hello World from Scala") def main(args: Array[String]): Unit = { printHello() } }
Explain and rewrite the following Scala code:
package org.tribbloid.spikystuff.spike.spark import org.apache.spark.{HashPartitioner, SparkContext, SparkConf} /** * Created by peng on 12/20/14. */ object TestPartitioner { def main(args: Array[String]) { val conf = new SparkConf().setAppName("TestBroadcastUpdate") .setMaster("local[8,3]") val s...
Explain and rewrite the following Scala code:
package eventstore import akka.actor.Terminated import akka.testkit.TestProbe import scala.concurrent.duration._ class SubscriptionActorITest extends AbstractSubscriptionActorITest { "SubscriptionActor" should { "subscribe from the beginning" in new SubscriptionScope { expectEvent.event.number mustEqual E...
Explain and rewrite the following Scala code:
/** * This file is part of the Uniscala Couch project. * Copyright (C) 2012 Sustainable Software Pty Ltd. * This is open source software, licensed under the Apache License * version 2.0 license - please see the LICENSE file included in * the distribution. * * Authors: * Sam Stainsby (sam@sustainablesoftware.com...
Explain and rewrite the following Scala code:
package vu.edf import EDFConstants._ import java.io.{IOException, OutputStream} import java.nio.ByteBuffer import java.text.DecimalFormat import java.text.DecimalFormatSymbols import vu._ /** * @author v.uspenskiy * @since 29/07/14 15:30 * * @see https://github.com/MIOB/EDF4J */ object EDFWriter { implicit de...
Explain and rewrite the following Scala code:
package modules import com.google.inject.{AbstractModule, Provides} import com.mohiva.play.silhouette.api.repositories.AuthInfoRepository import com.mohiva.play.silhouette.api.services._ import com.mohiva.play.silhouette.api.util._ import com.mohiva.play.silhouette.api.{Environment, EventBus} import com.mohiva.play.si...
Explain and rewrite the following Scala code:
package ch.epfl.telegram import ch.epfl.telegram.commands._ import ch.epfl.telegram.utils.{AsyncUpdates, LogUpdates} import info.mukel.telegrambot4s.api._ import scala.io.Source import scala.util.Properties import scala.concurrent.duration._ object EpflBot extends App // Bot skeleton with TelegramBot ...
Explain and rewrite the following Scala code:
/** * Copyright 2011-2016 GatlingCorp (http://gatling.io) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by appli...
Explain and rewrite the following Scala code:
package com.avsystem.commons package testutil import com.avsystem.commons.macros.TestMacros import org.scalatest.Assertions trait CompilationErrorAssertions extends Assertions { def typeErrorFor(code: String): String = macro TestMacros.typeErrorImpl }
Explain and rewrite the following Scala code:
package org.scalafmt.util import scala.annotation.tailrec import scala.collection.mutable import scala.meta.Case import scala.meta.CaseTree import scala.meta.Ctor import scala.meta.Decl import scala.meta.Defn import scala.meta.Enumerator import scala.meta.Importer import scala.meta.Init import scala.meta.Lit import sc...
Explain and rewrite the following Scala code:
/* * Copyright (c) 2013-2014 Telefónica Investigación y Desarrollo S.A.U. * * 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 * * Unle...
Explain and rewrite the following Scala code:
/** * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed ...
Explain and rewrite the following Scala code:
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may ...
Explain and rewrite the following Scala code:
/* * Scala (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 package collecti...
Explain and rewrite the following Scala code:
package objsets import TweetReader._ /** * A class to represent tweets. */ class Tweet(val user: String, val text: String, val retweets: Int) { def >(that: Tweet): Boolean = this.retweets > that.retweets override def toString: String = "User: " + user + "\\n" + "Text: " + text + " [" + retweets + "]" ...
Explain and rewrite the following Scala code:
package fpinscala.errorhandling import scala.{Option => _, Some => _, Either => _, _} // hide std library `Option`, `Some` and `Either`, since we are writing our own in this chapter sealed trait Option[+A] { def map[B](f: A => B): Option[B] = this match { case Some(x) => Some(f(x)) case _ => None } de...
Explain and rewrite the following Scala code:
package org.jetbrains.plugins.scala.testingSupport.test.sbt import java.util.regex.{Matcher, Pattern} import com.intellij.execution.process.{ProcessHandler, ProcessOutputTypes} import com.intellij.execution.ui.ConsoleViewContentType import org.jetbrains.plugins.scala.testingSupport.TestRunnerUtil import org.jetbrains...
Explain and rewrite the following Scala code:
package edu.gemini.sp.vcs2 import edu.gemini.pot.sp.Conflict.ConstraintViolation import edu.gemini.pot.sp.SPNodeKey import edu.gemini.pot.spdb.DBLocalDatabase import edu.gemini.spModel.core.SPProgramID import org.specs2.matcher.MatchResult import scalaz._ import Scalaz._ class ValidityCorrectionSpec extends MergeCor...
Explain and rewrite the following Scala code:
/* Copyright 2009-2016 EPFL, Lausanne */ import leon.lang._ import leon.collection._ object Test { def b(b: List[BigInt]) = b match { case Cons(BigInt(42), Nil()) => true case _ => false } }
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 utils import javax.management.MBeanParameterInfo case class RichMBeanOperation(val name: String, val returnType: String, val signature: Seq[MBeanParameterInfo], val desc: String, val impact:...
Explain and rewrite the following Scala code:
import sbt._ import Keys._ import play.Project._ object ApplicationBuild extends Build { val appName = "Horatio" val appVersion = "1.0-SNAPSHOT" val appDependencies = Seq( // Add your project dependencies here, javaCore, javaJdbc, javaEbean, "org.apache.commons" % "commons-emai...
Explain and rewrite the following Scala code:
package models import java.util.UUID import play.api.data.Form import play.api.data.Forms._ import utils.Global._ import utils.semantic._ import scala.concurrent.Future case class LabworkApplication(applicant: Resource, labwork: Resource, partners: List[Resource], id: UUID = UUID.randomUUID()) case class LabworkAp...
Explain and rewrite the following Scala code:
/* * Copyright (C) 2013-2015 by Michael Hombre Brinkmann */ package net.twibs.webtest import javax.servlet.annotation.WebFilter import net.twibs.form.FormResponder import net.twibs.web._ @WebFilter(urlPatterns = Array("*.html")) class TestFilter extends Filter { override def createCombiningResponder() = new Fil...
Explain and rewrite the following Scala code:
package app.components.semanticui import japgolly.scalajs.react import japgolly.scalajs.react.Children import japgolly.scalajs.react.vdom.VdomNode import scala.scalajs.js object Table { val component = react.JsComponent[js.Object, Children.Varargs, Null](SemanticUiComponents.Table) def apply(celled: js.UndefOr[...
Explain and rewrite the following Scala code:
package scalautils.bio import better.files.File import scalautils.FastaUtils._ /** * Document me! * * @author Holger Brandl */ object BlastUtils { /** * Given a fasta file and a blast result file, estimate the completeness of the blast-results. * This is e.g. helpful when checking for failed chunk...
Explain and rewrite the following Scala code:
package com.nekopiano.scala.processing.sandbox.sample.glow import com.nekopiano.scala.processing.{ScalaPApp, ScalaPAppCompanion, ThreeDimensionalPApp} import peasy.PeasyCam import processing.core.PImage /** * Created on 29/07/2016. */ class Particle3D extends ThreeDimensionalPApp { // http://qiita.com/clomie/item...
Explain and rewrite the following Scala code:
/* Copyright 2017-18, Emmanouil Antonios Platanios. All Rights Reserved. * * 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 ...
Explain and rewrite the following Scala code:
package controllers import play.api.http.Status import play.api.test._ import play.api.test.Helpers._ import org.scalatestplus.play._ import org.scalatestplus.play.guice.GuiceOneAppPerSuite class ApplicationSpec extends PlaySpec with GuiceOneAppPerSuite { lazy val applicationController = app.injector.instanceOf[Ap...
Explain and rewrite the following Scala code:
/* * Copyright (c) 2015, Nightfall Group * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this list of conditions a...