instruction
stringclasses
1 value
output
stringlengths
5
1M
Explain and rewrite the following Scala code:
package org.jetbrains.plugins.scala.failed.typeInference import org.jetbrains.plugins.scala.PerfCycleTests import org.jetbrains.plugins.scala.base.ScalaLightCodeInsightFixtureTestAdapter import org.junit.experimental.categories.Category /** * @author anton.yalyshev * @since 14.04.16. */ @Category(Array(classOf[...
Explain and rewrite the following Scala code:
package weaponmark import ammonite.ops.{home, write} import mage.{Opponent, Weapon} import upickle.{default => pickle} /** * create benchmark regression test files to use as base line in regression testing - BenchmarkRegressionSpec * after running this, you might want to run RegressionTestToleranceTuner(100) - an...
Explain and rewrite the following Scala code:
package io.github.shogowada.scalajs.reactjs.example.interactive.helloworld import io.github.shogowada.scalajs.reactjs.example.{BaseTest, TestTargetServers} class InteractiveHelloWorldTest extends BaseTest { val server = TestTargetServers.interactiveHelloWorld val defaultName = "whoever you are" "given I am i...
Explain and rewrite the following Scala code:
/*********************************************************************** * Copyright (c) 2013-2015 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 is ...
Explain and rewrite the following Scala code:
package common.routes.frontend import akka.http.scaladsl.server.Directives._ import akka.http.scaladsl.server.Route class FrontendRoute { val routes: Route = (path("public" / Segment) & get) { str => getFromResource(s"public/$str") } }
Explain and rewrite the following Scala code:
/******************************************************************************* Copyright (c) 2013, S-Core. All rights reserved. Use is subject to license terms. This distribution may include materials developed by third parties. *********************************************************************...
Explain and rewrite the following Scala code:
package org.scalawiki.dto.cmd.query import org.scalawiki.dto.cmd._ import org.scalawiki.dto.cmd.query.list.{ListArg, ListParam} import org.scalawiki.dto.cmd.query.meta.{MetaArg, MetaParam} import org.scalawiki.dto.cmd.query.prop.{Revisions, Prop, PropArg} /** * ?action=query * */ case class Query(override val pa...
Explain and rewrite the following Scala code:
package com.monsanto.arch.cloudformation.model.resource import com.monsanto.arch.cloudformation.model.{ConditionRef, EnumFormat, ResourceRef, StringBackedInt, Token} import com.monsanto.arch.cloudformation.model.Token.TokenSeq import spray.json._ /** * Cache security group. * * @param name * @param Descriptio...
Explain and rewrite the following Scala code:
package com.jejking.rprng.lotteries.de.lotto import akka.NotUsed import akka.stream.scaladsl.Source import com.jejking.rprng.api.ToSizedSet import com.jejking.rprng.rng.{EightByteString, EightByteStringOps} import java.time.Clock import java.time.temporal.ChronoUnit import java.util.concurrent.TimeUnit import scala.c...
Explain and rewrite the following Scala code:
import sbt._ import Keys._ object StackableControllerProjects extends Build { lazy val _organization = "jp.t2v" lazy val _version = "0.5.1-SNAPSHOT" def _publishTo(v: String) = { val nexus = "https://oss.sonatype.org/" if (v.trim.endsWith("SNAPSHOT")) Some("snapshots" at nexus + "content/re...
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 util.position class Position(x: Int, y: Int) extends PositionRaw(x, y) { require(x >= 1 && x <= 8 && y >= 1 && y <= 8, "must be between {1,1} - {8,8}") } object Position { private val surroundTemplate = Set(new PositionRaw(0, 1), new PositionRaw(1, 0), new PositionRaw(0, -1), new PositionRaw(-1, 0)) va...
Explain and rewrite the following Scala code:
package com.awesomesauce.minecraft.forge.openautomation.api.lasers import net.minecraft.world.World import net.minecraftforge.common.util.ForgeDirection trait PingSender { def pingArrive(world: World, x: Int, y: Int, z: Int, to: ForgeDirection) }
Explain and rewrite the following Scala code:
/* * Copyright (c) 2012, TU Berlin * 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...
Explain and rewrite the following Scala code:
///* // * @author Genc Mazlami // * // * Copyright 2013 University of Zurich // * // * 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/...
Explain and rewrite the following Scala code:
package acolyte.reactivemongo import scala.util.Try import reactivemongo.io.netty.channel.ChannelId import reactivemongo.acolyte.Response /** * Creates a write response for given channel ID and result. * @tparam T Result type */ trait WriteResponseMaker[T] extends ((ChannelId, T) ⇒ Option[Try[Response]]) { /**...
Explain and rewrite the following Scala code:
/* * Licensed to Metamarkets Group Inc. (Metamarkets) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. Metamarkets licenses this file * to you under the Apache License, Version 2.0 (the * "License"); ...
Explain and rewrite the following Scala code:
/* * Copyright (c) 2013, Scodec * 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...
Explain and rewrite the following Scala code:
package com.twitter.finatra.http.test import com.fasterxml.jackson.databind.JsonNode import com.fasterxml.jackson.databind.node.ObjectNode import com.twitter.finatra.json.FinatraObjectMapper import com.twitter.finatra.test.EmbeddedTwitterServer import com.twitter.logging.Logger import java.net.URLEncoder import java.u...
Explain and rewrite the following Scala code:
import sbt._ import sbt.Keys._ import com.typesafe.sbt.SbtScalariform._ object RxScalaDemoBuild extends Build { import Resolvers._ lazy val buildSettings = Seq( organization := "com.mattrjacobs", version := "0.1-SNAPSHOT", scalaVersion := "2.10.2" ) lazy val demo = Project( id = "rxScalaDem...
Explain and rewrite the following Scala code:
package org.geneticmachine.navigation.algorithm import breeze.linalg.{ Vector => BreezeVector, _ } import org.geneticmachine._ import org.geneticmachine.common.graph.{GraphBuilder, Graph} import org.geneticmachine.genetic.AdaptiveEvolution import org.geneticmachine.navigation._ import scala.collection.parallel.immuta...
Explain and rewrite the following Scala code:
/* Copyright 2014 - 2015 Janek Bogucki 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 o...
Explain and rewrite the following Scala code:
/* * Copyright 2016 Groupon, 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:
/* * 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 not u...
Explain and rewrite the following Scala code:
package controllers import net.koofr.play.ws._ object ExampleServiceController extends WSController { def getService() = { new ExampleService() } def getScheme() = { "http" } def getHost() = { "localhost" } def getPort() = { 9000 } def getContextPath() = { "example-service/"...
Explain and rewrite the following Scala code:
/* * Copyright 2009-2010 LinkedIn, 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 ...
Explain and rewrite the following Scala code:
package objektwerks.app import cats.effect.{ExitCode, IO, IOApp} import java.time.{LocalDate, LocalTime} object CatsApp extends IOApp { def run(args: List[String]): IO[ExitCode] = IO { println(s"*** Date: ${LocalDate.now()} Time: ${LocalTime.now()} ***") }.as(ExitCode.Success) }
Explain and rewrite the following Scala code:
object i1{import i1.i1 def i1={import _ import}}
Explain and rewrite the following Scala code:
package io.transwarp.midas.constant.midas.params /** * Created by tianming on 5/19/16. */ object ReadWriteParams { val Filename = "filename" val Overwrite = "overwrite" }
Explain and rewrite the following Scala code:
package qrhl.logic import qrhl.isabellex.{IsabelleConsts, IsabelleX} import IsabelleX.{globalIsabelle => GIsabelle} import de.unruh.isabelle.pure.{App, Const, Free, Term, Typ} import hashedcomputation.{Hash, HashTag, Hashable, HashedValue, RawHash} import qrhl.AllSet import scala.collection.immutable.ListSet import s...
Explain and rewrite the following Scala code:
package servlets import javax.servlet.http.HttpServlet import javax.servlet.http.HttpServletRequest import javax.servlet.http.HttpServletResponse class TestServlet extends HttpServlet { override def doGet( req: HttpServletRequest, res: HttpServletResponse ): Unit = { res.setStatus(200) } } cl...
Explain and rewrite the following Scala code:
package toledo17 import toledo17.visitors._ object Toledo17Visitors extends App { println("!Toledo17 Visitors!") new BetssonVisitor().visit new PinnacleVisitor().visit } // TODO // - inny serwis, który czyta z SQS i wkłada do DynamoDB // - matchowanie/scalanie nazw drużyn (w DynamoDB?) ręczne // - match...
Explain and rewrite the following Scala code:
package org.jetbrains.plugins.scala.lang.parameterInfo.functionParameterInfo package generated class FunctionParameterInfoUpdateTest extends FunctionParameterInfoTestBase { //This class was generated by build script, please don't change this override def folderPath: String = super.folderPath + "update/" def tes...
Explain and rewrite the following Scala code:
/* * Copyright (c) 2013 Miles Sabin * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agree...
Explain and rewrite the following Scala code:
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you ...
Explain and rewrite the following Scala code:
package com.sksamuel.elastic4s.requests.searches.aggs.builders import com.sksamuel.elastic4s.handlers.searches.queries import com.sksamuel.elastic4s.handlers.searches.queries.QueryBuilderFn import com.sksamuel.elastic4s.json.{XContentBuilder, XContentFactory} import com.sksamuel.elastic4s.requests.searches.aggs.{AggMe...
Explain and rewrite the following Scala code:
/* * Copyright 2016 rdbc contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agre...
Explain and rewrite the following Scala code:
import lean1.{Car, Shiny} /** * Created by oot on 2014/11/18. */ class Benz extends Car with Shiny{ val brand = "Benz" val shineRefraction = 12 }
Explain and rewrite the following Scala code:
package dk.tennisprob.tournament import dk.bayes.model.clustergraph.factor.Factor import dk.bayes.model.clustergraph.factor.MultiFactor import java.util.concurrent.atomic.AtomicInteger import scala.annotation.tailrec import dk.bayes.model.clustergraph.factor.Var import dk.bayes.model.clustergraph.factor.SingleF...
Explain and rewrite the following Scala code:
package debop4s.core.concurrent import java.util.concurrent.{ConcurrentLinkedQueue, RejectedExecutionException} import debop4s.core.AbstractCoreFunSuite import org.scalatest.Ignore import scala.collection.mutable import scala.concurrent.ExecutionContext.Implicits.global import scala.concurrent.{Future, Promise} impo...
Explain and rewrite the following Scala code:
/*********************************************************************** * Copyright (c) 2013-2020 Commonwealth Computer Research, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Apache License, Version 2.0 * which accompanies this distribution and...
Explain and rewrite the following Scala code:
case class Container(innerValue: Int) object onemorelayer { /*inThisScope*/ class OutmostScope { val outerScope = new { val innerScope = Container(1) /*start*/innerScope.innerValue/*end*/ } } } /* case class Container(innerValue: Int) object onemorelayer { class OutmostScope { val oute...
Explain and rewrite the following Scala code:
/** * Copyright 2010-2012 Alex Jones * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with work for additional information * regarding copyright ownership. The ASF licenses file * to you under the Apache License, Version ...
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 de.johoop.xplane.util package object math { case class Vector3d(x: Double, y: Double, z: Double) def ramerDouglasPeucker(vs: Vector[Vector3d], epsilon: Double): Vector[Vector3d] = { assert(vs.size >= 2, "This algorithm requires at least two points as input.") val a1 = vs.head val a2 = vs.last...
Explain and rewrite the following Scala code:
package org.mitre.mandolin.mx /** * Local (non-Spark) use of Mandolin with MXNet */ package object standalone { }
Explain and rewrite the following Scala code:
package com.crackcell.jiezi.domain import org.json4s.JsonDSL._ /** * 分词结果 * * @author Menglong TAN */ case class Result(terms: Array[Term] = Array()) extends Serializable with Iterable[Term] with ToJson { override def iterator = terms.iterator override def jsonValue = ("terms" -> terms.map(_.jsonValue).t...
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:
/* * Copyright © 2014 TU Berlin (emma@dima.tu-berlin.de) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by app...
Explain and rewrite the following Scala code:
/* * Copyright (C) 2017 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:
/* * Copyright (C) 2018 Lightbend Inc. <https://www.lightbend.com> * Copyright (C) 2017-2018 Alexis Seigneurin. * * 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 o...
Explain and rewrite the following Scala code:
/* --------------------------------------------------------------------- %% %% Copyright (c) 2007-2014 Basho Technologies, Inc. All Rights Reserved. %% %% This file is provided to you under the Apache License, %% Version 2.0 (the "License"); you may not use this file %% except in compliance with the License. You may ...
Explain and rewrite the following Scala code:
package com.twitter.finagle.server import com.twitter.finagle.Stack.Params import com.twitter.finagle._ import com.twitter.finagle.transport.Transport import com.twitter.finagle.dispatch.SerialServerDispatcher import com.twitter.finagle.netty3.Netty3Listener import com.twitter.io.Charsets import org.jboss.netty.channe...
Explain and rewrite the following Scala code:
package com.mizhi.nlp.stemmers.huskpaice import com.mizhi.nlp.stemmers.huskpaice.RuleAction._ import org.mockito.Mockito.{doReturn, spy} class RuleSpec extends UnitSpec { val rule = Rule("suffix", None, true, stop) describe("execute") { val state = ExecutionState(Word("asuffix", true), None) describe("w...
Explain and rewrite the following Scala code:
/* * This file is part of Apparat. * * Copyright (C) 2010 Joa Ebert * http://www.joa-ebert.com/ * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the Lice...
Explain and rewrite the following Scala code:
// Copyright (C) 2016 IBM Corp. All Rights Reserved. // See the LICENCE.txt file distributed with this work for additional // information regarding copyright ownership. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may ob...
Explain and rewrite the following Scala code:
package org.tribbloid.spookystuff.dsl import org.tribbloid.spookystuff.actions.Trace import org.tribbloid.spookystuff.utils.Utils /** * Created by peng on 9/12/14. */ sealed abstract class TraceEncoder[T] extends (Trace => T) with Serializable object Verbose extends TraceEncoder[String] { override def apply(tra...
Explain and rewrite the following Scala code:
package code.api.core import net.liftweb.http._ import net.liftweb.http.rest._ import net.liftweb.json.JsonAST.{JString,JValue} import scala.xml.Elem import net.liftweb.common.Full import code.api.common._ object BootRest extends RestHelper { val apiPackage = "code.api." serve { case Req(ver :: appName :: _, ...
Explain and rewrite the following Scala code:
package com.softwaremill.codebrag.service.events import _root_.akka.actor.Actor import com.softwaremill.codebrag.common.Event import com.typesafe.scalalogging.slf4j.Logging class EventLogger extends Actor with Logging { def receive = { case (e: Event) => logger.debug(e.toString) } }
Explain and rewrite the following Scala code:
/* * Copyright (c) 2014-2018 by The Monix Project Developers. * See the project homepage at: https://monix.io * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache...
Explain and rewrite the following Scala code:
package mesosphere.marathon.upgrade import akka.actor.{ Actor, ActorLogging } import akka.event.EventStream import mesosphere.marathon.SchedulerActions import mesosphere.marathon.event.{ HealthStatusChanged, MarathonHealthCheckEvent, MesosStatusUpdateEvent } import mesosphere.marathon.state.AppDefinition import mesosp...
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 chapter.nineteen import scala.util.parsing.combinator.RegexParsers object ExerciseOne { class ExprParser extends RegexParsers { val number = "[0-9.]+".r def expr: Parser[Double] = term ~ opt(("+" | "-") ~ expr) ^^ { case t ~ None => t case t ~ Some("+" ~ f) => t + f case t ~ Some...
Explain and rewrite the following Scala code:
package sctags case class Tag(val name: String, pos: Position, fields: Product2[String, String]*) { private def fieldString(field: Product2[String, String]): String = field._1 + ":" + escapeValue(field._2) private def escapeValue(value: String): String = (value.foldLeft(new StringBuilder) { (b, c) => c m...
Explain and rewrite the following Scala code:
package spark.timeseries import spark._ import spark.SparkContext._ import scala.collection.mutable.ArrayBuffer /** * Bucket supercomputer logs (such as [[http://www.cs.sandia.gov/~jrstear/logs/]]) * into (hour,node)(message) buckets. * */ object BucketLogsByHour { /** * Runs Spark with the master `args(0)...
Explain and rewrite the following Scala code:
package org.modelfun.conf /** * mix between parameters and functions. */ trait Conf { def has(name: Symbol): Boolean def apply(name: Symbol, default: Double = 0.0, context: Conf): Double def + (that: Conf): Conf = ChainedConf(that, this) }
Explain and rewrite the following Scala code:
package util import org.specs2.mutable._ import org.specs2.matcher.DataTables class IpAddressSpec extends Specification with DataTables { "IpAddress conversions" should { "support converting string addresses to long" >> { "address" || "long" | "170.112.108.147" !! 2859494547L | ...
Explain and rewrite the following Scala code:
package org.jetbrains.plugins.scala package lang package psi package stubs package index import com.intellij.psi.PsiClass import com.intellij.psi.stubs.StringStubIndexExtension /** * @author ilyas */ class ScShortClassNameIndex extends StringStubIndexExtension[PsiClass] { def getKey = ScShortClassNameIndex.KEY } ...
Explain and rewrite the following Scala code:
val mitad = if (n%2 == 0) n/2 else throw new RuntimeException("n debe ser par")
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 com.twitter.finatra.http.integration.requestscope import com.twitter.finagle.http.Status._ import com.twitter.finagle.http.{Request, Response} import com.twitter.finagle.{Service, SimpleFilter} import com.twitter.finatra.conversions.time._ import com.twitter.finatra.http.filters.ExceptionBarrierFilter import c...
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 ru.pavkin.todoist.api.core.dto import ru.pavkin.todoist.api.core.IsResourceId case class AddTask[T: IsResourceId](content: String, project_id: T, date_string: Option[String] = None, date_lang: Option[St...
Explain and rewrite the following Scala code:
import sbt._ import sbt.Keys._ import scoverage.ScoverageSbtPlugin._ import scoverage.ScoverageSbtPlugin object GemFireSparkConnectorBuild extends Build { import Settings._ import Dependencies._ lazy val root = Project( id = "root", base =file("."), aggregate = Seq(gemfireFunctions, gemfireSparkC...
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 opencl.generator import ir._ import ir.ast._ import lift.arithmetic.SizeVar import opencl.executor.{Execute, Executor, TestWithExecutor} import opencl.ir._ import opencl.ir.pattern._ import org.junit.Assert._ import org.junit.Test object TestUnsafeArrayAccess extends TestWithExecutor class TestUnsafeArrayAcc...
Explain and rewrite the following Scala code:
package io.getquill.postgres import io.getquill.MonixSpec import monix.eval.Task class MonixJdbcContextSpec extends MonixSpec { val context = testContext import testContext._ "provides transaction support" - { "success" in { (for { _ <- testContext.run(qr1.delete) _ <- testContext.tr...
Explain and rewrite the following Scala code:
package org.danielnixon.progressive.shared /** * Wart names for use with SuppressWarnings annotation. */ object Wart { final val Any = "org.wartremover.warts.Any" final val AsInstanceOf = "org.wartremover.warts.AsInstanceOf" final val Nothing = "org.wartremover.warts.Nothing" final val OptionPartial = "org...
Explain and rewrite the following Scala code:
package models import scala.slick.driver.MySQLDriver.simple._ // Definition of the corpus table class Corpora(tag: Tag) extends Table[Corpus](tag, "corpora") { def id = column[Long]("id", O.PrimaryKey, O.AutoInc) // This is the primary key column def datum = column[String]("datum") // Every table needs a * proj...
Explain and rewrite the following Scala code:
package com.collinvandyck.hornet trait HornetConsumer { /** * As items come off of the queue, the server will pass them onto the consumer. The * consumer will be responsible for acknowleging or acknowleding-and-requeing the * message for success and failure conditions, respectively */ def consume(mess...
Explain and rewrite the following Scala code:
// Copyright: 2010 - 2017 https://github.com/ensime/ensime-server/graphs // License: http://www.gnu.org/licenses/gpl-3.0.en.html package org.ensime.indexer import java.util.UUID import akka.actor.Actor import akka.event.slf4j.SLF4JLogging import org.apache.commons.vfs2._ import org.ensime.api._ import org.ensime.conf...
Explain and rewrite the following Scala code:
package bubblewrap import java.io.ByteArrayOutputStream import java.util.regex.Pattern import org.apache.commons.io.IOUtils import org.jsoup.Jsoup import org.jsoup.nodes.{Document, Element} import scala.collection.JavaConversions._ import scala.util.Try case class Content(url: WebUrl, content: Array[Byte], contentT...
Explain and rewrite the following Scala code:
/* * Copyright (C) Lightbend Inc. <https://www.lightbend.com> */ package play.api.cache import java.util.concurrent.Callable import java.util.concurrent.CompletableFuture import java.util.Optional import akka.util.Timeout import org.specs2.concurrent.ExecutionEnv import org.specs2.execute.AsResult import play.api....
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 ohnosequences.bio4j.bundles import shapeless._ import shapeless.ops.hlist._ import ohnosequences.typesets._ import ohnosequences.statika._ import ohnosequences.statika.aws._ import ohnosequences.statika.ami._ import ohnosequences.bio4j.statika._ import ohnosequences.awstools.s3._ import ohnosequences.awstools....
Explain and rewrite the following Scala code:
package com.azavea.gtfs.io.csv import com.azavea.gtfs._ import scala.collection.mutable object CalendarDatesFile extends GtfsFile[CalendarDateRecord] { val fileName = "calendar_dates.txt" val isRequired = false def parse(path: String): Seq[CalendarDateRecord] = (for(c <- CsvParser.fromPath(path)) yield { ...
Explain and rewrite the following Scala code:
package com.socrata.testcommon package mocks.util import scala.collection.JavaConverters._ import java.nio.charset.{Charset, StandardCharsets} import javax.servlet.ServletOutputStream import javax.servlet.http.HttpServletResponse import UnusedSugarCommon._ // scalastyle:off number.of.methods class OutputStreamServl...
Explain and rewrite the following Scala code:
package com.dexterslab.tictactoe object DataTypes { sealed trait Player case object PlayerX extends Player case object PlayerO extends Player sealed trait MoveResult case object InvalidMove extends MoveResult case class SuccessfulMove(board: HasBeenPlayed) extends MoveResult case class Position(x: Int...
Explain and rewrite the following Scala code:
package test import play.api.cache.CacheApi import scala.concurrent.duration.Duration /** * This solves Cache Exceptions. * http://stackoverflow.com/questions/31041842/error-with-play-2-4-tests-the-cachemanager-has-been-shut-down-it-can-no-longe * @author Camilo Sampedro <camilo.sampedro@udea.edu.co> */ clas...
Explain and rewrite the following Scala code:
/* * Copyright 2015 ligaDATA * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in ...
Explain and rewrite the following Scala code:
package com.socrata.internal.http import com.socrata.internal.http.pingpong.PingInfo /** A class for storing in a curator service advertisement's payload field. * All fields of this class must be (de)serializable by Jackson. */ class AuxiliaryData(var pingInfo: Option[PingInfo]) { @deprecated(message = "This cons...
Explain and rewrite the following Scala code:
package com.github.agourlay.cornichon.experimental.sbtinterface import java.util.concurrent.atomic.AtomicBoolean import com.github.agourlay.cornichon.feature.BaseFeature import sbt.testing._ import scala.concurrent.Await import scala.concurrent.duration.Duration class CornichonRunner(val args: Array[String], val re...
Explain and rewrite the following Scala code:
package com.datastax.spark.connector.rdd import java.io.IOException import com.datastax.driver.core.{Metadata, ConsistencyLevel} import com.datastax.spark.connector._ import com.datastax.spark.connector.cql.{TableDef, CassandraConnector, Schema} import com.datastax.spark.connector.rdd.reader._ import com.datastax.spa...
Explain and rewrite the following Scala code:
/* * Copyright (C) 2011-2019 org.bayswater * * 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 org.typedsolutions.aws.kinesis import akka.actor.ActorRef import akka.actor.Deploy import akka.actor.ExtendedActorSystem import akka.actor.Props import akka.io.IO import org.typedsolutions.aws.util.ActorNaming._ class KinesisExt(system: ExtendedActorSystem) extends IO.Extension { override val manager: Actor...
Explain and rewrite the following Scala code:
package com.sageserpent.plutonium import com.sageserpent.americium.randomEnrichment._ import scala.util.Random import scalaz.std.stream object intersperseObsoleteEvents { type EventId = Int def mixUpEnsuringObsoleteThingsAreEventuallySucceededByFinalThings[ EventRelatedThing](random: Random, ...
Explain and rewrite the following Scala code:
/* * GNU GENERAL PUBLIC LICENSE * Version 2, June 1991 * * Copyright (C) 1989, 1991 Free Software Foundation, Inc., <http://fsf.org/> * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Everyone is permitted to copy and distribute verbatim copies * of this license document, ...
Explain and rewrite the following Scala code:
package net.martinsnyder.scalamud import java.lang.String class MessageBag(actorMsg: String, targetMsg: String, witnessMsg: String) { def formatFor(recipient: Mobile, actor: Mobile, target: AddressableObject, extra: String) = { val fmt = recipient match { case a if a == actor => actorMsg case t if t == ta...
Explain and rewrite the following Scala code:
package io.callate.model import java.io.{InputStream, FileOutputStream, BufferedOutputStream, File} import java.net.URL import java.nio.file.{Path, Files} import scala.sys.process._ object Utils { def fileDownloader(url: String, filename: String) = { new URL(url) #> new File(filename) !! } def fileDownloa...