instruction
stringclasses
1 value
output
stringlengths
5
1M
Explain and rewrite the following Scala code:
/* * (c) Copyright 2014 LinkedIn Corp. 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 ...
Explain and rewrite the following Scala code:
package fpinscala.parallelism import org.specs2.mutable._ import org.specs2.specification.AllExpectations import org.specs2.matcher.DataTables import org.specs2.runner.JUnitRunner import org.junit.runner.RunWith import java.util.concurrent._ import org.specs2.matcher.Matcher import fpinscala.parallelism.Utils._ @RunW...
Explain and rewrite the following Scala code:
package com.twitter.finagle.memcached.protocol import com.twitter.finagle.memcached.util.ChannelBufferUtils import com.twitter.util.Time import org.jboss.netty.buffer.ChannelBuffer /** * This trait contains cache command key validation logic. * The validation is done by searching each key channel buffer for invalid...
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:
/* * Copyright 2013 Akiyoshi Sugiki, University of Tsukuba * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by a...
Explain and rewrite the following Scala code:
package mevolutrix.Interface import java.util import CSON.CSONDocument import EntityAccess.{JSONSerializer, GeneralEntityToCSON} import EntityStore.Interface.{ResultFormat, IServiceAccessor} import HandlerSocket.Protocol.MySQLErrorCodes import akka.util._ import scala.concurrent.duration._ case class SAE_GetReq(appSp...
Explain and rewrite the following Scala code:
/* * Copyright (C) 2014 - 2016 Softwaremill <http://softwaremill.com> * Copyright (C) 2016 - 2019 Lightbend Inc. <http://www.lightbend.com> */ package akka.kafka.scaladsl import java.util.concurrent.atomic.AtomicLong import akka.Done import akka.kafka.ConsumerMessage.CommittableOffsetBatch import akka.kafka._ imp...
Explain and rewrite the following Scala code:
package vultura.factor import org.specs2._ import vultura.factor.generators._ class ProblemStructureTest extends Specification { override def is = { "neighbours on 2x2 grid" ^ "exclusive" ! (grid(2,2).neighboursOfVariableEx(0).toSet === Set(1,2)) ^ "inclusive" ! (grid(2,2).neighboursOfVariableInc(0...
Explain and rewrite the following Scala code:
package org.jetbrains.plugins.scala package lang package psi package api package statements import org.jetbrains.plugins.scala.lang.psi.api.base.ScPatternList import org.jetbrains.plugins.scala.lang.psi.api.base.patterns.ScBindingPattern import org.jetbrains.plugins.scala.lang.psi.api.expr.ScExpression /** * @author...
Explain and rewrite the following Scala code:
package com.twitter.finagle.filter import com.twitter.finagle.Service import com.twitter.finagle.stats.InMemoryStatsReceiver import com.twitter.util.{Stopwatch, Time, Future} import com.twitter.conversions.DurationOps._ import org.scalatest.funsuite.AnyFunSuite class ServerStatsFilterTest extends AnyFunSuite { test...
Explain and rewrite the following Scala code:
package io.udash.web.guide.demos.rpc import java.util.concurrent.TimeUnit import io.udash.web.SeleniumTest import org.openqa.selenium.WebElement class RpcFrontendTest extends SeleniumTest { val rpcFrontendUrl = "/rpc/server-client" "RpcFrontend view" should { driver.get(server.createUrl(rpcFrontendUrl)) ...
Explain and rewrite the following Scala code:
package org.jetbrains.plugins.scala.testingSupport.scalatest.scala2_10.scalatest2_1_7 import org.jetbrains.plugins.scala.testingSupport.scalatest.ScalaTestTestCase /** * @author Roman.Shein * @since 16.10.2014. */ abstract class Scalatest2_10_2_1_7_Base extends ScalaTestTestCase { /** * Intended for loading l...
Explain and rewrite the following Scala code:
/* ASIB - A Scala IRC Bot Copyright (C) 2012 Iain Cambridge 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. ...
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 controllers import com.google.inject.Inject import play.api.mvc.{Action, Controller} import uk.gov.dvla.vehicles.presentation.common.clientsidesession.ClientSideSessionFactory import uk.gov.dvla.vehicles.presentation.common.clientsidesession.CookieImplicits.RichCookies import uk.gov.dvla.vehicles.presentation....
Explain and rewrite the following Scala code:
package ch.wsl.box.rest.logic import akka.stream.Materializer import akka.stream.scaladsl.{Sink, Source} import ch.wsl.box.jdbc import ch.wsl.box.jdbc.{Connection, FullDatabase, PostgresProfile} import ch.wsl.box.model.shared._ import ch.wsl.box.rest.metadata.{EntityMetadataFactory, FormMetadataFactory} import scribe....
Explain and rewrite the following Scala code:
package ee.cone.c4gate.deep_session import ee.cone.c4gate.SessionDataProtocol._ import ee.cone.c4proto.{Id, protocol} @protocol("SessionDataProtocolApp") object DeepSessionDataProtocol { @Id(0x0110) case class U_RawUserData( @Id(0x0111) srcId: String, @Id(0x0112) userId: String, @Id(0x0113) dataNode:...
Explain and rewrite the following Scala code:
package controllers import play.api.data.Form import lila.api.Context import lila.app._ import lila.common.{ Captcha, LilaCookie, HTTPRequest } import lila.i18n.{ Translation, TransInfo } import views._ object I18n extends LilaController { private def env = Env.i18n def select = OpenBody { implicit ctx => ...
Explain and rewrite the following Scala code:
package org.rebeam.boxes.core.util import scala.math._ trait Sequence[T] { def previous(t: T): T def next(t: T): T } object Step { def apply[N](step: N)(implicit n: Numeric[N]) = new Step[N](step, n) } object LogStep { def apply(divisor: Double, minStep: Double = 0.01) = new LogStep(divisor, minStep) } cla...
Explain and rewrite the following Scala code:
package com.scalaAsm.x86 package Instructions package System // Description: Fast System Call // Category: general/branch trait SYSCALL extends InstructionDefinition { val mnemonic = "SYSCALL" } object SYSCALL extends ZeroOperands[SYSCALL] with SYSCALLImpl trait SYSCALLImpl extends SYSCALL { implicit object _0 ...
Explain and rewrite the following Scala code:
package org.keycloak.gatling import java.net.URLEncoder /** * @author <a href="mailto:mstrukel@redhat.com">Marko Strukelj</a> */ object Utils { def urlencode(url: String) = { URLEncoder.encode(url, "utf-8") } def urlEncodedRoot(url: String) = { URLEncoder.encode(url.split("/auth")(0), "utf-8") }...
Explain and rewrite the following Scala code:
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may ...
Explain and rewrite the following Scala code:
/* * Copyright 2001-2008 Artima, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agre...
Explain and rewrite the following Scala code:
package dotty.tools package dotc package parsing import scala.collection.mutable.ListBuffer import scala.collection.immutable.BitSet import util.{ SourceFile, SourcePosition } import Tokens._ import Scanners._ import MarkupParsers._ import core._ import Flags._ import Contexts._ import Names._ import ast.Positioned im...
Explain and rewrite the following Scala code:
package io.taig.gandalf.report.syntax import cats.data.Validated import io.taig.gandalf.Error import io.taig.gandalf.report._ import shapeless.HList import scala.language.implicitConversions trait report { implicit def reportErrorSyntax[N <: String, A <: HList]( error: Error[N, A] ): ops.reportError[N, A] = { ...
Explain and rewrite the following Scala code:
package org.jetbrains.sbt.shell import java.awt.BorderLayout import java.util import com.intellij.execution.Executor import com.intellij.execution.configurations.RemoteConnection import com.intellij.execution.console._ import com.intellij.execution.process.{ColoredProcessHandler, OSProcessHandler, ProcessHandler} imp...
Explain and rewrite the following Scala code:
// Copyright 2014 Foursquare Labs Inc. All Rights Reserved. package io.fsq.twofishes.indexer.scalding import com.twitter.scalding._ import com.twitter.scalding.typed.TypedSink import io.fsq.twofishes.gen._ import io.fsq.twofishes.indexer.util.SpindleSequenceFileSource import org.apache.hadoop.io.LongWritable class Ba...
Explain and rewrite the following Scala code:
/* * Copyright 2017 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:
/*********************************************************************** * 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:
package com.tvunetworks.scala.model import java.text.SimpleDateFormat import java.util.TimeZone import java.util.Date import java.util.Locale import com.tvunetworks.scala.util.StringUtil /** * @author RichardYao * @date 2017?5?3? */ class CloudLiveAccessLog(line: String) extends Serializable { require(line !=...
Explain and rewrite the following Scala code:
package peschke.markov.utils import cats.Show import cats.data.NonEmptyList import fs2.Stream import peschke.markov.utils.syntax._ import scala.language.higherKinds import scala.util.matching.Regex /** * Mostly for formatting the output, but it's also used a bit while processing the input. */ final case class Se...
Explain and rewrite the following Scala code:
/* # Copyright 2016 Georges Lipka # # 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 wri...
Explain and rewrite the following Scala code:
/* * sbt * Copyright 2011 - 2018, Lightbend, Inc. * Copyright 2008 - 2010, Mark Harrah * Licensed under Apache License 2.0 (see LICENSE) */ package sbt object ProjectSpec extends verify.BasicTestSuite { test("Project should normalize projectIDs if they are empty") { assert(Project.normalizeProjectID(emptyF...
Explain and rewrite the following Scala code:
package zeroformatter import scala.annotation.Annotation case class Index(value: Int) extends Annotation class ZeroFormattable extends Annotation
Explain and rewrite the following Scala code:
package so.eval.languages import so.eval.{ EvaluationRequest, SandboxedLanguage } case class FSharp(evaluation: EvaluationRequest) extends SandboxedLanguage { val extension = "fs" override lazy val filename = s"program.${extension}" override val compileCommand = Some(Seq("fsharpc", "--nologo", "-o", "a.exe", fil...
Explain and rewrite the following Scala code:
package com.eevolution.context.dictionary.domain.api.repository import com.eevolution.context.dictionary._ /** * Copyright (C) 2003-2017, e-Evolution Consultants S.A. , http://www.e-evolution.com * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Publi...
Explain and rewrite the following Scala code:
package sri.sangria.mobile.components import sri.sangria.mobile.routes.AppRouter.TodosPage import sri.universal.components._ import sri.universal.router import sri.universal.router.UniversalRouterComponent import sri.universal.styles.UniversalStyleSheet import sri.mobile.all._ import scala.scalajs.js.Dynamic.{literal ...
Explain and rewrite the following Scala code:
package io.vamp.model.parser import akka.parboiled2.{ CharPredicate, ErrorFormatter, ParseError, Rule1 } import scala.language.postfixOps import scala.util.{ Failure, Success } trait Parser[T] { def parse(expression: String): T = { val p = parser(expression) p.Input.run() match { case Success(node) ...
Explain and rewrite the following Scala code:
package org.jetbrains.plugins.scala package codeInsight.intention.types import com.intellij.codeInsight.intention.PsiElementBaseIntentionAction import com.intellij.openapi.editor.Editor import com.intellij.openapi.project.Project import com.intellij.psi.PsiElement import org.jetbrains.plugins.scala.extensions._ import...
Explain and rewrite the following Scala code:
package com.arcusys.valamis.storyTree.storage import com.arcusys.valamis.persistence.common.{LongKeyTableComponent, SlickProfile, TypeMapper} import com.arcusys.valamis.storyTree.model._ import com.arcusys.valamis.util.ToTuple import com.arcusys.valamis.util.TupleHelpers._ trait StoryTreeTableComponent extends LongKe...
Explain and rewrite the following Scala code:
package lila.socket import play.api.libs.json.JsValue trait SocketMember { protected val channel: JsChannel val userId: Option[String] val troll: Boolean def isAuth = userId.isDefined def push(msg: JsValue) = channel push msg def end = channel.end }
Explain and rewrite the following Scala code:
package kea package instances import java.time.{LocalDate, LocalDateTime, Period, ZonedDateTime} import java.time.format.DateTimeFormatter import com.typesafe.config.Config trait DateTimeInstances { private val isoFormatter = DateTimeFormatter.ISO_DATE_TIME implicit val zonedDateTimeReader: ConfigReader[Zoned...
Explain and rewrite the following Scala code:
package bad.robot.radiate.ui trait Tiles { val rows: Int val columns: Int }
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 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:
/* * Copyright 2022 HM Revenue & Customs * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or a...
Explain and rewrite the following Scala code:
package io.transwarp.midas.result import io.transwarp.midas.client.Session import io.transwarp.midas.result.JobStatus._ // scalastyle:off class JobStatus(val id: Int, val session: Session, val state: String, val error: String, val startTime: Long, val endTime: Long) { private var done = false def...
Explain and rewrite the following Scala code:
package com.landoop.streamreactor.connect.hive.orc import com.landoop.streamreactor.connect.hive.orc.vectors.{OrcVectorWriter, StructVectorWriter} import com.landoop.streamreactor.connect.hive.{OrcSinkConfig, StructUtils} import com.typesafe.scalalogging.StrictLogging import org.apache.hadoop.fs.{FileSystem, Path} imp...
Explain and rewrite the following Scala code:
/* * The MIT License (MIT) * * Copyright (c) 2014 Ben Howell * * 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, 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:
package net.manub.embeddedkafka import kafka.server.KafkaConfig import org.apache.kafka.clients.consumer.ConsumerConfig import org.apache.kafka.clients.producer.ProducerConfig import scala.language.postfixOps import scala.util.Random class EmbeddedKafkaCustomConfigSpec extends EmbeddedKafkaSpecSupport with E...
Explain and rewrite the following Scala code:
package com.marqod.biosphere.graphics import com.marqod.biosphere.art.ArtHolder import com.marqod.biosphere.engine.{Camera, GameEngine, GameState, Gui} import com.marqod.biosphere.models.{Fish, Sheep} import com.marqod.biosphere.utils.{Colors, Config, Vector2} import scala.swing.Graphics2D /** * Created by ryan.wa...
Explain and rewrite the following Scala code:
package vggames.scala.specs.string import vggames.scala.specs.GameSpecification import vggames.scala.code.RestrictedFunction1 import vggames.scala.specs.TestRun class StringContains extends GameSpecification[RestrictedFunction1[String, Boolean]] { def runSignature = "(a:String):Boolean" def extendsType = "Restr...
Explain and rewrite the following Scala code:
object Test { def main(args: Array[String]): Unit = { fun2.pacFun4(inky) } def pacFun4(erased clyde: Int) = { println("pacFun4") } erased def inky: Int = { println("inky") // in erased function 42 } def fun2 = { println("fun") this } }
Explain and rewrite the following Scala code:
/*********************************************************************** * Copyright (c) 2013-2017 Commonwealth Computer Research, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Apache License, Version 2.0 * which accompanies this distribution and...
Explain and rewrite the following Scala code:
package org.example1_1.usage trait Usage1 { def myScope1(): Unit = { import org.example1_1.declaration.X val xxx: X = ??? import org.example1_1.declaration.Y val yyy: Y = ??? import org.example1_1.declaration.Z val zzz: Z = ??? } def myScope2(): Unit = { import org.example1_1.declar...
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, Cloudera, Inc. All Rights Reserved. * * Cloudera, Inc. licenses this file 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 obtain a copy of the License at * * http://www.apache.org/licenses/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:
/*** * Copyright 2014 Rackspace US, 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 applica...
Explain and rewrite the following Scala code:
/* __ *\ ** ________ ___ / / ___ Scala API ** ** / __/ __// _ | / / / _ | (c) 2003-2010, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/...
Explain and rewrite the following Scala code:
package cpup.mc.tweak.content.tools import java.util import com.google.common.collect.Multimap import cpup.mc.lib.content.CPupItem import cpup.mc.lib.util.serialization.Serialized import Stats.RichModifier import cpup.mc.tweak.content.BaseItem import net.minecraft.block.Block import net.minecraft.entity.SharedMonster...
Explain and rewrite the following Scala code:
package org.reactivecouchbase.rs.tests import java.util.concurrent.TimeUnit import scala.concurrent.duration.Duration import scala.concurrent.{Await, Future} object TestImplicits { implicit class EnhancedObject[T](obj: T) { def debug: T = { println(if (obj != null) obj.toString else "null") obj ...
Explain and rewrite the following Scala code:
package com.stovokor.editor.state import com.simsilica.lemur.input.StateFunctionListener import com.stovokor.util.EditorEventListener import com.stovokor.util.EditorEvent import com.jme3.app.state.AppStateManager import com.stovokor.editor.input.InputFunction import com.stovokor.util.ExportMap import com.stovokor.util...
Explain and rewrite the following Scala code:
package artisanal.pickle.maker import models._ import parser._ import org.specs2._ import mutable._ import specification._ import scala.reflect.internal.pickling.ByteCodecs import scala.tools.scalap.scalax.rules.scalasig._ import com.novus.salat.annotations.util._ import scala.reflect.ScalaSignature class String...
Explain and rewrite the following Scala code:
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may ...
Explain and rewrite the following Scala code:
package com.nvrun import com.nvrun.RaceSeriesParser._ //import cats._ //import cats.implicits._ /** * Basic scoring * 1st Overall Men's/Women's - 11 points * 2nd Overall Men's/Women's - 10 points * 3rd Overall Men's/Women's - 9 points * 1st Other category (e.g. age group, Clydesdale, team award) - 8 points * 2...
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:
package kvpify import sbt._ import sbt.Keys._ import xerial.sbt.Pack._ object SbtBuilder extends Build { def standardSettings = Seq( exportJars := true ) ++ Defaults.defaultSettings val akkaVersion = "2.3.14" val akkaActor = "com.typesafe.akka" %% "akka-actor" % akkaVersion //val akkaPersistence =...
Explain and rewrite the following Scala code:
package models import anorm._ import java.sql.Connection import javax.inject.{Inject, Singleton} import play.api.db.Database import play.api.mvc.RequestHeader import play.api.Configuration case class LoginSession(storeUser: StoreUser, siteUser: Option[SiteUser], expireTime: Long)( implicit storeUserRepo: StoreUser...
Explain and rewrite the following Scala code:
/* * Copyright 2022 HM Revenue & Customs * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or a...
Explain and rewrite the following Scala code:
/* * MUSIT is a museum database to archive natural and cultural history data. * Copyright (C) 2016 MUSIT Norway, part of www.uio.no (University of Oslo) * * 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 Softw...
Explain and rewrite the following Scala code:
package org.pigsaw.ccpm /* Copyright Nik Silver 2015. * * This file is part of CCPM. * * CCPM 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...
Explain and rewrite the following Scala code:
package org.jetbrains.plugins.scala package lang package psi package stubs package elements import com.intellij.lang.ASTNode import com.intellij.psi.PsiElement import com.intellij.psi.stubs.{IndexSink, StubElement, StubInputStream, StubOutputStream} import org.jetbrains.plugins.scala.lang.psi.api.toplevel.templates.Sc...
Explain and rewrite the following Scala code:
/* * Copyright 2013 Maurício Linhares * * Maurício Linhares licenses this file 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 obtain a copy of the License at: * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless ...
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.opap.data.yaml import jp.opap.data.yaml.Leaf.UndefinedNode import jp.opap.data.yaml.Parent.{ListParent, MappingParent} sealed trait InternalNode extends Node { } object InternalNode { class MappingNode(private val children: Map[String, Node], val parent: Parent) extends Iterable[(String, Node)] with Int...
Explain and rewrite the following Scala code:
package ore.util import java.time.OffsetDateTime import java.time.format.{DateTimeFormatter, FormatStyle} import java.util.Locale object StringLocaleFormatterUtils { private val dateFormat = DateTimeFormatter.ofLocalizedDate(FormatStyle.MEDIUM) private val dateTimeFormat = DateTimeFormatter.ofLocalizedDateTi...
Explain and rewrite the following Scala code:
package pl.kmejka.reminders.model import com.fasterxml.jackson.annotation.JsonProperty class ReminderRequest (@JsonProperty("title") val title: String) { override def toString = s"ReminderRequest(title: $title)" }
Explain and rewrite the following Scala code:
/* * Copyright (C) 2015 Holmes Team at HUAWEI Noah's Ark Lab. * * 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 ap...
Explain and rewrite the following Scala code:
package scala.collection.mutable import org.junit.runner.RunWith import org.junit.runners.JUnit4 import org.junit.{Assert, Test} import scala.tools.testing.AssertUtil /* Test for SI-9043 */ @RunWith(classOf[JUnit4]) class ArrayBufferTest { @Test def testInsertAll: Unit = { val traver = ArrayBuffer(2, 4, 5, 7...
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 at.fh.swengb.resifo_android import java.util.Calendar import android.app.{AlertDialog, DatePickerDialog} import android.content.Intent import android.os.Bundle import android.support.v7.app.AppCompatActivity import android.view.View import android.widget.{ArrayAdapter, DatePicker, EditText, Spinner} class Re...
Explain and rewrite the following Scala code:
package org.atnos.eff import org.specs2.{ScalaCheck, Specification} import org.scalacheck.Gen.posNum import cats.syntax.all._ import cats.instances.all._ import cats.data._ import Eff._ import org.atnos.eff.all._ import org.atnos.eff.syntax.all._ class OptionEffectSpec extends Specification with ScalaCheck { def is =...
Explain and rewrite the following Scala code:
package com.thoughtworks.binding package benchmark import org.scalajs.dom._ /** * @author 杨博 (Yang Bo) &lt;pop.atry@gmail.com&gt; */ object Main extends scalajs.js.JSApp { @dom def render(store: Store) = <div class="container"> <div class="jumbotron"> <div class="row"> <div class="col-md-6"> ...
Explain and rewrite the following Scala code:
/* * Copyright (C) 2014 GRNET S.A. * * 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 distrib...
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 play.api.http.HeaderNames import play.api.mvc.{Filter, RequestHeader, Result, WithFilters} import scala.concurrent.Future import scala.concurrent.ExecutionContext.Implicits.global object Global extends WithFilters(AddCorsHeaderFilter) { } object AddCorsHeaderFilter extends Filter { override def apply(next...
Explain and rewrite the following Scala code:
package fs2 package benchmark import fs2.util._ import org.openjdk.jmh.annotations.{Benchmark, State, Scope} @State(Scope.Thread) class StreamBenchmark extends BenchmarkUtils { @GenerateN(2, 3, 100, 200, 400, 800, 1600, 3200, 6400, 12800, 25600, 51200, 102400) @Benchmark def leftAssocConcat(N: Int): Int = { ...
Explain and rewrite the following Scala code:
/* * Copyright 2016 Actian 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 com.github.tarao package slickjdbc package interpolation import helper.UnitSpec class PlaceholderSpec extends UnitSpec { import PlaceholderSpec._ def toPlaceholder[T](value: T)(implicit p: ToPlaceholder[T]): Placeholder = p(value) describe("Placeholder of simple types") { it("should be a Liter...
Explain and rewrite the following Scala code:
/* * The MIT License (MIT) * * Copyright (c) 2016 Algolia * http://www.algolia.com/ * * 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...
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:
/* * 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.scalamu.testing.junit import org.junit.Test import org.junit.BeforeClass class NotStatic { @BeforeClass def invalidNonStatic(): Unit = println("Totally invalid @BeforeClassMethod.") @Test def foo(): Unit = assert(1 == 1) }
Explain and rewrite the following Scala code:
package test import org.specs2.mutable._ import play.api.test._ import play.api.test.Helpers._ /** * Add your spec here. * You can mock out a whole application including requests, plugins etc. * For more information, consult the wiki. */ class ApplicationSpec extends Specification { "Application" should { ...
Explain and rewrite the following Scala code:
package BIDMach.updaters import BIDMat.{Mat,SBMat,CMat,DMat,FMat,IMat,HMat,GMat,GIMat,GSMat,SMat,SDMat} import BIDMat.MatFunctions._ import BIDMat.SciFunctions._ import BIDMach.models._ class CG(override val opts:CG.Opts = new CG.Options) extends Updater(opts) { var res:Mat = null var Ap:Mat = null var ...
Explain and rewrite the following Scala code:
package org.jetbrains.plugins.scala package lang package parser package parsing package statements import org.jetbrains.plugins.scala.lang.lexer.ScalaTokenTypes import org.jetbrains.plugins.scala.lang.parser.parsing.base.Ids import org.jetbrains.plugins.scala.lang.parser.parsing.builder.ScalaPsiBuilder import org.jetb...
Explain and rewrite the following Scala code:
/* * Copyright 2015 the original author or authors. * @https://github.com/scouter-project/scouter * * 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/...
Explain and rewrite the following Scala code:
/* * The MIT License (MIT) * * Copyright (c) 2015-2019 Helge Holzmann (Internet Archive) <helge@archive.org> * * 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, incl...