instruction
stringclasses
1 value
output
stringlengths
5
1M
Explain and rewrite the following Scala code:
package io.getquill.codegen.jdbc.gen import io.getquill.codegen.gen.Generator import io.getquill.codegen.jdbc.DatabaseTypes.{ DatabaseType, MySql, SqlServer } import io.getquill.codegen.jdbc.model.JdbcStereotyper import io.getquill.codegen.jdbc.model.JdbcTypes.JdbcConnectionMaker import io.getquill.codegen.jdbc.util.D...
Explain and rewrite the following Scala code:
package edu.fuberlin.hotspots import java.util import scala.collection.mutable import org.scalatest.{FlatSpec, Matchers} /** * Created by Christian Windolf on 11.07.16. */ class SuperCellSpec extends FlatSpec with Matchers { val buffer = new mutable.ListBuffer[(Int, Int)] for(x <- 10 to 20; y <- 0 to 10; t <...
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 to in writing, software distr...
Explain and rewrite the following Scala code:
package com.benjaminsproule.swagger.gradleplugin.test.scala.jaxrs import io.swagger.annotations.ApiOperation import javax.ws.rs.{GET, Path} class ExtendedTestResourceWithClassAnnotation extends TestResourceWithClassAnnotation { @ApiOperation("An overriden operation description") @Path("/overriden") @GET ...
Explain and rewrite the following Scala code:
package kornell.server.authentication object ThreadLocalAuthenticator { val threadLocal = new ThreadLocal[String] def setAuthenticatedPersonUUID(personUUID: String): String = { threadLocal.set(personUUID) personUUID } def getAuthenticatedPersonUUID = Option(threadLocal.get) def clearAuthenticatedP...
Explain and rewrite the following Scala code:
package org.openapitools.client.model case class AllView ( _class: Option[String], _name: Option[String], _url: Option[String] ) object AllView { def toStringBody(var_class: Object, var_name: Object, var_url: Object) = s""" | { | "class":$var_class,"name":$var_name,"url":$var_...
Explain and rewrite the following Scala code:
package scala.scalajs.sbtplugin import scala.language.implicitConversions import scala.scalajs.tools.logging._ import sbt.{Logger => SbtLogger, Level => SbtLevel} object Implicits { private class SbtLoggerWrapper(underlying: SbtLogger) extends Logger { def log(level: Level, message: => String): Unit = un...
Explain and rewrite the following Scala code:
/* * Copyright (c) 2013-15 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 agr...
Explain and rewrite the following Scala code:
abstract class A { lazy val lazyBar = bar object bar { val foo = 12 } } object Test extends App { val a = new A{} println(a.lazyBar.foo) }
Explain and rewrite the following Scala code:
/** * This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]]. */ // DO NOT EDIT MANUALLY package sbt.internal.bsp.codec import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError } trait RangeFormats { self: sbt.internal.bsp.codec.PositionFormats with sjsonnew.BasicJ...
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:
package devnull.cache import java.util.function.{Function => JFunction} import com.github.benmanes.caffeine.cache.Cache class SCache[K, V](val cache: Cache[K, V]) { def get(key: K, f: K => V): V = { cache.get(key, new JFunction[K, V] { override def apply(a: K): V = f(a) }) } }
Explain and rewrite the following Scala code:
package models import akka.actor._ import play.api.Play.current import play.api.libs.concurrent.Akka import models.dao._ object BidHelper { val masterBidActor = Akka.system.actorOf(Props[MasterBidActor], "master-bid-actor") def processBid(email: String, value: BigDecimal, notifyBetterBids: Boolean, itemId: Int,...
Explain and rewrite the following Scala code:
/* * Copyright (c) 2014-2017 by its authors. Some rights reserved. * 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.a...
Explain and rewrite the following Scala code:
package better.files import java.nio.charset._ import java.nio.{BufferOverflowException, ByteBuffer, CharBuffer} import scala.collection.JavaConverters._ /** A Unicode charset that handles byte-order markers * * @param underlyingCharset Use this charset if no known byte-order marker is detected; use this for enc...
Explain and rewrite the following Scala code:
package com.christophercolahan.htmlprocessor import java.net._ import java.io._ /** * @author christopher colahan * * An optional stand alone HTTP server to use for testing * HTTP pages. */ object HTTPServer { /** * Example: * extracts '/index.html' * from: * 'GET /index.html HTTP/1.1' */ def extr...
Explain and rewrite the following Scala code:
package org.scalex.model import com.github.zafarkhaja.semver class Version private[Version] (v: semver.Version) extends Ordered[Version] { private val javaVersion = v val major = javaVersion.getMajorVersion val minor = javaVersion.getMinorVersion val patch = javaVersion.getPatchVersion def compare(other: ...
Explain and rewrite the following Scala code:
/* sbt -- Simple Build Tool * Copyright 2009, 2010 Mark Harrah */ package sbt package classfile import scala.collection.mutable import mutable.{ArrayBuffer, Buffer} import scala.annotation.tailrec import java.io.File import java.lang.annotation.Annotation import java.lang.reflect.Method import java.lang.reflect.Mod...
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) 2016 BBC Design and Engineering * * 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,...
Explain and rewrite the following Scala code:
/* * Copyright (C) 2015 Stratio (http://stratio.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by app...
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.wuyuntao.aeneas.tests.events import java.time.OffsetDateTime import java.util.UUID import com.wuyuntao.aeneas.Event import com.wuyuntao.aeneas.QuerySet class PasswordChanged(val owner: UUID, val revision: Int, val timestamp: OffsetDateTime, ...
Explain and rewrite the following Scala code:
/* * Copyright (c) 2012-2015 Snowplow Analytics Ltd. All rights reserved. * * This program is licensed to you under the Apache License Version 2.0, * and you may not use this file except in compliance with the Apache License Version 2.0. * You may obtain a copy of the Apache License Version 2.0 at http://www.apach...
Explain and rewrite the following Scala code:
import sbt._ import Keys._ object Dependencies { lazy val jodaTime = Seq( "joda-time" % "joda-time" % "2.8.2", "org.joda" % "joda-convert" % "1.7" ) lazy val jackson = Seq( "com.fasterxml.jackson.core" % "jackson-databind" % "2.6.2" ) lazy val jacksonScala = "com.fasterxml.jackson.m...
Explain and rewrite the following Scala code:
package devnull import java.io.File import java.time.Clock import com.typesafe.scalalogging.LazyLogging import devnull.sessions.{ CachingSessionService, SessionService, SleepingPillHttpSessionClient } import devnull.storage._ import doobie.hikari.hikaritransactor.HikariTransactor import unfiltered.jetty.Server ...
Explain and rewrite the following Scala code:
package com.seremis.geninfusion.api.soulentity import com.seremis.geninfusion.api.genetics.ISoul import com.seremis.geninfusion.api.util.{FunctionName, VariableName} import net.minecraft.entity.EntityLiving trait ISoulEntity { implicit def asLiving = this.asInstanceOf[EntityLiving] def getSoul: ISoul d...
Explain and rewrite the following Scala code:
/* * Copyright 2014 IBM Corp. * * 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.datlinq.datafiniti import java.io.ByteArrayOutputStream import com.datlinq.datafiniti.config.DatafinitiAPIFormats.{CSV, JSON} import com.datlinq.datafiniti.config.DatafinitiAPITypes._ import com.datlinq.datafiniti.config.DatafinitiAPIViewsV4._ import com.datlinq.datafiniti.request.SearchRequest._ import c...
Explain and rewrite the following Scala code:
package io.github.hbase4s.utils import io.github.hbase4s.RecordFactory._ import io.github.hbase4s.{Field, _} import io.github.hbase4s.utils.HBaseImplicitUtils._ import org.scalatest.{FlatSpec, Matchers} import shapeless.HNil import scala.reflect.ClassTag import scala.reflect.runtime.universe._ /** * Created by Vo...
Explain and rewrite the following Scala code:
package fr.acinq.eclair.balance import akka.actor.typed.eventstream.EventStream import akka.actor.typed.scaladsl.{ActorContext, Behaviors} import akka.actor.typed.{ActorRef, Behavior} import fr.acinq.bitcoin.{ByteVector32, SatoshiLong} import fr.acinq.eclair.NotificationsLogger import fr.acinq.eclair.NotificationsLogg...
Explain and rewrite the following Scala code:
import sys.process._ import java.io._ import scala.language.postfixOps val blocks = scala.io.Source.fromFile("blockHashes.txt").mkString.split("\\n").toList.take(1) println(blocks) blocks.foreach(block => { val output = Seq("/bin/sh", "-c", s"bitcoin-cli getblock $block | jq -c '.tx'").!!.trim val transaction...
Explain and rewrite the following Scala code:
package dvla.common.microservice import scala.io.Source.fromInputStream trait Version { def version: String = { def prop(name: String) = sys.props.getOrElse(name, "Unknown") val buildDetails = Option(getClass.getResource("/build-details.txt")) .fold("No build details /build-details.txt doesn't exist ...
Explain and rewrite the following Scala code:
package de.htwg.zeta.server.model.modelValidator.validator.rules.validatorDsl /** * This file was created by Tobias Droth as part of his master thesis at HTWG Konstanz (03/2017 - 09/2017). */ class AttributesOfType(attributeType: String) { def inEdges(edgeType: String): AttributesOfTypeInEdges = new AttributesOfT...
Explain and rewrite the following Scala code:
package spotlight.analysis import java.util.ServiceConfigurationError import com.typesafe.config.Config import org.apache.commons.math3.stat.descriptive.SummaryStatistics import spotlight.analysis.algorithm.AlgorithmProtocol.Advanced /** Created by rolfsd on 10/8/15. */ package object algorithm { implicit val su...
Explain and rewrite the following Scala code:
package lore.compiler.types import scala.util.hashing.MurmurHash3 case class SymbolType(name: String) extends Type { override val hashCode: Int = MurmurHash3.stringHash(name, 0xdc07cdd9) }
Explain and rewrite the following Scala code:
package debop4s.core.utils import debop4s.core.AbstractCoreFunSuite /** * TasksTest * @author Sunghyouk Bae */ class TasksFunSuite extends AbstractCoreFunSuite { // BUG: Tasks.callWithRetry 에 버그 수정 해야 함. test("call task") { // var attempt = 3 // val x = Tasks.callWithRetry[Int](3) { ...
Explain and rewrite the following Scala code:
package com.sksamuel.elastic4s.reindex import com.sksamuel.elastic4s.searches.QueryBuilderFn import com.sksamuel.elastic4s.{Executable, ScriptBuilder} import org.elasticsearch.action.support.ActiveShardCount import org.elasticsearch.client.Client import org.elasticsearch.common.unit.TimeValue import org.elasticsearch....
Explain and rewrite the following Scala code:
/* Copyright (c) 2016, Rice University 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 and the following disclaimer. 2....
Explain and rewrite the following Scala code:
package org.jetbrains.plugins.scala.lang.resolve import org.jetbrains.plugins.scala.base.ScalaLightCodeInsightFixtureTestAdapter import org.jetbrains.plugins.scala.settings.ScalaProjectSettings import org.jetbrains.plugins.scala.{LatestScalaVersions, ScalaVersion} class EnumResolveTest extends ScalaLightCodeInsightFix...
Explain and rewrite the following Scala code:
package com.dt.scala.oop /** * Author: Wang Jialin * Contact Information: * WeChat: 18610086859 * QQ: 1740415547 * Email: 18610086859@126.com * Tel: 18610086859 */ package spark{ package navigation{ private[spark] class Navigator{ protected[navigation] def useStarChart() {} ...
Explain and rewrite the following Scala code:
/* * Copyright 2018 Analytics Zoo 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...
Explain and rewrite the following Scala code:
class SelfQualifier { self => private[this] val aPrivateVal: Int = 0 protected[this] val aProtectedVal: Int = 0 private[this] var aPrivateVar: Int = 0 protected[this] var aProtectedVar: Int = 0 private[this] def aPrivateFun: Int = 0 protected[this] def aProtectedFun: Int = 0 // access to following member...
Explain and rewrite the following Scala code:
package io.udash package rest import monix.execution.Scheduler import com.avsystem.commons._ import io.udash.rest.raw.RawRest import io.udash.rest.raw.RawRest.HandleRequest import org.scalactic.source.Position import org.scalatest.concurrent.ScalaFutures import org.scalatest.funsuite.AnyFunSuite abstract class RestAp...
Explain and rewrite the following Scala code:
package test.support import com.typesafe.config.{Config, ConfigFactory} import akka.actor.ActorSystem object TestConfig { val config = ConfigFactory.parseString( """akka.loggers = ["akka.testkit.TestEventListener"] |akka.actor.debug.autoreceive = "on" |ecommerce.broker.url = "nio://0.0.0.0:61616" ...
Explain and rewrite the following Scala code:
package io.buoyant.admin.names import com.twitter.conversions.time._ import com.twitter.finagle.http.{Request, Response} import com.twitter.finagle.naming.NameInterpreter import com.twitter.finagle.util.DefaultTimer import com.twitter.finagle.{Dtab, Service} import com.twitter.util.{Future, TimeoutException} import io...
Explain and rewrite the following Scala code:
package controllers import javax.inject.Inject import com.mohiva.play.silhouette.api.{ Environment, Silhouette } import com.mohiva.play.silhouette.impl.authenticators.JWTAuthenticator import com.mohiva.play.silhouette.impl.providers.SocialProviderRegistry import modules.silhouette.models.User import play.api.i18n.{ M...
Explain and rewrite the following Scala code:
package demo.routes import demo.pages.SuiPage import demo.components.semanticui._ import japgolly.scalajs.react.extra.router.RouterConfigDsl import japgolly.scalajs.react.vdom.html_<^._ object SuiRouteModule { case object Info extends LeftRoute("Info", "info", () => SuiInfo()) case object Button extends LeftRout...
Explain and rewrite the following Scala code:
package processes.freeMonads.scalaz.multiple import processes.PatchAssignmentSpec class HappyFlowSpec extends PatchAssignmentSpec( "Scalaz happy flow only (mutiple program types) free monads", s => new HappyFlowOnly(s) )
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 2012 Eike Kettner * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to...
Explain and rewrite the following Scala code:
/* * 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 (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:
package scalax.collection.immutable import scalax.collection.mutable.EqHashMap /** Wrapper class mimicking a `scala.collection.immutable.Set` * without copying the contents of the underlying `EqHashMap`. * * @define ON Creates a new `Set` as an O(N) operation */ final class EqSet[K <: AnyRef](map: Eq...
Explain and rewrite the following Scala code:
/* * Copyright 2011-2018 GatlingCorp (http://gatling.io) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applic...
Explain and rewrite the following Scala code:
/* ___ _ ___ _ _ *\\ ** / __| |/ (_) | | The SKilL Generator ** ** \\__ \\ ' <| | | |__ (c) 2013-16 University of Stuttgart ** ** |___/_|\\_\\_|_|____| see LICENSE ...
Explain and rewrite the following Scala code:
package com.geishatokyo.smartmerger.injection import org.scalatest.{Matchers, FlatSpec} import org.scalatest.matchers.ShouldMatchers import com.geishatokyo.smartmerger.parse.{ParsedData, MarkerParser} /** * Created by takeshita on 2014/06/04. */ class InjectorTest extends FlatSpec with Matchers { "Replace merge"...
Explain and rewrite the following Scala code:
package controllers import models.User import play.api.Logger import play.api.mvc._ import services.{Config, Instagram} class Application extends Controller { def index: Action[AnyContent] = Action { Ok(views.html.index()) } def insta: Action[AnyContent] = Action { request => val url = Instagram.getA...
Explain and rewrite the following Scala code:
package net.liftweb.widgets.menu import _root_.scala.xml.{NodeSeq, Node, Elem, PCData, Text, Unparsed} import _root_.net.liftweb.http.{LiftRules, S} import _root_.net.liftweb.http.js._ import _root_.net.liftweb.sitemap._ import JsCmds._ import JE._ import _root_.net.liftweb.util._ import Helpers._ object MenuStyle ex...
Explain and rewrite the following Scala code:
/* * Copyright 2009-2010 WorldWide Conferencing, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applica...
Explain and rewrite the following Scala code:
/* * Scala.js (https://www.scala-js.org/) * * Copyright EPFL. * * Licensed under Apache License 2.0 * (https://www.apache.org/licenses/LICENSE-2.0). * * See the NOTICE file distributed with this work for * additional information regarding copyright ownership. */ package org.scalajs.testsuite.library import ...
Explain and rewrite the following Scala code:
/** * Copyright (C) 2009-2011 the original author or authors. * See the notice.md 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. * Yo...
Explain and rewrite the following Scala code:
/* * Copyright (c) 2002-2018 "Neo Technology," * Network Engine for Objects in Lund AB [http://neotechnology.com] * * This file is part of Neo4j. * * Neo4j 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 Foundatio...
Explain and rewrite the following Scala code:
package crudex.persist import scalaz.concurrent.Task /** */ object Common { type DefaultPersistEff[A] = Task[A] //DbEffectToTask instance already implemented for Task in crudex.app.Common.instances }
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:
object E2 extends Application { jorge() var prev = 1 var curr = 2 var evens = curr while (curr < 4000000) { val tmp = prev prev = curr curr = prev + tmp; if (curr % 2 == 0) evens += curr } println(evens) def jorge() { lazy val fib: Stream[Int] = Stream.cons(0, Stream.cons(1, fi...
Explain and rewrite the following Scala code:
package blog.examples import org.scalamock.scalatest.MockFactory import org.scalatest._ import twitter4j.Status import scala.util.Random class ScalaTwitterProcessorTest extends FlatSpec with Matchers with MockFactory { val generator: Random = new Random "An empty STP" should "return an empty java map" in { ...
Explain and rewrite the following Scala code:
/* * Copyright 2021 HM Revenue & Customs * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or a...
Explain and rewrite the following Scala code:
object Test { implicit class Foo(sc: StringContext) { object q { def unapply(arg: Any): Option[(Any, Any)] = Some((sc.parts(0), sc.parts(1))) } } def main(args: Array[String]): Unit = { val q"class $_ extends $_parent" = new Object println(_parent) } }
Explain and rewrite the following Scala code:
package com.campudus.tableaux.api import com.campudus.tableaux.Starter import com.campudus.tableaux.testtools.TestAssertionHelper import com.typesafe.scalalogging.LazyLogging import io.vertx.ext.unit.TestContext import io.vertx.ext.unit.junit.VertxUnitRunner import io.vertx.lang.scala.{ScalaVerticle, VertxExecutionCon...
Explain and rewrite the following Scala code:
package list import list.P02.penultimate import org.scalatest.{FlatSpec, ShouldMatchers} class P02Spec extends FlatSpec with ShouldMatchers { "penultimate" should "return the last but one element of a list when there are at least 2 elements" in { val list = List(4, 7) penultimate(list) should be(Some(4)) ...
Explain and rewrite the following Scala code:
import scala.quoted.* import scala.quoted.staging.* class Foo { given Compiler = Compiler.make(getClass.getClassLoader) def foo: Unit = withQuotes { val e: Expr[Int] = '{3} val q = '{ ${ '{ $e } } } println(q.show) } } object Test { def main(args: Array[String]): Unit = { val f = new Foo f...
Explain and rewrite the following Scala code:
package at.logic.gapt.examples.tip.isaplanner import at.logic.gapt.expr._ import at.logic.gapt.formats.ClasspathInputFile import at.logic.gapt.formats.tip.TipSmtParser import at.logic.gapt.proofs.Ant import at.logic.gapt.proofs.gaptic._ /* This proof is not a s.i.p. because of the subinductions. */ object prop_34 ext...
Explain and rewrite the following Scala code:
package l3.input import java.io.{File, FileReader => JFileReader} import scala.util.parsing.input.{Reader, StreamReader, Position} class FilePosition(val fileName: String, pos: Position) extends Position { def line: Int = pos.line def column: Int = pos.column def lineContents: String = pos.longString.split("\\n...
Explain and rewrite the following Scala code:
package gv.jleon package config import com.typesafe.config.{ ConfigValue, ConfigValueType } protected[config] trait RichConfigValueOps extends Any { def self: ConfigValue final def ifType(t: ConfigValueType): Option[Object] = if (self.valueType == t) Some(self.unwrapped) else None final d...
Explain and rewrite the following Scala code:
package it import java.sql.ResultSet import akka.actor.ActorSystem import akka.stream.ActorMaterializer import akka.stream.scaladsl.Sink import akka.util.ByteString import org.scalatest.{AsyncFlatSpec, BeforeAndAfterAll, Matchers} import ru.arigativa.akka.streams.ConnectionProvider._ import ru.arigativa.akka.streams....
Explain and rewrite the following Scala code:
package io.getquill.context.ndbc.postgres import io.getquill.context.sql.DepartmentsSpec class DepartmentsNdbcPostgresSpec extends DepartmentsSpec { val context = testContext import context._ override def beforeAll = { get { context.transaction { for { a <- context.run(query[Depart...
Explain and rewrite the following Scala code:
/** * Copyright 2017 https://github.com/sndnv * * 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 applicabl...
Explain and rewrite the following Scala code:
package play.api.libs.json.scalatest import org.scalacheck.ops._ import org.scalacheck.{Shrink, Arbitrary, Gen} import org.scalatest.FlatSpecLike import play.api.libs.json.Format import play.api.libs.json.scalacheck.PlayJsonFormatTests import scala.reflect.ClassTag import scala.testing.scalatest.ScalaTestBridge /** ...
Explain and rewrite the following Scala code:
package com.codacy.api.helpers import java.io.{File, PrintWriter} import com.codacy.api.helpers.vcs.GitClient import play.api.libs.json._ import scala.io.{Codec, Source} import scala.util.Try object FileHelper { private val currentPath = new File(System.getProperty("user.dir")) def withTokenAndCommit[T](proje...
Explain and rewrite the following Scala code:
object CapsStartPointFree { def main(args: Array[String]) = { // The next two lines do the same thing. Try each one! args filter (_(0).isUpper) foreach ((arg) => println("arg: "+arg)) // args filter (_(0).isUpper) map ("arg: "+_) foreach println } } // $ scalac caps-start-point-free.scala // $ scala -cp ...
Explain and rewrite the following Scala code:
package lila.lobby import org.joda.time.DateTime import reactivemongo.bson.{ BSONDocument, BSONInteger, BSONRegex, BSONArray, BSONBoolean } import reactivemongo.core.commands._ import scala.concurrent.duration._ import actorApi.LobbyUser import lila.db.BSON.BSONJodaDateTimeHandler import lila.db.Types.Coll import lil...
Explain and rewrite the following Scala code:
package com.scalaAsm.x86 package Instructions package x87 // Description: Multiply // Category: general/arith trait FMUL extends InstructionDefinition { val mnemonic = "FMUL" } object FMUL extends OneOperand[FMUL] with FMULImpl trait FMULImpl extends FMUL { implicit object _0 extends OneOp[m32] { val opcode...
Explain and rewrite the following Scala code:
package circumflex package freemarker import core._ import org.apache.commons.io.FileUtils import org.apache.commons.lang3.StringUtils import java.io.File import collection.mutable.HashMap import org.scalatest._ import org.junit.runner.RunWith import org.scalatest.junit.JUnitRunner import matchers.{MatchResult, MustMa...
Explain and rewrite the following Scala code:
package skinny.controller import scala.language.reflectiveCalls import javax.servlet.ServletContext import org.scalatest._ import org.scalatest.mock.MockitoSugar import org.mockito.Mockito._ import org.mockito.Matchers.anyString import org.mockito.internal.stubbing.answers._ import skinny.SkinnyEnv import skinny.eng...
Explain and rewrite the following Scala code:
package scaladex.core.model /** * Contributor reference * * @param login the user name * @param avatarUrl the url to the users avatar * @param contributions the number of contributions */ case class GithubContributor( login: String, avatarUrl: String, url: Url, contributions: Int ) ex...
Explain and rewrite the following Scala code:
package organizing_data.change_value_to_reference.after class Order (private var customerName: String){ //Custmoer对象还是值对象。就算多份订单属于同一客户,但每个Order对象还是拥有各自的Customer对象。 //改成每个客户名称对应一个Customer对象。改为调用工厂函数 private var _customer: Customer = Customer.getCustomer(customerName) def setCustomerName(customerName: String) =...
Explain and rewrite the following Scala code:
/* * Copyright (c) 2014 Mesosphere Inc. <http://www.mesosphere.io> */ package akka.libprocess import akka.actor._ import akka.libprocess.LibProcessManager.LibProcessInternalMessage import akka.libprocess.serde.{ MessageSerDe, TransportMessage } import spray.can.Http import spray.http.{ HttpResponse, HttpMethods, Ht...
Explain and rewrite the following Scala code:
import scala.collection.immutable.SeqMap import org.scalacheck._ import Arbitrary.arbitrary import Prop._ import Gen._ import scala.collection.mutable.ListBuffer object SeqMapTest extends Properties("SeqMap") { property("ordering") = forAll { (m: Map[Int, Int]) => val list = m.toList val sm = SeqMap.from(...
Explain and rewrite the following Scala code:
package net.benchmark.akka.http.world import slick.basic.DatabaseConfig import slick.jdbc.PostgresProfile import slick.jdbc.PostgresProfile.api._ import scala.concurrent.Future class WorldRepositoryModule(val dbConfig: DatabaseConfig[PostgresProfile]) extends WorldRepository { private val db = dbConfig.db priv...
Explain and rewrite the following Scala code:
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you...
Explain and rewrite the following Scala code:
/** * Copyright 2010-2014 MongoDB, Inc. <http://www.mongodb.org> * * 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 ...
Explain and rewrite the following Scala code:
package spatutorial.client import japgolly.scalajs.react.{ReactDOM, React} import japgolly.scalajs.react.extra.router._ import japgolly.scalajs.react.vdom.prefix_<^._ import org.scalajs.dom import spatutorial.client.components.GlobalStyles import spatutorial.client.logger._ import spatutorial.client.modules._ import s...
Explain and rewrite the following Scala code:
package net.spals.appbuilder.app.finatra.sample import com.google.inject.Inject import com.google.inject.name.Names import com.twitter.inject.TwitterModule import net.spals.appbuilder.annotations.config.ApplicationName import net.spals.appbuilder.annotations.service.AutoBindModule /** * A sample [[TwitterModule]] f...
Explain and rewrite the following Scala code:
/* * Copyright (c) 2014-2016 * nonblocking.at gmbh [http://www.nonblocking.at] * * This file is part of Cliwix. * * Cliwix is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the...
Explain and rewrite the following Scala code:
/* * The MIT License (MIT) * * Copyright (c) 2014 Heiko Blobner * * 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...
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 to in writing,...
Explain and rewrite the following Scala code:
package monocle.std import monocle.Prism import monocle.function.Index import monocle.internal.{Bits, Bounded} import scalaz.std.anyVal._ object int extends IntOptics trait IntOptics { implicit val intBitIndex: Index[Int, Int, Boolean] = Bits.bitsIndex[Int] val intToChar: Prism[Int, Char] = Bounded.or...
Explain and rewrite the following Scala code:
package com.mjs.spray.hello.factorial import akka.actor.ActorSystem import akka.actor.Actor import akka.actor.Props import akka.testkit.{ TestActors, TestKit, ImplicitSender } import com.mjs.spray.hello.factorial.service.{CoordinatorService, FactorialService, SumService} import com.mjs.spray.hello.factorial.service.Su...