instruction
stringclasses
1 value
output
stringlengths
5
1M
Explain and rewrite the following Scala code:
package org.reactivebird.api import org.reactivebird.{version, TwitterApi} import spray.json.{JsNumber, JsArray, JsonParser} import scala.concurrent.Future import org.reactivebird.models.{UserId, ResultSetWithCursor} trait FriendsAndFollowers { self: TwitterApi => def friendsIds( userId: Option[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 codecheck.github.events import org.json4s.JValue import codecheck.github.models.AbstractJson case class DefaultEvent(name: String, value: JValue) extends AbstractJson(value) with GitHubEvent
Explain and rewrite the following Scala code:
/* * Copyright 2013 Toshiyuki Takahashi * * 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 lis...
Explain and rewrite the following Scala code:
package slick.test.stream import org.testng.annotations.{AfterClass, BeforeClass} import scala.concurrent.ExecutionContext import slick.memory.MemoryDriver class HeapPublisherTest extends RelationalPublisherTest[MemoryDriver](MemoryDriver, 300L) { import driver.api._ def createDB = Database(ExecutionContext.glo...
Explain and rewrite the following Scala code:
package org.infinispan.spark.domain import org.infinispan.protostream.annotations.{ProtoField, ProtoMessage} import scala.annotation.meta.beanGetter import scala.beans.BeanProperty @ProtoMessage class User(@(ProtoField@beanGetter)(number = 1, required = true) @BeanProperty var name: String, @(ProtoField@b...
Explain and rewrite the following Scala code:
package controllers import javax.inject.Inject import akka.actor.ActorSystem import play.api.Play._ import play.api.libs.oauth._ import play.api.mvc._ import twitter.TwitterHelper._ case class OAuthKeys(consumerKey: ConsumerKey, requestToken: RequestToken) class Twitter @Inject()(system: ActorSystem) extends Contro...
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.denigma.kappa.notebook.views.settings import org.denigma.binding.views.BindableView import org.denigma.kappa.messages.KappaMessage import org.denigma.kappa.notebook.actions.Commands import org.scalajs.dom.raw.Element import rx._ import rx.Ctx.Owner.Unsafe.Unsafe import org.denigma.binding.extensions._ impo...
Explain and rewrite the following Scala code:
package org.scalaide.core package sbtbuilder import java.io.File import scala.tools.nsc.settings.SpecificScalaVersion import org.eclipse.core.resources.IMarker import org.eclipse.core.resources.IncrementalProjectBuilder import org.eclipse.core.runtime.NullProgressMonitor import org.eclipse.jdt.core.ICompilationUnit ...
Explain and rewrite the following Scala code:
/* * Copyright (c) <2015-2016>, see CONTRIBUTORS * 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...
Explain and rewrite the following Scala code:
package knot.core.dispatch import java.util.concurrent.RejectedExecutionException import java.util.concurrent.atomic.AtomicInteger import knot.core.emitters.Emitter import scala.concurrent.ExecutionContextExecutorService abstract class AbstractDispatcher(implicit val es: ExecutionContextExecutorService) extends Di...
Explain and rewrite the following Scala code:
package ch.uzh.ifi.pdeboer.pplib.process.entities import ch.uzh.ifi.pdeboer.pplib.util.LazyLogger import scala.reflect.ClassTag import scala.reflect.runtime.universe._ import scala.xml.NodeSeq /** * Created by pdeboer on 13/02/15. */ object ProcessStub { def createFromBlueprint[P <: ProcessStub[_, _]](clazz: C...
Explain and rewrite the following Scala code:
package war.central import scala.annotation.implicitNotFound import com.mohiva.play.silhouette.api.Environment import com.mohiva.play.silhouette.api.Silhouette import com.mohiva.play.silhouette.impl.authenticators.JWTAuthenticator import auth.models.User import common.typeAliases._ import javax.inject.Inject import pl...
Explain and rewrite the following Scala code:
package reactive4.persistence import akka.actor.typed.{ActorRef, ActorSystem, Behavior} import akka.actor.typed.scaladsl.Behaviors import akka.persistence.typed.PersistenceId import akka.persistence.typed.scaladsl.{Effect, EventSourcedBehavior} import scala.concurrent.Await import scala.concurrent.duration.Duration ...
Explain and rewrite the following Scala code:
package com.twitter.finagle.netty3.http import com.twitter.finagle.http.netty3.Bijections import com.twitter.finagle.http.{BadRequestResponse, Response} import org.jboss.netty.channel.{Channel, ChannelFutureListener, Channels, DownstreamMessageEvent} import org.jboss.netty.handler.codec.frame.TooLongFrameException /*...
Explain and rewrite the following Scala code:
/* __ *\\ ** ________ ___ / / ___ Scala API ** ** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** ** __\\ \\/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\\___/_/...
Explain and rewrite the following Scala code:
package com.dominikgruber.fpinscala.chapter12 import com.dominikgruber.fpinscala.chapter10.Monoid import com.dominikgruber.fpinscala.chapter11.Functor trait Applicative[F[_]] extends Functor[F] { // primitive combinators /* * See exercise 2 for the implementation * def map2[A, B, C](fa: F[A], fb: F[B])(f: (...
Explain and rewrite the following Scala code:
package blockplus.pieces import scala.collection.immutable.Map import com.google.common.base.Stopwatch import java.util.concurrent.TimeUnit object Pieces { val data = Map( 1 -> PieceGraph((0, 0)), 2 -> PieceGraph((0, 0), (0, 1)), 3 -> PieceGraph((0, 0), (0, 1), (0, 2))(0, 1), 4 -> PieceGraph((0, 0)...
Explain and rewrite the following Scala code:
package com.rikmuld.corerm.advancements import java.lang.reflect.Method import com.rikmuld.corerm.advancements.triggers.TriggerSimple import net.minecraft.advancements.{CriteriaTriggers, ICriterionInstance, ICriterionTrigger} import net.minecraft.util.ResourceLocation import net.minecraftforge.fml.relauncher.Reflecti...
Explain and rewrite the following Scala code:
package com.gabeos.wafflemusic.camera import com.typesafe.scalalogging.LazyLogging import org.opencv.highgui.VideoCapture import org.opencv.videoio.Videoio._ import org.opencv.core.CvType /** * Created by Gabriel Schubiner on 8/25/2014. */ case class ImageInfo(width: Int, height: Int, brightness: Double, contrast: ...
Explain and rewrite the following Scala code:
/** * Generated by apidoc - http://www.apidoc.me * Service version: 0.11.26 * apidoc:0.11.33 http://www.apidoc.me/bryzek/apidoc-generator/0.11.26/play_2_4_client */ package com.bryzek.apidoc.generator.v0.models { /** * An attribute represents a key/value pair that is optionally used to provide * additional...
Explain and rewrite the following Scala code:
/* * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ package swave.core.io.files import java.io.File import java.nio.file.{Path, StandardOpenOption} import scala....
Explain and rewrite the following Scala code:
package eu.timepit.refined.scalacheck import eu.timepit.refined.W import eu.timepit.refined.api.Refined import eu.timepit.refined.collection.{MaxSize, NonEmpty, Size} import eu.timepit.refined.numeric.Interval import eu.timepit.refined.scalacheck.collection._ import eu.timepit.refined.scalacheck.numeric._ import org.s...
Explain and rewrite the following Scala code:
package org.scalaide.refactoring.internal import org.scalaide.core.internal.jdt.model.ScalaSourceFile import scala.tools.refactoring.analysis.GlobalIndexes import scala.tools.refactoring.implementations /** * This refactoring redirects calls to the primary constructor to the * apply method of the companion object. ...
Explain and rewrite the following Scala code:
package org.bitcoins.gui import akka.actor.ActorSystem import org.bitcoins.cli.CliCommand.GetInfo import org.bitcoins.cli.ConsoleCli import org.bitcoins.commons.jsonmodels.BitcoinSServerInfo import org.bitcoins.core.config._ import org.bitcoins.gui.util.GUIUtil._ import scalafx.application.JFXApp3 import scalafx.geome...
Explain and rewrite the following Scala code:
package zzb.shell.task import zzb.shell.Task /** * Created with IntelliJ IDEA. * User: Simon Xiao * Date: 13-9-17 * Time: 上午9:32 * Copyright baoxian.com 2012~2020 */ class Tasks extends Task { val sortedSpaces = collection.SortedSet(Task.spacesIndex.keySet.toList: _*) sortedSpaces.foreach { space ⇒ p...
Explain and rewrite the following Scala code:
package com.nummulus.amqp.driver.configuration import org.scalatest.FlatSpec import org.scalatest.Matchers import com.typesafe.config.ConfigFactory class QueueConfigurerTest extends FlatSpec with Matchers { val configValue = """amqp { host = localhost defines { serviceName = service.test ...
Explain and rewrite the following Scala code:
package com.bot4s.telegram.models import com.bot4s.telegram.models.MessageEntityType.MessageEntityType /** * This object represents one special entity in a text message. * * For example, hashtags, usernames, URLs, etc. * * @param type String Type of the entity. * One of mention (@username), ha...
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 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:
class Parent[@specialized(Int) T] object Test extends App { /** * This method will check if specialization is correctly rewiring parents * for classes defined inside methods. The pattern is important since this * is how closures are currently represented: as locally-defined anonymous * classes, which us...
Explain and rewrite the following Scala code:
/* * ****************************************************************************** * * Copyright (C) 2013 Christopher Harris (Itszuvalex) * * Itszuvalex@gmail.com * * * * This program is free software; you can redistribute it and/or * * modify it under the terms of the GNU General Public License * * as p...
Explain and rewrite the following Scala code:
package org.littlewings.javaee7.jta import javax.transaction.Synchronization class MySynchronization extends Synchronization { private var calledBeforeCompletaion: Boolean = _ private var afterCompletionStatus: Int = -1 def getCalledBeforeCompletion: Boolean = calledBeforeCompletaion def getAfterCompletionSt...
Explain and rewrite the following Scala code:
package in.lambda_hc.furious_cyclist.rest.controllers.session import in.lambda_hc.furious_cyclist.models.User import spray.json.JsObject /** * Created by vishnu on 12/6/16.\\ * * Interface for Handling Session. All session Handlers should follow this interface. * */ trait SessionHandler { def getUserIdFo...
Explain and rewrite the following Scala code:
/* Copyright 2015 White Label Personal Clouds Pty 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 a...
Explain and rewrite the following Scala code:
package com.ubirch.auth.server.route import com.typesafe.scalalogging.slf4j.StrictLogging import com.ubirch.auth.config.Config import com.ubirch.auth.core.actor.util.ActorNames import com.ubirch.auth.core.actor.{GetProviderInfoList, ProviderInfoActor, ProviderInfoList} import com.ubirch.auth.util.server.RouteConstant...
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 2021 HM Revenue & Customs * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or a...
Explain and rewrite the following Scala code:
package com.lonelyplanet.scalahealthcheck.util import com.lonelyplanet.scalahealthcheck.{DatabaseHealthCheckResult, HealthCheckResult, HealthChecker} class MockDatabaseHealthChecker extends HealthChecker { var connectable = false override def check: HealthCheckResult = { DatabaseHealthCheckResult("localhost"...
Explain and rewrite the following Scala code:
/** * Copyright 2011-2012 eBusiness Information, Groupe Excilys (www.excilys.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * *...
Explain and rewrite the following Scala code:
/* * Copyright 2012-2014 Comcast Cable Communications Management, LLC * * 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 * * Unl...
Explain and rewrite the following Scala code:
package com.wavesplatform.transaction import com.wavesplatform.account.{KeyPair, PublicKey} import com.wavesplatform.common.state.ByteStr import com.wavesplatform.common.utils.{Base64, EitherExt2} import com.wavesplatform.transaction.smart.SetScriptTransaction import org.scalacheck.Gen import play.api.libs.json._ cla...
Explain and rewrite the following Scala code:
// Copyright 2016 Jim Pivarski // // 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:
/** * Swaggy Jenkins * Jenkins API clients generated from Swagger / Open API specification * * The version of the OpenAPI document: 1.1.2-pre.0 * Contact: blah@cliffano.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech */ package...
Explain and rewrite the following Scala code:
package settings object GlobalSettings { val MONGO_COLLECT_MAX = 100 }
Explain and rewrite the following Scala code:
package com.github.tanacasino.time4s import org.scalatest._ import com.github.tanacasino.time4s class Time4SSpec extends WordSpec { "A time4s" should { "works well with only imports" in { import com.github.tanacasino.time4s.Imports._ val now = LocalDateTime.now assert(now.isInstanceOf[ja...
Explain and rewrite the following Scala code:
import akka.actor.{ Actor, Props } import akka.remote.testkit.{ MultiNodeConfig, MultiNodeSpec, MultiNodeSpecCallbacks } import akka.testkit.ImplicitSender import org.scalatest.{ BeforeAndAfterAll, Matchers, WordSpecLike } //Sample test from akka examples, leave them to check multi-jvm machinery object SampleConfig e...
Explain and rewrite the following Scala code:
import akka.actor.Props import com.google.inject.AbstractModule import play.api.libs.concurrent.AkkaGuiceSupport import sender.{TickerImpl, Ticker, CampaignSupervisor} import services._ /** * This class is a Guice module that tells Guice how to bind several * different types. This Guice module is created when the P...
Explain and rewrite the following Scala code:
package com.ignition.frame import org.apache.spark.sql.RichColumn import org.junit.runner.RunWith import org.specs2.runner.JUnitRunner import com.ignition.types.{ RichStructType, date, double, fieldToRichStruct, int, string, timestamp } import com.ignition.util.XmlUtils @RunWith(classOf[JUnitRunner]) class FilterSpe...
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 controllers import org.scalatest.MustMatchers import org.scalatestplus.play.PlaySpec import play.api.libs.json.Json class MarshallingBadResponseResponseSpec extends PlaySpec with MustMatchers { "Write and reads" should { "transform BadRequestResponse object to json" in { Json.toJson(BadRequestRes...
Explain and rewrite the following Scala code:
// Copyright 2015 Heiko Seeberger // // 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 org.tensorflow.contrib.scala import org.tensorflow.Session import resource._ /** * Support for TensorFlow sessions. */ object Sessions { /** * Type class to treat a [[Session]] instance as a managed resource. */ implicit object sessionResource extends Resource[Session] { override def clos...
Explain and rewrite the following Scala code:
package cpup.mc.oldenMagic.api.oldenLanguage.runeParsing import cpup.mc.oldenMagic.api.oldenLanguage.runes.TRune import cpup.mc.oldenMagic.api.oldenLanguage.casting.conditions.{TConditionFilter, TConditionFilterCombinator} trait TConditionCombinatorRune extends TRune with TConditionFilterCombinator { def combine(a: ...
Explain and rewrite the following Scala code:
object Test { trait A; trait Foo0 { def foo : A; } trait Baz extends Foo0; trait B extends A { def initialize = { trait Foo extends Test.Foo0 { def foo : B.this.type = B.this; } class baz extends Baz with Foo { override def toString = "baz" } Console.println(new...
Explain and rewrite the following Scala code:
/* * Copyright (C) 2005, The Beangle Software. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This...
Explain and rewrite the following Scala code:
package dx.core.languages.wdl import dx.api.{DxApi, DxInstanceType, InstanceTypeDB, InstanceTypeDbQuery, InstanceTypeReq} import org.scalatest.flatspec.AnyFlatSpec import org.scalatest.matchers.should.Matchers import spray.json._ import wdlTools.eval.WdlValues.{V_Boolean, V_Float, V_Int, V_String} import wdlTools.util...
Explain and rewrite the following Scala code:
/* * Copyright 2013 Pascal Voitot (@mandubian) * * 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 uk.gov.gds.ier.transaction.forces.address import uk.gov.gds.ier.validation.ErrorTransformForm import uk.gov.gds.ier.step.StepTemplate import uk.gov.gds.ier.transaction.forces.InprogressForces import uk.gov.gds.ier.model.HasAddressOption trait AddressFirstMustache extends StepTemplate[InprogressForces] { va...
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 mr.merc.unit.sound sealed trait SoldierSound object MovementSound extends SoldierSound object PainSound extends SoldierSound object DeathSound extends SoldierSound case class AttackSound(number: Int, success: Boolean) extends SoldierSound
Explain and rewrite the following Scala code:
/* Copyright (c) 2016, Elliot Stirling 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 conditions and th...
Explain and rewrite the following Scala code:
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may ...
Explain and rewrite the following Scala code:
/* * Copyright 2015 Matt Massie * * 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 2016, deepsense.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 applicable law or agreed ...
Explain and rewrite the following Scala code:
/* * ========================================================================================= * Copyright © 2015 the khronus project <https://github.com/hotels-tech/khronus> * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You m...
Explain and rewrite the following Scala code:
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may ...
Explain and rewrite the following Scala code:
package com.mesosphere.cosmos.error import io.circe.Encoder import io.circe.JsonObject import io.circe.generic.semiauto.deriveEncoder final case class JsonParsingError( underlyingType : String, parsingErrorMessage: String, parsingInput: String ) extends CosmosError { override def data: Option[JsonObject] = Co...
Explain and rewrite the following Scala code:
package com.datamountaineer.connect.tools import spray.json.DefaultJsonProtocol /** * Created by andrew@datamountaineer.com on 04/11/2016. * kafka-connect-tools */ /** Equivalent of http://docs.confluent.io/2.1.0-alpha1/connect/userguide.html#statuses-errors */ case class ErrorMessage(error_code: Int, message:...
Explain and rewrite the following Scala code:
/* * usage example * * scalac Main.scala&&scala HelloWorld */ trait Tree object Node extends Tree class Leaf(value: String) extends Tree object Huga { def bye() = println("Good bye!") } class Hoge() { def hello() = println("Hello, world!") } class Foo() { def fee(l: Int, d: Double): Option[Int] = if (l ==...
Explain and rewrite the following Scala code:
package scala.pickling package pickler /** Picklers for primitive arrays. */ trait PrimitiveArrayPicklers { implicit val byteArrayPickler: AbstractPicklerUnpickler[Array[Byte]] = PrimitivePickler[Array[Byte]] implicit val shortArrayPickler: AbstractPicklerUnpickler[Array[Short]] = PrimitivePickler[Array[Short]] ...
Explain and rewrite the following Scala code:
package scavenger.demo import scala.concurrent.Future import scala.concurrent.duration._ import scala.language.postfixOps import scavenger._ import scavenger.app.LocalScavengerApp /** A little demo that shows how to get Scavenger up and running on * a single computer. * * This might be useful if you want to tes...
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.tools.nsc packag...
Explain and rewrite the following Scala code:
package org.jetbrains.plugins.scala.lang.psi.types.api import org.jetbrains.plugins.scala.lang.psi.types.ScLiteralType import org.jetbrains.plugins.scala.lang.psi.types.api.designator.{ScDesignatorType, ScProjectionType, ScThisType} import org.jetbrains.plugins.scala.lang.psi.types.nonvalue.ScMethodType /** * @auth...
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 2012 Twitter Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed t...
Explain and rewrite the following Scala code:
package reftree.graph import monocle.Optional import reftree.geometry.Color import reftree.util.Optics import reftree.dot._ import reftree.dot.html._ import zipper.Unzip import com.softwaremill.quicklens._ object Merging { /** Get a unique statement identifier, if any */ private def statementId(statement: GraphSt...
Explain and rewrite the following Scala code:
/* Copyright 2009-2016 EPFL, Lausanne */ import leon.annotation.extern import leon.lang._ object AsInstanceOf { abstract class Top abstract class Middle extends Top case class Bottom(x: Int) extends Middle // Middle is abstract and has a parent, and therefore shouldn't be used for casting // because we do...
Explain and rewrite the following Scala code:
package org.scaladebugger.api.lowlevel.events import com.sun.jdi.event.Event import org.scaladebugger.api.lowlevel.events.data.{JDIEventDataProcessor, JDIEventDataResult, JDIEventDataUnknownError} import org.scaladebugger.api.lowlevel.events.filters.JDIEventFilterProcessor import scala.util.Try /** * Represents a p...
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.jetbrains.plugins.scala package lang package completion3 import com.intellij.codeInsight.completion.CompletionType import com.intellij.codeInsight.lookup.{Lookup, LookupElement} import com.intellij.testFramework.EditorTestUtil import org.jetbrains.plugins.scala.debugger.{ScalaVersion, Scala_2_12} import or...
Explain and rewrite the following Scala code:
package com.twitter.finagle.http.exp.routing import com.twitter.finagle.http.exp.routing.Segment.{Constant, Parameterized, Slash} import scala.annotation.tailrec // note: The below methods which result in returning a single String index use -1 as a magic number // to signify when a match cannot be found, which ...
Explain and rewrite the following Scala code:
/* Scala Implementation of Zombie Language */ import scala.collection.mutable class ScalaZombie { /* Modelling */ abstract class Statement { def exec() } var curEntity : String = "" var curLineNum : Int = 1 val memories = new mutable.HashMap[String, Int]() val programs = new mutable...
Explain and rewrite the following Scala code:
package com.greencatsoft.angularjs import scala.language.implicitConversions import scala.scalajs.js import org.scalajs.dom.{ Element, Event } trait AngularElement extends Element { def bind[T <: Event](event: String, handler: js.Function1[T, _]): Unit = js.native def unbind[T <: Event](event: String, handler:...
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:
/* * This file is 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...
Explain and rewrite the following Scala code:
package org.akka.essentials.calculator.example3 import org.akka.essentials.calculator.CalculatorInt import akka.actor.SupervisorStrategy._ import akka.actor.SupervisorStrategy.Restart import akka.actor.TypedActor.PostStop import akka.actor.TypedActor.PreStart import akka.actor.TypedActor.Supervisor import akka.actor.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"); yo...
Explain and rewrite the following Scala code:
package nl.codecentric.assumption.dsl.api.word /** * Created by hylke on 22/07/15. */ trait ResultVerb { implicit val message = "" def success()(implicit message: String): Unit = { } def fail()(implicit message: String): Unit = { } }
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 sci2s.sparkfingerprint /** * @author daniel */ import org.apache.spark.SparkContext import org.apache.spark.SparkContext._ import org.apache.spark.SparkConf import org.apache.hadoop.io.Text import org.apache.spark.HashPartitioner import sci2s.mrfingerprint.LSCylinderArray import sci2s.mrfingerprint.Generic...
Explain and rewrite the following Scala code:
import sbt._ import Keys._ import play.Play.autoImport._ import PlayKeys._ object ApplicationBuild extends Build { val appName = "play2-crud-sample" val appVersion = "0.7.4-SNAPSHOT" val appScalaVersion = "2.11.1" val appDependencies = Seq( javaCore, javaJdbc, javaEbean, ...
Explain and rewrite the following Scala code:
package org.jetbrains.plugins.scala.lang.stubIndex import com.intellij.psi.JavaPsiFacade import com.intellij.psi.search.GlobalSearchScope import org.junit.Assert import org.jetbrains.plugins.scala.base.{ScalaLightCodeInsightFixtureTestAdapter, SimpleTestCase} import org.jetbrains.plugins.scala.lang.refactoring.util.Sc...
Explain and rewrite the following Scala code:
package com.skn.api.view.jsonapi import com.skn.api.view.exception.ParsingException import com.skn.api.view.jsonapi.JsonApiModel.RootObject import com.skn.api.{Fail, Result, Success} import play.api.libs.json.{JsValue, Json} import com.skn.api.view.jsonapi.JsonApiPlayFormat._ /** * This class provide methods for ma...
Explain and rewrite the following Scala code:
package org.jetbrains.plugins.scala package refactoring.changeSignature import java.io.File import com.intellij.openapi.util.io.FileUtilRt import com.intellij.openapi.vfs.{CharsetToolkit, VfsUtil} import com.intellij.psi._ import com.intellij.psi.impl.source.PostprocessReformattingAspect import com.intellij.refactori...
Explain and rewrite the following Scala code:
package me.heaton.profun.week5 import org.junit.runner.RunWith import org.scalatest.FunSuite import org.scalatest.junit.JUnitRunner @RunWith(classOf[JUnitRunner]) class AListTest extends FunSuite with TestList { /** * Convention: Operators(not method calls) ending in ":" associate to the right * A :: B :: C ...
Explain and rewrite the following Scala code:
package core import play.api.data.Form import play.api.mvc.{AnyContent, Request, SimpleResult} import play.api.templates.Html import grizzled.slf4j.Logging import java.awt.Color trait Common extends Logging { def msgInfo(text:String*) = "msg-info" -> text.mkString("\\n") def msgError(text:String*) = "msg-error"...
Explain and rewrite the following Scala code:
package net.xylophones.planetoid.game.logic import net.xylophones.planetoid.game.model._ import net.xylophones.planetoid.game.logic.ModelTestObjectMother._ import org.junit.runner.RunWith import org.scalatest.{FunSuite, Matchers} import org.scalatest.junit.JUnitRunner @RunWith(classOf[JUnitRunner]) class GameMissileF...