instruction
stringclasses
1 value
output
stringlengths
5
1M
Explain and rewrite the following Scala code:
/** * Copyright (C) 2012 - 101loops.com <dev@101loops.com> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by appli...
Explain and rewrite the following Scala code:
package mot.monitoring import mot.util.Tabler import mot.Context import collection.JavaConversions._ import java.util.concurrent.TimeUnit class ServerConnections(context: Context) extends SimpleCommandHandler { val name = "server-connections" val helpLine = "Print information about server connections" def sim...
Explain and rewrite the following Scala code:
/* *\ ** Squants ** ** ** ** Scala Quantities and Units of Measure Library and DSL ** ** (c) 2013-2015, Ga...
Explain and rewrite the following Scala code:
package reftree.demo object Ammonite extends App { val predef = Seq( "import scala.collection.immutable._", "import de.sciss.fingertree._", "import monocle.macros.GenLens", "import com.softwaremill.quicklens._", "import zipper._", "import reftree.core._", "import reftree.diagram._", "...
Explain and rewrite the following Scala code:
import java.{lang => jl, util => ju} import scala.reflect.runtime.universe._ object MethodTypes { class A { def a(cos: Any)(cosinnego: Int): Int = 5 def b(cos: Int)(cosinnego: Int): String = "" def c = 5 } class G[T] { def id(t: T): T = t } class C extends G[Int] implicit class IA(a:...
Explain and rewrite the following Scala code:
package com.twitter.finagle.serverset2 import com.twitter.util.RandomSocket import org.junit.runner.RunWith import org.scalatest.junit.JUnitRunner import org.scalatest.FunSuite import java.net.InetSocketAddress @RunWith(classOf[JUnitRunner]) class ServerSet2Test extends FunSuite { def ia(port: Int) = HostPort("loca...
Explain and rewrite the following Scala code:
package inloopio.math.random import java.util.Collections import java.util.Random import java.util.WeakHashMap import scala.collection.mutable import scala.reflect.ClassTag /** * <p> * The source of random stuff for the whole project. This lets us make all randomness in the project * predictable, if desired, for w...
Explain and rewrite the following Scala code:
/* * Copyright 2014 Timothy Danford * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed...
Explain and rewrite the following Scala code:
package com.sksamuel.scapegoat.inspections import com.sksamuel.scapegoat.{ Inspection, InspectionContext, Inspector, Levels } /** @author Stephen Samuel */ class EmptyCaseClass extends Inspection { def inspector(context: InspectionContext): Inspector = new Inspector(context) { override def postTyperTraverser =...
Explain and rewrite the following Scala code:
/* * Copyright 2011-2019 Asakusa Framework Team. * * 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:
/** * Copyright (C) 2014-2015 Really Inc. <http://really.io> */ package io.really import _root_.io.really.model._ import _root_.io.really.protocol.UpdateOp import _root_.io.really.model.CollectionActor.CollectionActorEvent import akka.actor.ActorRef import play.api.libs.json.{ Json, JsObject } package object gorill...
Explain and rewrite the following Scala code:
package feh.tec.visual.util import scala.swing.Swing import java.awt.{Rectangle, Point, Dimension} trait AwtUtils { implicit def dimensionToPair(dim: Dimension): (Int, Int) = dim.getWidth.toInt -> dim.getHeight.toInt implicit def pair2Dimension = Swing.pair2Dimension _ implicit def pair2Point(p: (Int, Int)):...
Explain and rewrite the following Scala code:
package com.avsystem.commons package jiop trait Java8CollectionUtils { import Java8CollectionUtils._ implicit def jIteratorOps[A](it: JIterator[A]): jIteratorOps[A] = new jIteratorOps(it) implicit def jIterableOps[A](it: JIterable[A]): jIterableOps[A] = new jIterableOps(it) implicit def jCollectionOps[A](it:...
Explain and rewrite the following Scala code:
package de.choffmeister.microserviceutils.http import akka.http.scaladsl.server.Directives._ import akka.http.scaladsl.server.{Directive1, MalformedQueryParamRejection} final case class Page(number: Int, length: Int, totalLength: Option[Int] = None) { require(length > 0, "Page length must be positive") def first...
Explain and rewrite the following Scala code:
/** Copyright 2014 TappingStone, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law ...
Explain and rewrite the following Scala code:
package is.hail.types.physical import is.hail.annotations.{Region, UnsafeUtils} import is.hail.asm4s._ import is.hail.expr.ir._ import is.hail.utils._ import is.hail.variant.Genotype trait PValue { pValueSelf => def pt: PType def get: PCode def value: Value[_] = { new Value[Any] { override def get: ...
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 silhouette.evesso.dao import java.util.UUID import com.mohiva.play.silhouette.api.LoginInfo import silhouette.evesso.EveCharacter import scala.concurrent.Future trait EveCharacterDAO { def findByLoginInfo(loginInfo: LoginInfo): Future[Option[EveCharacter]] def findByGlocalUserID(globalUserID: UUID): Fut...
Explain and rewrite the following Scala code:
package skinny.validator import scala.language.reflectiveCalls import skinny.util.DateTimeUtil /** * Built-in validation rules. */ // ---- // param("x" -> "") is notNull object notNull extends ValidationRule { def name = "notNull" def isValid(v: Any) = v != null } // ---- // param("x" -> "y") is required ob...
Explain and rewrite the following Scala code:
// Copyright: 2010 - 2016 https://github.com/ensime/ensime-server/graphs // Licence: http://www.gnu.org/licenses/gpl-3.0.en.html package org.ensime.core import akka.actor._ import akka.event.LoggingReceive.withLabel import org.apache.commons.vfs2.FileObject import org.ensime.api._ import org.ensime.core.debug.DebugMan...
Explain and rewrite the following Scala code:
/* * Copyright (c) 2012-2017 by its authors. Some rights reserved. * See the project homepage at: https://github.com/monix/shade * * Licensed under the MIT License (the "License"); you may not use this * file except in compliance with the License. You may obtain a copy * of the License at: * * https://github.co...
Explain and rewrite the following Scala code:
package edu.cornell.cdm89.scalaspec.math object JacobiPolynomials { def p00(order: Int, x: Double): Double = { var p_n0 = 0.0 var p_n1 = 1.0 var n1 = 0.0 for (ord <- 1 to order) { val p_n2 = (x*p_n1*(2.0*n1 + 1.0) - p_n0*n1) / (n1 + 1.0) p_n0 = p_n1 p_n1 = p_n2 n1 += 1.0 }...
Explain and rewrite the following Scala code:
import sbt._ import assembly.AssemblyBuilder import reaktor.scct.ScctProject class GraphiteRelayProject(info: ProjectInfo) extends DefaultProject(info) with ScctProject with AssemblyBuilder { lazy val jbossRepo = Repositorie...
Explain and rewrite the following Scala code:
/* * Copyright 2013 TeamNexus * * TeamNexus Licenses this file to you under the MIT License (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at: * * http://opensource.org/licenses/mit-license.php * * Unless required by applicable law ...
Explain and rewrite the following Scala code:
/*-------------------------------------------------------------------------*\\ ** ScalaCheck ** ** Copyright (c) 2007-2018 Rickard Nilsson. All rights reserved. ** ** http://www.scalacheck.org ** ** ...
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:
/** * © 2019 Refinitiv. 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 required by applicable l...
Explain and rewrite the following Scala code:
/*§ =========================================================================== GraphsJ - SDK =========================================================================== Copyright (C) 2009-2016 Gianluca Costa =========================================================================== Licensed under the Apac...
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 uk.gov.dvla.vehicles.presentation.common import play.api.GlobalSettings import play.api.test.{FakeApplication, WithApplication} import uk.gov.dvla.vehicles.presentation.common.TestWithApplication.fakeAppWithTestGlobal import uk.gov.dvla.vehicles.presentation.common.testhelpers.LightFakeApplication import uk.go...
Explain and rewrite the following Scala code:
object Test extends App { val ns = (0 until 20) val arr = new Array[Int](10) def tryit(label: String, start: Int, len: Int): Unit = { val status = try { val it = ns.toIterator it.copyToArray(arr, start, len) "ok" } catch { case e: Exception => e.toString } println("%s: %s"...
Explain and rewrite the following Scala code:
package forcomp import common._ object Anagrams { /** A word is simply a `String`. */ type Word = String /** A sentence is a `List` of words. */ type Sentence = List[Word] /** `Occurrences` is a `List` of pairs of characters and positive integers saying * how often the character appears. * This l...
Explain and rewrite the following Scala code:
package graffiti.spring.ioc import com.typesafe.config.ConfigFactory import org.scalatest.{FlatSpec, Matchers} import org.springframework.beans.factory.annotation.Value import org.springframework.context.annotation.{Bean, Configuration} import scala.collection.JavaConversions._ /** * @author Alexander De Leon (ale...
Explain and rewrite the following Scala code:
/* * Copyright 2021 HM Revenue & Customs * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or a...
Explain and rewrite the following Scala code:
package org.randi3.edc.model.openClinica case class ConnectionOC(location: String, username: String, passwordHash: String, dataSetId: Int) { }
Explain and rewrite the following Scala code:
package org.vaadin.addons.rinne import com.vaadin.server.ThemeResource import org.scalatest.FunSpec class VEmbeddedSpec extends FunSpec { describe("A VEmbedded") { describe("should allow to set") { it("parameters") { val embedded = new VEmbedded embedded.parameters += "param1" -> "value...
Explain and rewrite the following Scala code:
// - Project: surf (https://github.com/jokade/surf) // Module: shared // Description: Provides a base class for static singleton services // // Copyright (c) 2015 Johannes Kastner <jokade@karchedon.de> // Distributed under the MIT License (see included file LICENSE) package surf.service import sur...
Explain and rewrite the following Scala code:
package com.storecove.rollbar.test import com.storecove.rollbar.{RollbarNotifier, RollbarNotifierFactory} import org.scalatest.{FlatSpec, Matchers} /** * Created by acidghost on 06/06/15. */ class RollbarNotifierFactorySpec extends FlatSpec with Matchers { "A RollbarNotifierFactory" should "create a new Rollba...
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 sangria.macros._ import types._ object AddArticle { object addArticle extends GraphQLQuery { val document: sangria.ast.Document = graphql"""mutation addArticle($$content: ArticleContent!) { addArticle(content: $$content) { id title } }""" case class Variables(content: ArticleContent) ca...
Explain and rewrite the following Scala code:
/* * Copyright (C) 2016 DANS - Data Archiving and Networked Services (info@dans.knaw.nl) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 ...
Explain and rewrite the following Scala code:
package gdg.blaze.ext import gdg.blaze.{Message, MessageFilter} import org.testng.annotations.Test class GeoIpFilterTest { @Test def test = { val msgs = new GeoIpFilter(new GeoIpConfig("ip"), new MessageFilter()) .transform(new Message(Map("ip" -> "128.101.101.101"))) println(msgs) } }
Explain and rewrite the following Scala code:
package io.aigar.game import scala.concurrent.Future import scala.concurrent.ExecutionContext.Implicits.global import scala.concurrent.blocking import scala.math.round import com.github.jpbetz.subspace.Vector2 import com.typesafe.scalalogging.LazyLogging import io.aigar.score.ScoreModification import io.aigar.controll...
Explain and rewrite the following Scala code:
package c2.w2 import scala.collection.immutable /** * Pouring * * @param capacity each vector is a glass with the value of the vector being the number of units. */ class Pouring(capacity: Vector[Int]) { val glasses: Range = capacity.indices type State = Vector[Int] trait Move { def change(state: S...
Explain and rewrite the following Scala code:
package com.bigchange.corenlp /** * Created by C.J.YOU on 2016/4/14. */ object NLPProcessor { // val proc:Processor = new CoreNLPProcessor(withDiscourse = true) // val doc = new Document("add your text here! It can contain multiple sentences.") }
Explain and rewrite the following Scala code:
import sbt._ import Keys._ import de.johoop.jacoco4sbt._ import JacocoPlugin._ import com.typesafe.sbt.osgi.SbtOsgi._ import OsgiKeys._ import org.scalawag.sbt.gitflow.GitFlow object PickaxeBuild extends Build { import Dependencies._ val VERSION = GitFlow.WorkingDir.version.toString val commonSettings = os...
Explain and rewrite the following Scala code:
/* * The Reactive Summit Austin talk * Copyright (C) 2016 Jan Machacek * * 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 v...
Explain and rewrite the following Scala code:
package org.flowpaint.model import org.flowpaint.renderer.{RenderSurface, PictureProvider} /** * The central datamodel for pictures in FlowPaint. * * @author Hans Haggstrom */ class Painting extends PictureProvider { private var layers: List[Layer] = List( new Layer ) var backgroundColor = java.awt.Color....
Explain and rewrite the following Scala code:
import scala.collection.mutable.ListBuffer import scala.io.Source import java.io.BufferedWriter import java.io.OutputStreamWriter import java.io.FileOutputStream object AnalyzeAlignmentExperiments { def main(args: Array[String]) { val clsList = ListBuffer[String]() var eqCnt = 0 var eqmCnt = 0 ...
Explain and rewrite the following Scala code:
package Yosemite.utils /** * Created by zhanghan on 17/4/12. */ class BpsInfo { }
Explain and rewrite the following Scala code:
object fake_help_verbose { def main(args: Array[String]) { // Put code here } }
Explain and rewrite the following Scala code:
object + extends this . type ( ) ( { } . + = )
Explain and rewrite the following Scala code:
package ee.cone.c4gate_server import java.security.SecureRandom import java.time.Instant import java.util.{Locale, UUID} import javax.crypto.SecretKeyFactory import javax.crypto.spec.PBEKeySpec import com.typesafe.scalalogging.LazyLogging import ee.cone.c4actor.LifeTypes.Alive import ee.cone.c4actor.Types.SrcId impo...
Explain and rewrite the following Scala code:
package com.github.cuzfrog.webdriver /** * Created by Cause Frog on 7/20/2016. */ sealed trait DriverType case object IE extends DriverType case object FireFox extends DriverType case object Chrome extends DriverType case object HtmlUnit extends DriverType
Explain and rewrite the following Scala code:
package TeamBuilding import Import.ImportOptimizer.ImportOptimizer.{FinalPlayers} import Import.{Male, Female, FinalPlayer, StopSystemAfterAll} import akka.actor.ActorSystem import akka.testkit.{ImplicitSender, TestKit} import master.UeberActor.FinalPlayersWithTeamNumber import org.scalatest.{MustMatchers, WordSpecLik...
Explain and rewrite the following Scala code:
package org.langmeta package inputs // NOTE: `start` and `end` are String.substring-style, // i.e. `start` is inclusive and `end` is not. // Therefore Position.end can point to the last character plus one. // // NOTE: All numbers here are zero-based, namely: // * Offset 0 is the first character in the input. // * Line...
Explain and rewrite the following Scala code:
package org.broadinstitute.sting.queue.qscripts import org.broadinstitute.sting.queue.QScript import org.broadinstitute.sting.queue.util.QScriptUtils import net.sf.samtools.SAMFileHeader.SortOrder import org.broadinstitute.sting.utils.exceptions.UserException import org.broadinstitute.sting.commandline.Hidden import o...
Explain and rewrite the following Scala code:
package com.twitter.inject import com.google.inject.{Key, Injector => UnderlyingInjector} import java.lang.annotation.Annotation import net.codingwell.scalaguice.KeyExtensions._ import net.codingwell.scalaguice.typeLiteral import scala.reflect.ClassTag import scala.reflect.runtime.universe._ final case class Injector...
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.moe.parser object ParserUtils { def normPerlInt (s: String): String = s.replace("_", "") def formatInt (s: String): Int = normPerlInt(s.replace("+", "")).toInt def formatFloat (s: String): Double = normPerlInt(s).toDouble def formatOctal (s: String): Int = Integer.parseInt( normPerlInt(s),...
Explain and rewrite the following Scala code:
/** * Copyright 2015 Adrian Hurtado (adrianhurt) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable l...
Explain and rewrite the following Scala code:
/* * Copyright 2016 Dennis Vriend * * 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 rpgboss.editor.resourceselector import scala.swing._ import rpgboss.editor.uibase.SwingUtils._ import scala.swing.event._ import rpgboss.model._ import rpgboss.model.resource._ import rpgboss.editor.StateMaster import rpgboss.editor.uibase._ import com.typesafe.scalalogging.slf4j.LazyLogging abstract class Re...
Explain and rewrite the following Scala code:
/*********************************************************************** * Copyright (c) 2013-2022 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:
/** * Created by gkt on 12/12/14. */ package org.scalatddpackt class Model { override def toString() = "Model".toString }
Explain and rewrite the following Scala code:
/* * Copyright 2015 Nicolas Rinaudo * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed...
Explain and rewrite the following Scala code:
package x7c1.linen.modern.init.settings.preset import android.support.v4.app.FragmentActivity import android.support.v7.app.AlertDialog import android.support.v7.widget.LinearLayoutManager import x7c1.linen.database.control.DatabaseHelper import x7c1.linen.database.struct.HasChannelStatusKey import x7c1.linen.glue.act...
Explain and rewrite the following Scala code:
package com.wavesplatform.crypto import org.bouncycastle.crypto.digests.KeccakDigest object Keccak256 extends BCDigest(() => new KeccakDigest(256), 32)
Explain and rewrite the following Scala code:
package dk.bayes.math.gaussian import scala.math._ import dk.bayes.math.numericops._ trait GaussianNumericOps { private val minPrecision = 1e-7 /** * P.A. Bromiley. Products and Convolutions of Gaussian Distributions, 2003 */ implicit val multOp = new multOp[Gaussian] { def apply(a: Gaussian*): Gau...
Explain and rewrite the following Scala code:
package vggames.scala.tasks.judge import vggames.shared.task.JudgedTask case class ExecutionFailure(failure : Throwable) extends JudgedTask { def ok = false def reason = "Exception foi lan&ccedil;ada durante execu&ccedil;&atilde;o: \\n" + failure.getMessage override def toString = reason }
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.twitter.finagle.filter import com.twitter.finagle.{Filter, Service} // class CastingFilter[Req, Rep] extends Filter[Req, Rep, Any, Any] // { // def apply(request: Req, service: Service[Any, Any]): Future[Rep] = // service() // }
Explain and rewrite the following Scala code:
/** * COPYRIGHT (C) 2015 Alpine Data Labs Inc. All Rights Reserved. */ package com.alpine.plugin.core.io import com.alpine.plugin.core.annotation.AlpineSdkApi /** * :: AlpineSdkApi :: * A Hdfs input/output file. */ @AlpineSdkApi trait HdfsFile extends IOBase { def path: String }
Explain and rewrite the following Scala code:
package com.wavesplatform.http import akka.http.scaladsl.model.{HttpResponse, StatusCodes} import akka.http.scaladsl.server.Route import com.wavesplatform.TestWallet import com.wavesplatform.account.KeyPair import com.wavesplatform.api.common.CommonTransactionsApi import com.wavesplatform.api.http.TransactionsApiRoute...
Explain and rewrite the following Scala code:
package dk.tennis.compare.analysis import dk.tennis.compare.rating.multiskill.matchloader.MatchesLoader import dk.tennis.compare.rating.multiskill.infer.skills.givenallmatches.InferSkillGivenAllMatches import dk.tennis.compare.rating.multiskill.infer.skills.InferSkill import dk.tennis.compare.rating.multiskill.model.p...
Explain and rewrite the following Scala code:
/* * Copyright 2016 Nicolas Rinaudo * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed...
Explain and rewrite the following Scala code:
package org.synyx.git import org.eclipse.jgit.revwalk.RevCommit class CommitService(private val repoService: GitRepoAccess) { def refresh(repoConfig: RepositoryConfig): Iterable[Commit] = { val theLatestCommit: RevCommit = if (!repoConfig.isCheckedOut()) { null } else { // get current commit ...
Explain and rewrite the following Scala code:
package chrome import chrome.permissions.APIPermission trait ChromeAPI { val requiredPermissions: Set[APIPermission] }
Explain and rewrite the following Scala code:
package org.inosion.dadagen import org.inosion.dadagen.generators.Generator /* reducing compiled class sizes in the releases - http://blog.duh.org/2011/11/scala-pitfalls-trait-bloat.html */ abstract class AbstractIterator[+A] extends Iterator[A] abstract class Dadagenerator[A] { def generators: List[Generator[_]...
Explain and rewrite the following Scala code:
package com.twitter.scalding.parquet.scrooge import _root_.cascading.scheme.Scheme import com.twitter.scalding._ import com.twitter.scalding.parquet.thrift.ParquetThriftBase import com.twitter.scalding.typed.{PartitionSchemed, PartitionUtil} import com.twitter.scrooge.ThriftStruct import scala.reflect.ClassTag /** ...
Explain and rewrite the following Scala code:
package nexus.diff.ops import nexus.diff._ import nexus.diff.exception._ import nexus.diff.ops.mixin._ import nexus._ import nexus.typelevel.Remove.Aux import nexus.typelevel._ object Sum { object All extends PolyOp1 { implicit def sumAllF[T[_], R, A](implicit T: IsRealTensorK[T, R]): P[T[A], R] = new P[...
Explain and rewrite the following Scala code:
package se.culvertsoft.mnet import org.junit.Test import TestUtils.assertWithin1sec import TestUtils.serializer import se.culvertsoft.mnet.backend.WebSockBackEnd import se.culvertsoft.mnet.backend.util.ReconnectingWebsocket class CanConnect { @Test def test() { val b = TestUtils.newNode(1200)().start() ...
Explain and rewrite the following Scala code:
package sangria.parser import language.postfixOps import org.parboiled2.{ParserInput, Position} import org.scalatest.{Matchers, WordSpec} import sangria.ast._ import sangria.util.FileUtil import scala.reflect.ClassTag import scala.util.{Failure, Success} class QueryParserSpec extends WordSpec with Matchers { "Qu...
Explain and rewrite the following Scala code:
package csexp.tokenize import java.io.EOFException import java.io.InputStream /** * Positioned input-stream with push-back capability. */ private[tokenize] class PositionedInputStream(private val underlying: InputStream) { /** * Current position. */ def position: Int = _position /** * Current posit...
Explain and rewrite the following Scala code:
/* * Copyright 2015-2016 IBM Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agree...
Explain and rewrite the following Scala code:
package org.finra.datagenerator.scaffolding.spark import org.apache.spark.rdd.RDD import org.apache.spark.{SparkConf, SparkContext} import org.finra.datagenerator.scaffolding.messaging.MessageHandler import org.slf4j.{Logger, LoggerFactory} import org.springframework.beans.factory.annotation.Autowired import org.sprin...
Explain and rewrite the following Scala code:
/* * Copyright 2020 HM Revenue & Customs * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or a...
Explain and rewrite the following Scala code:
package org.camunda.feel.impl.builtin import org.camunda.feel.impl.builtin.BuiltinFunction.builtinFunction import org.camunda.feel.syntaxtree.{ ValBoolean, ValError, ValList, ValNumber, ValString } import java.util.regex.Pattern import scala.util.Try object StringBuiltinFunctions { def functions = Map( ...
Explain and rewrite the following Scala code:
/* MET-API Copyright (C) 2014 met.no Contact information: Norwegian Meteorological Institute Box 43 Blindern 0313 OSLO NORWAY E-mail: met-api@met.no This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as publ...
Explain and rewrite the following Scala code:
package example import org.scalatra.test.scalatest.ScalatraFlatSpec import skinny.engine._ import scala.concurrent.Future object HelloServlet extends SingleApp { def message(implicit ctx: Context) = { s"Hello, ${params(ctx).getOrElse("name", "Anonymous")}" } // synchronous action get("/hello")(message)...
Explain and rewrite the following Scala code:
package com.mygdx.game.gui import java.net.URL import com.badlogic.gdx.Gdx import com.badlogic.gdx.scenes.scene2d.Actor import com.badlogic.gdx.scenes.scene2d.ui.{List => _, _} import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeEvent import co...
Explain and rewrite the following Scala code:
package usbinstall import ch.qos.logback.classic.Logger import java.io.PrintStream import java.util.Locale import javafx.stage.Stage import org.slf4j.LoggerFactory import suiryc.scala.io.{LineSplitterOutputStream, ProxyLineWriter, SystemStreams} import suiryc.scala.io.RichFile._ import suiryc.scala.javafx.{JFXApplicat...
Explain and rewrite the following Scala code:
package com.ldaniels528.broadway.core.triggers.location import com.ldaniels528.broadway.core.narrative.{FeedDescriptor, Feed, NarrativeRuntime} /** * Represents a location; an abstract container for incoming feeds * @author Lawrence Daniels <lawrence.daniels@gmail.com> */ trait Location { /** * Returns the l...
Explain and rewrite the following Scala code:
package com.verisign.storm.tools.sbod.logging import org.slf4j.{Logger, LoggerFactory} trait TransientLazyLogging { @transient protected lazy val logger: Logger = LoggerFactory.getLogger(getClass.getName) } trait LazyLogging { protected lazy val logger: Logger = LoggerFactory.getLogger(getClass.getName) } t...
Explain and rewrite the following Scala code:
package codebook.runtime.server import akka.actor.{Actor, ActorLogging, ActorRef, ActorSystem, Address, Props} import akka.cluster.{Cluster, Member} import akka.cluster.ClusterEvent._ import akka.remote.{AssociatedEvent, AssociationErrorEvent, AssociationEvent, DisassociatedEvent} import codebook.runtime.util.HasAkkaC...
Explain and rewrite the following Scala code:
package mesosphere.marathon import mesosphere.UnitTest import org.apache.zookeeper.ZooDefs import org.rogach.scallop.ScallopConf import scala.util.Try class ZookeeperConfTest extends UnitTest { "ZookeeperConf" should { "urlParameterGetParsed" in { val url = "zk://host1:123,host2,host3:312/path" val...
Explain and rewrite the following Scala code:
package com.twitter.concurrent.exp import com.twitter.util.{Await, Promise, Future} import org.junit.runner.RunWith import org.scalacheck.{Arbitrary, Gen} import org.scalatest.FunSuite import org.scalatest.junit.JUnitRunner import org.scalatest.prop.GeneratorDrivenPropertyChecks @RunWith(classOf[JUnitRunner]) class A...
Explain and rewrite the following Scala code:
package sampler.cluster.abc.algorithm.component import sampler.math.StatisticsComponent import sampler.cluster.abc.algorithm.Generation import sampler.cluster.abc.config.ABCConfig import sampler.cluster.abc.actor.ScoredParticles import sampler.cluster.abc.actor.Tagged import sampler.Implicits.SamplableMap import sampl...
Explain and rewrite the following Scala code:
package controllers import worker.Coordinator import akka.actor.Inbox import akka.pattern.ask import akka.util.Timeout import init.Init import play.api.libs.json.Json import play.api.mvc._ import scala.concurrent.duration._ object Internal extends Controller { def actorSystem = Init.system def coordinator = Ini...
Explain and rewrite the following Scala code:
package asobu.distributed.gateway /** * the yet to release routes compiler code, todo: remove this when its released */ object RoutesCompilerExtra { import play.routes.compiler.templates.tq /** * Encode the given String constant as a triple quoted String. * * This will split the String at any $ characte...