instruction
stringclasses
1 value
output
stringlengths
5
1M
Explain and rewrite the following Scala code:
package quizleague.web.site.home import quizleague.web.core._ import quizleague.web.site.ApplicationContextService import quizleague.web.site.fixtures.FixturesService import com.felstar.scalajs.vue.VueComponent import quizleague.web.model.Season import scalajs.js import js.timers._ import com.felstar.scalajs.vue.Vue...
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.runtime.java8 @...
Explain and rewrite the following Scala code:
package iot.pood.management.repository import iot.pood.base.log.Log import iot.pood.management.dao.Dao import iot.pood.management.dao.internal.{MongoDao, MongoRepositoryCreator} import iot.pood.management.model.DeviceModel.{DashBoard, Device, DeviceGroup, DeviceModelConverter} import iot.pood.management.model.UserMode...
Explain and rewrite the following Scala code:
class C
Explain and rewrite the following Scala code:
package ch.becompany.social import java.time.Instant import akka.actor.ActorSystem import akka.stream.scaladsl.Source import akka.pattern.after import scala.concurrent.Future import scala.concurrent.duration.FiniteDuration import scala.concurrent.ExecutionContext.Implicits.global import scala.util.{Failure, Try} /*...
Explain and rewrite the following Scala code:
/* ************************************************************************************* * Copyright 2011 Normation SAS ************************************************************************************* * * This file is part of Rudder. * * Rudder is free software: you can redistribute it and/or modify * it under the...
Explain and rewrite the following Scala code:
/* * Copyright 2019 http4s.org * * 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:
package net.paploo.orbital.app import net.paploo.orbital.rocket._ import net.paploo.orbital.phys.{ State, PhysVec } import net.paploo.orbital.planetarysystem.Planetoid import net.paploo.orbital.rocket.blackbox.BlackBox object SampleLibrary { /** * Basic orbit * * Do one 70km apoapsis, 77.14km periapsis...
Explain and rewrite the following Scala code:
package controllers import javax.inject.Inject import com.mohiva.play.silhouette.api.{ LogoutEvent, Silhouette } import com.mohiva.play.silhouette.impl.providers.SocialProviderRegistry import play.api.i18n.{ I18nSupport, Messages, MessagesApi } import play.api.mvc.Controller import scala.concurrent.Future import sc...
Explain and rewrite the following Scala code:
package org.opencoin.core.token case class BlindSignature( `type`: String = "blind signature", reference: Int, blind_signature: BigInt) { require(`type` == "blind signature", "Parameter 'type' is invalid.") require(reference > 0, "Parameter 'reference' is invalid.") require(blind_signature > 0, "Pa...
Explain and rewrite the following Scala code:
/* __ *\ ** ________ ___ / / ___ __ ____ Scala.js Test Suite ** ** / __/ __// _ | / / / _ | __ / // __/ (c) 2013, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ |/_// /_\ \ http://scala-js.org/ ** ** /____/\___/_/ |_/...
Explain and rewrite the following Scala code:
/** * Copyright (C) 2009-2017 Lightbend Inc. <http://www.lightbend.com> */ package akka.util import scala.collection.immutable /** * Typeclass which describes a classification hierarchy. Observe the contract between `isEqual` and `isSubclass`! */ trait Subclassification[K] { /** * True if and only if x and y...
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:
/* * (c) Copyright 2016 Hewlett Packard Enterprise Development LP * * 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 b...
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 sledtr.util import org.scalatest.FunSuite class Sha1Test extends FunSuite { test("sha1の取得") { assert(new Sha1Digest("aiueo").p== new Sha1Digest("aiueo").p) assert(new Sha1Digest("aiueo").p != new Sha1Digest("aiueo1").p) println(new Sha1Digest("aiuoeo").p) } }
Explain and rewrite the following Scala code:
package org.jetbrains.plugins.scala.lang.resolve import org.jetbrains.plugins.scala.{LatestScalaVersions, ScalaVersion} import org.jetbrains.plugins.scala.base.ScalaLightCodeInsightFixtureTestAdapter import org.jetbrains.plugins.scala.settings.ScalaProjectSettings class ExportsResolveTest extends ScalaLightCodeInsight...
Explain and rewrite the following Scala code:
package com.datayumyum.helloPOS import android.view.{MotionEvent, View} import android.widget.AdapterView.OnItemLongClickListener import android.widget.{AdapterView, ListView} object EventHandlers { implicit class ViewOnEventHandlers(view: View) { def onClick(action: => Unit): Unit = { view.setOnClickLis...
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 com.sksamuel.elastic4s.explain import com.sksamuel.elastic4s.DocumentRef trait ExplainApi { def explain(ref: DocumentRef): ExplainDefinition = ExplainDefinition(ref.indexAndType, ref.id) def explain(index: String, `type`: String, id: String): ExplainDefinition = explain(DocumentRef(index, `type`, id)) }
Explain and rewrite the following Scala code:
package sfc.board import sfc.pieces.Tile._ import sfc.pieces.Chits import sfc.placement.{VertexOrientation, ChevronPosition, HexagonPosition, Coordinate} import sfc.placement.VertexOrientation._ import sfc.placement.VertexOrientation.VertexOrientation /** * @author noel.yap@gmail.com */ // TODO: use config file obj...
Explain and rewrite the following Scala code:
package hephaestus package lunarg package tutorial import hephaestus.platform._ import java.nio._ /** Draws a coloured cube using a staging buffer */ object Step19 extends Utils { def main(args: Array[String]): Unit = { glfw.init() val instance = initInstanceExtensionsDump() glfw.windowHint(GLFW.CLIE...
Explain and rewrite the following Scala code:
/** * Copyright 2017 Jose Cardona * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, ...
Explain and rewrite the following Scala code:
/* * Copyright 2016 The BigDL Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agr...
Explain and rewrite the following Scala code:
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may ...
Explain and rewrite the following Scala code:
/** * Copyright 2009 Jorge Ortiz * * 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:
package grover.model import com.wordnik.swagger.annotations.{ApiModelProperty, ApiModel} import spray.json.DefaultJsonProtocol import scala.annotation.meta.field @ApiModel(description = "Grover result") case class GroverResult( @(ApiModelProperty @field)(value = "result surface plot") ...
Explain and rewrite the following Scala code:
package org.json4s class JacksonUseCompanionCtorSpec extends UseCompanionConstructors[JValue]("Jackson") with jackson.JsonMethods
Explain and rewrite the following Scala code:
package com.typesafe.akka.sample.softrank import org.specs2.mutable.SpecificationWithJUnit import akka.agent.Agent import akka.pattern.ask import scala.concurrent.Await import com.typesafe.akka.sample.softrank.Softrank import com.typesafe.akka.sample.softrank.Result class RankSpec extends SpecificationWithJUnit { ...
Explain and rewrite the following Scala code:
package scalax.chart package build import sbt._ import Keys._ object ProjectDescription { val projectDescription = Seq ( description := "Scala Chart Library", homepage := Some(url("https://github.com/wookietreiber/scala-chart")), startYear := Some(2012), licenses := Seq ( "GNU Lesser General P...
Explain and rewrite the following Scala code:
package io.swagger.client import com.ning.http._ import client._ import client.{ Cookie => AhcCookie } import collection.JavaConverters._ import java.util.{TimeZone, Date, Locale} import java.util.concurrent.ConcurrentHashMap import io.Codec import java.nio.charset.Charset import java.io.File import java.net.URI impor...
Explain and rewrite the following Scala code:
package com.socrata.soda.server.resources import java.net.URI import java.util.concurrent.Executors import javax.servlet.http.{HttpServletRequest, HttpServletResponse => HttpStatus} import com.rojoma.json.v3.ast.{JNull, JObject, JString} import com.rojoma.json.v3.util.JsonUtil import com.rojoma.simplearm.v2._ import ...
Explain and rewrite the following Scala code:
package org.joda.time.chrono import java.util.concurrent.ConcurrentHashMap import org.joda.time.Chronology import org.joda.time.DateTimeConstants import org.joda.time.DateTimeZone import GregorianChronology._ import org.joda.time.chrono.AssembledChronology.Fields object GregorianChronology { private final val cCac...
Explain and rewrite the following Scala code:
package org.broadinstitute.dsde.firecloud.component import org.openqa.selenium.WebDriver case class TabBar(private val queryString: QueryString = TestId("tabs"))(implicit webDriver: WebDriver) extends Component(queryString) { def goToTab(name: String): Unit = { awaitReady() Link(s"$name-tab" inside this).d...
Explain and rewrite the following Scala code:
package lila.tournament import org.joda.time.DateTime import reactivemongo.bson._ import reactivemongo.core.commands._ import BSONHandlers._ import lila.db.BSON._ import lila.db.Implicits._ import lila.rating.Perf import lila.user.{ User, Perfs } object PlayerRepo { private lazy val coll = Env.current.playerColl ...
Explain and rewrite the following Scala code:
/* * Copyright (C) 2016 Nikos Katzouris * * 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 program is d...
Explain and rewrite the following Scala code:
package doobie.contrib.postgresql.free import scalaz.{ Catchable, Free => F, Kleisli, Monad, ~>, \\/ } import scalaz.concurrent.Task import doobie.util.capture._ import org.postgresql.copy.CopyIn import org.postgresql.copy.CopyOut import copyin.CopyInIO import copyout.CopyOutIO /** * Algebra and free monad for pr...
Explain and rewrite the following Scala code:
package functional import java.util.UUID import com.mohiva.play.silhouette.api.LoginInfo import com.mohiva.play.silhouette.api.repositories.AuthInfoRepository import com.mohiva.play.silhouette.api.util.{PasswordHasher, PasswordInfo} import com.mohiva.play.silhouette.impl.authenticators.CookieAuthenticator import com....
Explain and rewrite the following Scala code:
import play.twirl.api.{Xml, Txt, Html} import akka.http.scaladsl.marshalling.{Marshaller, ToEntityMarshaller} import akka.http.scaladsl.model.MediaTypes._ import akka.http.scaladsl.model.ContentType trait TwirlSupport { //https://github.com/btomala/akka-http-twirl /** Serialize Twirl `Html` to `text/html`. */ i...
Explain and rewrite the following Scala code:
package com.twitter.finagle import com.twitter.concurrent.NamedPoolThreadFactory import java.util.concurrent.Executors import org.jboss.netty.util.{ThreadNameDeterminer, ThreadRenamingRunnable} /** * Package netty3 implements the bottom finagle primitives: * {{com.twitter.finagle.Server}} and a client transport in...
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:
/* * 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 de.sciss.fscape package tests import de.sciss.audiofile.{AudioFile, AudioFileSpec} import de.sciss.file._ import de.sciss.fscape.Ops._ import de.sciss.fscape.gui.SimpleGUI import scala.swing.Swing object SlicesTest extends App { def any2stringadd: Any = () val dir = userHome / "Music" / "work" val...
Explain and rewrite the following Scala code:
/* * Copyright (C) 2013-2015 by Michael Hombre Brinkmann */ package net.twibs.util import java.io.InputStream trait Upload { val id: String = IdGenerator.next() def name: String def size: Long def stream: InputStream def mimeTypeString: String = ApplicationSettings.tika.detect(stream, name) def si...
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 (c) 2015 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 agreed...
Explain and rewrite the following Scala code:
package org.brzy.webapp.action.args import org.scalatest.{WordSpec, FlatSpec} import org.springframework.mock.web.{MockServletContext, MockHttpServletRequest} import org.scalatest.matchers.ShouldMatchers class ArgsBuilderSpec extends WordSpec with ShouldMatchers with Fixtures { "A ArgsBuilder" should { "creat...
Explain and rewrite the following Scala code:
package io.github.tailhq.dynaml.graphics.plot3d import org.jzy3d.analysis.AbstractAnalysis import org.jzy3d.chart.factories.AWTChartComponentFactory import org.jzy3d.maths.Coord3d import org.jzy3d.maths.algorithms.interpolation.algorithms.BernsteinInterpolator import org.jzy3d.plot3d.primitives.{LineStripInterpolated,...
Explain and rewrite the following Scala code:
/* * Copyright (c) 2019. Yuriy Stul */ package com.stulsoft.poc.scala.jmx /** * @author Yuriy Stul */ class Hello(var message: String) extends HelloMBean { def this() { this("Hello, world") } override def setMessage(message: String): Unit = this.message = message override def getMessage(): String...
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:
/* * Copyright 2016 The BigDL Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agr...
Explain and rewrite the following Scala code:
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may n...
Explain and rewrite the following Scala code:
package com.sprayakkarest.akka.actor import akka.actor._ import scala.concurrent.Future import scala.concurrent.Await import akka.util.Timeout import akka.pattern.ask import scala.concurrent.duration._ class RuleProcessor(timeout: Timeout) extends Actor { import com.sprayakkarest.akka.model.ProcessMod...
Explain and rewrite the following Scala code:
/* * Copyright 2014–2017 SlamData Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agr...
Explain and rewrite the following Scala code:
package chat import akka.actor._ import akka.cluster._ import akka.remote._ import ActivatePersistenceContext._ import akka.remote.AssociationErrorEvent object Main { def main(args: Array[String]): Unit = { val systemName = "ChatApp" val system1 = ActorSystem(systemName) val cluster = Cluster(syste...
Explain and rewrite the following Scala code:
object Generators { trait Tree case class Inner(left: Tree, right: Tree) extends Tree case class Leaf(x: Int) extends Tree trait Generator[+T] { self => def generate: T def map[S](f: T => S): Generator[S] = new Generator[S] { def generate = f(self.generate) } def flatMap[...
Explain and rewrite the following Scala code:
package lv.ddgatve.velesanas.cleanup import org.specs2.mutable._ class ConfigurationReaderSpec extends Specification { val configFile = "/home/kalvis/workspace/ddgatve-screenscrapers/src/test/resources/saeima-config.xml" val regexTable = """(?s)(<TABLE BORDER=1>(.*)</TABLE>)""".r val fields = List("PreNum", "K...
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:
/* *\\ ** Link Tracker programming test ** ** https://github.com/cubean/linktracker.git ** \\* */ package code import scala.x...
Explain and rewrite the following Scala code:
package org.atnos.eff import cats._ import cats.syntax.all._ import Eff._ import EffCompat._ import scala.concurrent.duration.FiniteDuration /** * Effects of type R, returning a value of type A * * It is implemented as a "Free-er" monad with extensible effects: * * - the "pure" case is a pure value of type A ...
Explain and rewrite the following Scala code:
package controllers import configuration.ApplicationContext import models.{Authorization, AuthorizationRepository} import org.joda.time.DateTime import play.api.libs.json._ import play.api.mvc.{Action, BodyParsers, Controller} import scala.concurrent.ExecutionContext.Implicits.global import scala.concurrent.Future c...
Explain and rewrite the following Scala code:
def foo(l: Long) = () /* resolved: true, applicable: true */foo(0L)
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 software is licensed under the GNU Affero General Public License, quoted below. * * This file is a part of PowerAPI. * * Copyright (C) 2011-2016 Inria, University of Lille 1. * * PowerAPI is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public Lice...
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 jp.co.dwango.s99 import org.scalatest.{DiagrammedAssertions, FunSpec} class P17Spec extends FunSpec with DiagrammedAssertions { describe("P17") { it("for index less than 0, split(n, s) throws Exception") { intercept[Throwable] { P17.split(-1, List.empty[Int]) } intercept[Throwa...
Explain and rewrite the following Scala code:
/* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software ...
Explain and rewrite the following Scala code:
package com.twitter.finatra.benchmarks import com.twitter.finagle.http.{Method, Request, Response} import com.twitter.finatra.http.internal.routing.{Route, RoutingService} import com.twitter.util.Future import org.openjdk.jmh.annotations._ @State(Scope.Thread) class RoutingServiceBenchmark { def defaultCallback(re...
Explain and rewrite the following Scala code:
package org.http4s import cats.data.NonEmptyList import cats.implicits._ import fs2.interop.cats._ import org.scalacheck.Arbitrary import org.specs2.scalacheck.Parameters class UrlFormSpec extends Http4sSpec { // // TODO: arbitrary charsets would be nice // /* // * Generating arbitrary Strings valid in an arbitra...
Explain and rewrite the following Scala code:
package chapter3 sealed trait Tree[+A] case class Leaf[A](value: A) extends Tree[A] case class Branch[A](left: Tree[A], right: Tree[A]) extends Tree[A] /** * @author loustler * @since 07/16/2017 16:11 */ object Tree { // exercise 3.25 def size[A](t: Tree[A]): Int = t match { case Leaf(_) => 1 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 may ...
Explain and rewrite the following Scala code:
/* * Copyright 2017 HM Revenue & Customs * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or a...
Explain and rewrite the following Scala code:
/* * 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.keba.scala.bank.transactions import java.util.Date import com.keba.scala.bank.money.Money /** * Entry in transaction history of a bank account that describes * a deposit in the bank account's currency, that is non-foreign currency, * to the bank account * * @author alexp */ class DepositTrans...
Explain and rewrite the following Scala code:
// scala> typeOf[java.util.stream.Stream[_]].nonPrivateMember(TermName("map")).info // [R](x$1: java.util.function.Function[_ >: T, _ <: R])java.util.stream.Stream[R] // java.util.function.Function trait Fun[A, B] { def apply(x: A): B } // java.util.stream.Stream class S[T](x: T) { def map[R](f: Fun[_ >: T, _ <: R]):...
Explain and rewrite the following Scala code:
package com.nefariouszhen.khronos.engine import com.bazaarvoice.dropwizard.assets.{AssetsBundleConfiguration, AssetsConfiguration, ConfiguredAssetsBundle} import com.bazaarvoice.dropwizard.redirect.{RedirectBundle, UriRedirect} import com.bazaarvoice.dropwizard.webjars.WebJarBundle import com.fasterxml.jackson.annotat...
Explain and rewrite the following Scala code:
package com.automatak.render.dnp3.objects.groups import com.automatak.render.dnp3.objects.{SizedByVariation, ObjectGroup} object Group111 extends ObjectGroup { def objects = List(Group111AnyVar) def group: Byte = 111 def desc: String = "Octet String Event" def isEventGroup: Boolean = false } object Group111A...
Explain and rewrite the following Scala code:
package adtoyou.spark.analysis import com.redislabs.provider.redis.{RedisConfig, RedisNode} import org.apache.spark.Partitioner import redis.clients.util.JedisClusterCRC16 /** * Created by qiyu.wang on 2017/9/1. */ class SlotPartitioner(redisConfig: RedisConfig, numParts: Int) extends Partitioner { ...
Explain and rewrite the following Scala code:
package com.benkolera.Rt.Parser import org.specs2._ import scalaz._ import com.github.nscala_time.time.Imports._ import com.benkolera.Rt object TicketParserSpec extends mutable.Specification { import scala.io.Source val dtf = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss") val dtz = DateTimeZone.forOffsetHour...
Explain and rewrite the following Scala code:
package daos import scala.concurrent.Future import play.api.Play._ import play.api.libs.json._ import reactivemongo.core.commands.LastError import reactivemongo.bson._ import play.modules.reactivemongo.ReactiveMongoPlugin import play.modules.reactivemongo.json.collection.JSONCollection import playground.models._ i...
Explain and rewrite the following Scala code:
/* * Copyright 2016 the original author or 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 applica...
Explain and rewrite the following Scala code:
package leibniz package variance import leibniz.inhabitance.Proposition trait Invariant[F[_]] { F => import Invariant._ def apply[A, B](implicit ev: A =!= B): F[A] >~< F[B] def injective: Injective[F] = Injective.witness[F](F(Void.isNotAny).notEqual) def composePh[G[_]](G: Constant[G]): Constant[λ[x =>...
Explain and rewrite the following Scala code:
package com.goibibo.sqlshift.commons import java.sql.Types import org.apache.spark.sql.jdbc.{JdbcDialect, JdbcDialects} import org.apache.spark.sql.types.{DataType, IntegerType, LongType, MetadataBuilder} case object SqlShiftMySQLDialect extends JdbcDialect { override def canHandle(url: String): Boolean = url...
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 ma...
Explain and rewrite the following Scala code:
package at.nonblocking.cliwix.core import java.io.File import at.nonblocking.cliwix.core.expression.{ExpressionResolver, ExpressionGenerator} import at.nonblocking.cliwix.core.interceptor.ReplaceIdsInPortletPreferencesInterceptor import at.nonblocking.cliwix.core.util.GroupUtil import at.nonblocking.cliwix.model._ im...
Explain and rewrite the following Scala code:
package cn.gridx.scala.lang.traits.advanced /** * Created by tao on 3/9/16. * * 输出为 * [cn.gridx.scala.lang.traits.advanced.Clz] Print : hello [cn.gridx.scala.lang.traits.advanced.Clz] Show : world [null] Print : 你好 [null] Print : 世界 [null] Print : aaaa */ object Instantiate extends Ap...
Explain and rewrite the following Scala code:
package com.git.huanghaifeng.spark.worldcount /** * @description * use scala, spark to count words * @version V1.0 * @author HHF * @url http://spark.apache.org/examples.html * @time 2016-5-18 */ import org.apache.spark.{SparkConf, SparkContext} object WordCount { def main(args: Array[String]) { val...
Explain and rewrite the following Scala code:
package com.danielwestheide.kontextfrei.syntax trait Imports extends DistributionOps with SyntaxSupport with DistributionSyntaxSupport object Imports extends Imports
Explain and rewrite the following Scala code:
package com.jantvrdik.scala.app import org.junit.Assert._ import org.junit.Test import scalafx.scene.paint.Color class GameModelTest { var model: GameModel = _ var winningRow: Row = _ @Test def testVictory() { val rows = List(List(Vector(0, 0, 0), Vector(0, 0, 1), Vector(0, 0, 2))) for (row <- rows...
Explain and rewrite the following Scala code:
package org.bitcoins.core.protocol.script import org.bitcoins.crypto.ECPublicKeyBytes import org.bitcoins.testkitcore.util.{BitcoinSUnitTest, TestUtil} /** Created by chris on 3/8/16. */ class MultiSignatureScriptPubKeyTest extends BitcoinSUnitTest { "MultiSignatureScriptPubKey" must "derive the amount of requir...
Explain and rewrite the following Scala code:
package eu.unicredit.dna.rre.example.model import eu.unicredit.dna.rre.Reaction /** * Created by IntelliJ IDEA. * User: frico * Date: 4/2/16 * Time: 17:05 */ case class SimpleReaction(description:String) extends Reaction
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.omegaup.data import java.sql._ object Validator extends Enumeration { type Validator = Value val Token = Value(1, "token") val TokenCaseless = Value(2, "token-caseless") val TokenNumeric = Value(3, "token-numeric") val TokenAbsoluteNumeric = Value(4, "token-absolute-numeric") val Custom = Value...
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:
case class Foo(x: Int, y: String) val x = Foo(1, "2") val y: (Int, String) = Tuple.fromProductTyped(x) case class Bar[I <: Int, S <: String](x: I, y: S) val a: Bar[1, "2"] = Bar(1, "2") val b: (1, "2") = Tuple.fromProductTyped(a)
Explain and rewrite the following Scala code:
package auctionHouse import akka.actor.Actor import akka.event.LoggingReceive class Seller(items: List[String]) extends Actor { println("Auctionsearch:" + context.actorSelection("../auctionSearch")) items.foreach(context.actorSelection("../auctionSearch") ! CreateAuction(_)) def receive = LoggingReceive { ...
Explain and rewrite the following Scala code:
// Project: sdocx // Module: word // Description: Trait and generators for table properties // Copyright (c) 2015 Johannes Kastner <jokade@karchedon.de> // Distributed under the MIT license. package biz.enef.sdocx.word.table import java.io.Writer import biz.enef.sdocx.opc.XMLSerializabl...
Explain and rewrite the following Scala code:
package org.jetbrains.plugins.scala.lang.autoImport package generated class AutoImportFixingImportTest extends AutoImportTestBase { //This class was generated by build script, please don't change this override def folderPath: String = super.folderPath + "fixingImport/" def testFixImport(): Unit = doTest() de...
Explain and rewrite the following Scala code:
/* * Copyright 2017 David Schmitz * * 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:
/* * 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...