instruction
stringclasses
1 value
output
stringlengths
5
1M
Explain and rewrite the following Scala code:
package edu.jingw.raytracer /** * Represents a ray, which is a line that has an end in one direction, but goes * onward to infinity in the other. The direction vector will be normalized upon * construction */ case class Ray(x0: Vector, direction: Vector) { if (x0 == null) { throw new NullPointerException }...
Explain and rewrite the following Scala code:
package collins.util.power import play.api.libs.json.Format import play.api.libs.json.JsObject import play.api.libs.json.JsSuccess import play.api.libs.json.JsValue import play.api.libs.json.Json object PowerUnit { def apply(config: PowerConfiguration, id: Int): PowerUnit = { val components: PowerComponents = ...
Explain and rewrite the following Scala code:
/* * Copyright (c) 2014 Contributor. All rights reserved. */ package org.scalaide.ui.internal.editor.decorators.custom import scala.reflect.NameTransformer import scala.reflect.internal.util.SourceFile import org.eclipse.jface.text.Position import org.eclipse.jface.text.source.Annotation import org.scalaide.core.co...
Explain and rewrite the following Scala code:
package juju.infrastructure import akka.actor._ import juju.infrastructure.AppScheduler.{ScheduleWakeUp, SendActivation} import juju.messages.{WakeUp, Activate} import scala.concurrent.duration.FiniteDuration trait AppSchedulerFactory { def create(tenant: String, role: String, context: ActorContext) : ActorRef } ...
Explain and rewrite the following Scala code:
package scalatags.ext import org.scalajs.dom import org.scalajs.dom.Element import scala.annotation.unchecked.uncheckedVariance import scalatags.JsDom.all._ import scalatags.generic /** * * * @author Matthew Pocock */ trait Modifiable { implicit class ModifiableElement[Output <: Element](elem: Output) { d...
Explain and rewrite the following Scala code:
package com.karasiq.bootstrap import scala.language.postfixOps import rx.Ctx import com.karasiq.bootstrap.carousel.JSCarousels import com.karasiq.bootstrap.context.JSRenderingContext import com.karasiq.bootstrap.jquery.BootstrapJQueryContext import com.karasiq.bootstrap.modal.JSModals import com.karasiq.bootstrap.na...
Explain and rewrite the following Scala code:
package com.programmaticallyspeaking.ncd.testing import ch.qos.logback.classic.spi.ILoggingEvent import ch.qos.logback.core.UnsynchronizedAppenderBase import ch.qos.logback.core.encoder.Encoder import ch.qos.logback.core.status.ErrorStatus import java.io.{ByteArrayOutputStream, IOException, OutputStream} import java.n...
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 2009-2010 LinkedIn, Inc * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed ...
Explain and rewrite the following Scala code:
package ru.smslv.akka.dns import java.nio.ByteOrder package object raw { implicit val networkByteOrder = ByteOrder.BIG_ENDIAN }
Explain and rewrite the following Scala code:
package com.mesosphere.universe.v3.model import com.twitter.util.Return import com.twitter.util.Throw import com.twitter.util.Try import org.scalatest.Assertion import org.scalatest.FreeSpec import scala.language.implicitConversions class DcosReleaseVersionSpec extends FreeSpec { private[this] implicit def stringT...
Explain and rewrite the following Scala code:
package sorm.test.general import sorm._ import org.scalatest._ @org.junit.runner.RunWith(classOf[junit.JUnitRunner]) class EntityWithNoPrimitivesSuite extends FunSuite with ShouldMatchers { import EntityWithNoPrimitivesSuite._ test("All is fine"){ val db = new Instance( entities = Set( Entity[A...
Explain and rewrite the following Scala code:
/* * Copyright 2014–2018 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 com.twitter.finagle import com.twitter.util.{Future, Throw, Try} /** * `FailureFlags` may be applied to any Failure/Exception encountered during the * handling of a request. */ object FailureFlags { val Empty: Long = 0L /** * Retryable indicates that the action that caused the failure is known ...
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:
package controllers.pcanywhere.mr import javax.inject._ import play.api._ import play.api.mvc._ import play.api.i18n.Messages import play.api.i18n.I18nSupport import play.api.i18n.MessagesApi import play.Application import utils.Awaits import utils._ import models.sitedata.SiteInfo import models.sitedata.joined.SiteIn...
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.twitter.finagle.mysql.protocol import com.twitter.finagle.mysql.ClientError import org.specs.SpecificationWithJUnit class BufferSpec extends SpecificationWithJUnit { "Buffer" should { "Read" in { val bytes = Array[Byte](0x11,0x22,0x33,0x44,0x55,0x66,0x77,0x78) val br = BufferReader(bytes...
Explain and rewrite the following Scala code:
package org.ensime.api import java.io.File case class RpcRequestEnvelope(req: RpcRequest, callId: Int) /** * All messages into the ENSIME server from the client are part of * this family. * * NOTE: we intend to simplify these messages * https://github.com/ensime/ensime-server/issues/845 */ sealed trait RpcRequ...
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 code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]]. */ // DO NOT EDIT MANUALLY package sbt sealed abstract class ConnectionType extends Serializable object ConnectionType { /** This uses Unix domain socket on POSIX, and named pipe on Windows. */ case object Local exten...
Explain and rewrite the following Scala code:
package fish.philwants.modules import fish.philwants.Credentials object BitBucketModule extends AbstractModule { val uri = "https://bitbucket.org/" val moduleName = "BitBucket" def tryLogin(creds: Credentials): Boolean = { val loginUri = "https://bitbucket.org/account/signin/?next=/" val resp = get(log...
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) 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 com.twitter.scalding import com.twitter.scalding.typed.CoGroupable import org.slf4j.LoggerFactory import scala.reflect.runtime.universe import scala.reflect.runtime.universe.{NullaryMethodType, RuntimeMirror, Symbol, Type, TypeRef} import java.lang.{reflect => jReflect} object ReferencedClassFinder { priva...
Explain and rewrite the following Scala code:
/** * Copyright (C) 2016 Orbeon, Inc. * * 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 * 2.1 of the License, or (at your option) any later version. * * This program i...
Explain and rewrite the following Scala code:
package com.twitter.finatra.http.tests.filters import com.twitter.finagle.Service import com.twitter.finagle.http.{Fields, Request, Response} import com.twitter.finatra.http.filters.HttpResponseFilter import com.twitter.inject.Test import com.twitter.util.Future import java.net.URLEncoder import org.scalatest.Assertio...
Explain and rewrite the following Scala code:
/* * Copyright 2015 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 (c) 2014-2020 by The Monix Project Developers. * See the project homepage at: https://monix.io * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache...
Explain and rewrite the following Scala code:
import heros.solver.IFDSSolver import org.opalj.br.Method import heros.IFDSTabulationProblem import org.opalj.br.analyses.Project import java.net.URL import scala.collection.JavaConversions._ import org.opalj.br.instructions.Instruction class DebuggableIFDSSolver( val tabulationProblem: IFDSTabulationProblem[MInst...
Explain and rewrite the following Scala code:
package com.twitter.finagle.serverset2 import com.fasterxml.jackson.databind.ObjectMapper import scala.jdk.CollectionConverters._ import scala.util.control.NonFatal private[serverset2] object IntObj { def unapply(o: Object): Option[Int] = o match { case i: java.lang.Integer => Some(i) case _ => None } } ...
Explain and rewrite the following Scala code:
/* * Copyright 2001-2013 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 com.lynbrookrobotics.potassium.streams abstract class MappedStream[T, U](parent: Stream[T]) extends Stream[U] { def applyTransform(in: T): U override private[potassium] val parents = Seq(parent) override private[potassium] val streamType = "map" var unsubscribe: Cancel = null def receiveValue(valu...
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 scorex.crypto.hash import org.bouncycastle.crypto.digests.GOST3411_2012_512Digest object Stribog512 extends BouncyCastleHash[Digest64] with CryptographicHash64 { override protected lazy val digestFn = new GOST3411_2012_512Digest override def hash(input: Message): Digest64 = Digest64 @@ internalHash(inpu...
Explain and rewrite the following Scala code:
// See https://github.com/scalameta/scalameta/issues/2116 package example import scala.concurrent.ExecutionContext abstract class Issue2116 { def check( includeDocs: Boolean = false, includeCommitCharacter: Boolean = false )(implicit loc: ExecutionContext): Unit = {} } class Issue2116_2 extends Issu...
Explain and rewrite the following Scala code:
/* * Copyright 2014-2022 Netflix, 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:
/* * Copyright (c) 2013-2014 Telefónica Investigación y Desarrollo S.A.U. * * 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 * * Unles...
Explain and rewrite the following Scala code:
package sangria.validation.rules import sangria.ast.AstLocation import scala.collection.mutable.{Map => MutableMap} import sangria.ast import sangria.ast.AstVisitorCommand import sangria.validation._ /** Unique input field names * * A GraphQL input object value is only valid if all supplied fields are uniquely ...
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.tools.nsc.interp...
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:
/** * 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 dotty.tools.dotc package core import java.security.MessageDigest import scala.annotation.switch import scala.io.Codec import Names._, StdNames._, Contexts._, Symbols._, Flags._ import Decorators.StringDecorator import dotty.tools.dotc.util.Chars import Chars.isOperatorPart object NameOps { final object com...
Explain and rewrite the following Scala code:
package com.twitter.scrooge.java_generator import com.twitter.scrooge.ast._ class DeserializeFieldController( fieldType: FieldType, fieldName: String, prefix: String, generator: ApacheJavaGenerator, ns: Option[Identifier]) extends BaseSerializeController(fieldType, fieldName, prefix, generator, ...
Explain and rewrite the following Scala code:
package io.vamp.common.http import akka.http.scaladsl.model.StatusCodes._ import akka.http.scaladsl.model.{ ExceptionWithErrorInfo, StatusCode } import akka.http.scaladsl.server._ import com.typesafe.scalalogging.Logger import io.vamp.common.notification.NotificationErrorException import org.slf4j.LoggerFactory trait...
Explain and rewrite the following Scala code:
package fs2 import fs2.util.{Free,RealSupertype,Sub1,~>} import Async.Future /** * A stream producing output of type `O`, which may evaluate `F` * effects. If `F` is `Nothing` or `[[fs2.Pure]]`, the stream is pure. */ abstract class Stream[+F[_],+O] extends StreamOps[F,O] { self => import Stream.Handle def ge...
Explain and rewrite the following Scala code:
package fs2 private[fs2] trait pull1 { import Stream.Handle // nb: methods are in alphabetical order /** Await the next available `Chunk` from the `Handle`. The `Chunk` may be empty. */ def await[F[_],I]: Handle[F,I] => Pull[F,Nothing,Step[Chunk[I],Handle[F,I]]] = _.await /** Await the next available ...
Explain and rewrite the following Scala code:
package arpc.nio import java.net.InetSocketAddress import java.nio.channels.{SelectionKey, ServerSocketChannel} import scala.collection.JavaConversions._ class Server(val name: String, port: Int, poolSize: Int, chFactory: ChannelHandlerFactory) extends Selector { val address = new InetSocketAddress(port) val th...
Explain and rewrite the following Scala code:
/** * Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com> */ package akka.http.model.parser import akka.scalajs._ import org.parboiled2._ import Parser.DeliveryScheme.Either import akka.http.model.Uri import Uri._ // format: OFF // http://tools.ietf.org/html/rfc3986 private[http] class UriParser(val ...
Explain and rewrite the following Scala code:
package kamkor.covariance.gun import kamkor.UnitSpec import kamkor.covariance.gun.BulletsModel._ class AmmoMagazineSpec extends UnitSpec { "A AmmoMagazine" when { "has no bullets" should { "not return bullets" in { val emptyAmmoMag = AmmoMagazine.empty emptyAmmoMag.hasBullets shouldBe f...
Explain and rewrite the following Scala code:
package com.pnagarjuna.learning.scalaz /** * Created by pnagarjuna on 27/12/15. */ object Day2 { }
Explain and rewrite the following Scala code:
/* * Copyright (C) Lightbend Inc. <https://www.lightbend.com> */ package play.mvc import java.io.IOException import akka.actor.ActorSystem import akka.stream.Materializer import akka.stream.javadsl.Source import akka.util.ByteString import org.specs2.mutable.Specification import org.specs2.specification.AfterAll i...
Explain and rewrite the following Scala code:
package myFirstSparkApp import org.apache.spark._ import org.apache.spark.mllib.recommendation._ /** * Created by fengwu on 15/2/5. */ object myALS { def showWarning() { System.err.println( """WARN: This is a naive implementation of ALS and is given as an example! |Please use the ALS method fou...
Explain and rewrite the following Scala code:
/** * Copyright (C) 2011 Orbeon, Inc. * * 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 * 2.1 of the License, or (at your option) any later version. * * This program i...
Explain and rewrite the following Scala code:
/******************************************************************************* Copyright (c) 2012-2014, KAIST, S-Core. All rights reserved. Use is subject to license terms. This distribution may include materials developed by third parties. **********************************************************...
Explain and rewrite the following Scala code:
/* * Copyright (c) 2017 * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this * list of conditions and the foll...
Explain and rewrite the following Scala code:
package info.andreaswolf.roadhopper.simulation import akka.actor.{ActorLogging, Actor, ActorRef} import akka.pattern.ask import akka.util.Timeout import scala.collection.mutable import scala.concurrent.duration._ import scala.collection.mutable.ListBuffer import scala.concurrent.Future /** * Message sent to start t...
Explain and rewrite the following Scala code:
package dotty.tools.dottydoc package model import comment._ import references._ import java.util.LinkedList object JavaConverters { import scala.collection.JavaConverters._ import java.util.{ Map => JMap } implicit class OptStr(val opt: Option[String]) extends AnyVal { def asJava = opt.getOrElse(null) }...
Explain and rewrite the following Scala code:
package szaq.convert case class Cat(name: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 models import play.api.libs.json.{Format, Json} case class ShardRange(start: Short, end: Short) { def range: Range = Range.inclusive(start, end) } object ShardRange { implicit val shardRangeJF: Format[ShardRange] = Json.format[ShardRange] } case class ShardedNotification( notification: Notification, ...
Explain and rewrite the following Scala code:
package com.featurefm.util.shortid import java.lang.Integer.{MIN_VALUE, highestOneBit} import java.nio.ByteBuffer import java.util.{Base64, UUID} import org.hashids._ import scala.util.hashing.MurmurHash3 /** * Created by yardena on 3/16/16. */ trait Shortener { lazy val hashIds = Hashids(salt = "FEATURE.FM ...
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:
//import student data into a RDD val student = sc.textFile("file:///home/mqp/Documents/test_data/Student.txt") //import Class data into a RDD val course = sc.textFile("file:///home/mqp/Documents/test_data/Course.txt") //import StudentClass data into a RDD val studentcourse = sc.textFile("file:///home/mqp/Doc...
Explain and rewrite the following Scala code:
package edu.berkeley.nlp.entity.coref import scala.collection.mutable.ArrayBuffer import scala.collection.mutable.HashMap import edu.berkeley.nlp.entity.GUtil import edu.berkeley.nlp.futile.util.Logger import edu.berkeley.nlp.entity.sem.QueryCountsBundle import edu.berkeley.nlp.entity.sem.BasicWordNetSemClasser import...
Explain and rewrite the following Scala code:
package com.peterpotts package object sample { val defaultSampleSize = 4 }
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 ...
Explain and rewrite the following Scala code:
/* Copyright (c) 2016 Lucas Satabin * * 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:
/** * 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 2015 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 model object BusinessType extends Enumeration { type TypeCode = Value val Restaurant, Cafe, Bakery, Caterer, Hotel, FruitVegShop, ConvenienceShop, Supermarket, NonRetail = Value }
Explain and rewrite the following Scala code:
/** * Copyright (C) 2011 - 101loops.com <dev@101loops.com> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by appli...
Explain and rewrite the following Scala code:
package io.sqooba.oss.timeseries.window import io.sqooba.oss.timeseries.immutable.TSEntry import scala.collection.immutable.Queue import scala.concurrent.duration.TimeUnit /** An aggregator that relies on the passed entries' integral function. * * Very similar to the SummingAggregator, but takes the validity of ...
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 org.jetbrains.plugins.scala package codeInspection package collections import org.jetbrains.plugins.scala.lang.psi.api.base.ScInterpolatedStringLiteral import org.jetbrains.plugins.scala.lang.psi.api.expr.ScExpression import scala.collection.immutable.ArraySeq class MakeArrayToStringInspection extends Opera...
Explain and rewrite the following Scala code:
package org.http4s.server.middleware import cats.implicits._ import cats.effect._ import cats.effect.concurrent.Ref import org.http4s._ import org.http4s.dsl.io._ import org.http4s.util.CaseInsensitiveString import scala.concurrent.duration.TimeUnit class ResponseTimingSpec extends Http4sSpec { import Sys.clock ...
Explain and rewrite the following Scala code:
package org.scalaide.core.semantichighlighting.classifier import org.scalaide.core.internal.decorators.semantichighlighting.classifier.SymbolTypes._ import org.junit._ class ClassTest extends AbstractSymbolClassifierTest { @Test def basic_class(): Unit = { checkSymbolClassification(""" class Class ...
Explain and rewrite the following Scala code:
/*********************************************************************** * Copyright (c) 2013-2019 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:
/* * Copyright 2014 Andrey Kutyrev * * Licensed under the the GNU Public License v3.0; * You may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.gnu.org/licenses/gpl.html * * Unless required by applicable law or agreed to in writing, softwar...
Explain and rewrite the following Scala code:
package akka import akka.actor._ import akka.testkit.{ImplicitSender, TestActorRef, TestKit, TestProbe} import org.scalatest.BeforeAndAfterAll import org.scalatest.matchers.should.Matchers import org.scalatest.wordspec.AnyWordSpecLike import scala.concurrent.duration._ import scala.language.postfixOps class Echo ex...
Explain and rewrite the following Scala code:
package com.twitter.finagle.service import com.twitter.finagle._ import com.twitter.finagle.context.{Deadline, Contexts} import com.twitter.finagle.stats.InMemoryStatsReceiver import com.twitter.util._ import com.twitter.util.TimeConversions._ import org.junit.runner.RunWith import org.scalatest.{OneInstancePerTest, F...
Explain and rewrite the following Scala code:
/******************************************************************************* * Copyright 2017 Capital One Services, LLC and Bitwise, 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...
Explain and rewrite the following Scala code:
/*******************************************************************************/ /* */ /* Copyright (C) 2017 by Max Lv <max.c.lv@gmail.com> */ /* Copyright (C) 2017 by Mygod Studio <contact-shadowsocks-android@mygod....
Explain and rewrite the following Scala code:
package pl.gosub.akka_streams.workshop import akka.actor.ActorSystem import akka.stream.scaladsl.{Sink, Source} import akka.stream.{ActorMaterializer, OverflowStrategy, ThrottleMode} import org.scalatest.FreeSpec import scala.concurrent.Await import scala.concurrent.ExecutionContext.Implicits.global import scala.conc...
Explain and rewrite the following Scala code:
/** * Copyright (C) 2011 Orbeon, Inc. * * 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 * 2.1 of the License, or (at your option) any later version. * * This program i...
Explain and rewrite the following Scala code:
/* * Copyright 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 applicable l...
Explain and rewrite the following Scala code:
package scalangine.entities import scalangine.display.Rectangle import scalangine.display.Shapes import scalangine.display.Color import scalangine.engine.GameRunner import org.newdawn.slick.opengl.Texture import org.newdawn.slick.opengl.TextureLoader import org.newdawn.slick.util.ResourceLoader import scalangine.displ...
Explain and rewrite the following Scala code:
package com.sksamuel.elastic4s.search.queries import com.sksamuel.elastic4s.analyzers.StandardAnalyzer import com.sksamuel.elastic4s.http.ElasticDsl import com.sksamuel.elastic4s.searches.queries.{ArtificialDocument, MoreLikeThisItem} import com.sksamuel.elastic4s.testkit.DockerTests import com.sksamuel.elastic4s.{Doc...
Explain and rewrite the following Scala code:
package com.twitter.finagle.redis.integration import com.twitter.finagle.redis.ClientError import com.twitter.finagle.redis.naggati.RedisClientTest import com.twitter.finagle.redis.tags.{ClientTest, RedisTest} import com.twitter.finagle.redis.util.StringToChannelBuffer import com.twitter.util.Await import scala.collec...
Explain and rewrite the following Scala code:
package org.deca.compiler.signature import org.jllvm._ import scala.collection.mutable.Stack import scala.collection.immutable.HashSet import scala.collection.immutable.HashMap import scala.collection.mutable.LatticeOrdering import scala.collection.mutable.GraphLattice object TopType extends MonoType { override def...
Explain and rewrite the following Scala code:
package models.tables import java.sql.Timestamp import java.util.UUID import models.AuthToken import slick.driver.PostgresDriver.api._ import slick.lifted.ProvenShape class AuthTokenTable(tag: Tag) extends Table[AuthToken](tag, "auth_tokens") { def id: Rep[UUID] = column[UUID]("id", O.PrimaryKey) def userID: R...
Explain and rewrite the following Scala code:
/** * This file is part of the TA Buddy project. * Copyright (c) 2013-2015 Alexey Aksenov ezh@ezh.msk.ru * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Affero General Global License version 3 * as published by the Free Software Foundation with the addition...
Explain and rewrite the following Scala code:
package at.logic.gapt.language import at.logic.gapt.expr._ package object schema { type SchemaExpression = LambdaExpression type IntegerTerm = LambdaExpression type IntConst = Const type SchemaFormula = HOLFormula type fo2Var = Var type IntVar = Var }
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 fhj.swengb.project.courseware.controllers.lecture import java.net.URL import java.time.LocalDate import java.util.ResourceBundle import javafx.fxml.FXML import javafx.scene.control.{Label, Button, TextField, DatePicker} import fhj.swengb.project.courseware.components.BaseController import fhj.swengb.project.co...
Explain and rewrite the following Scala code:
package org.higherstate.jameson.parsers import org.higherstate.jameson.Path import org.higherstate.jameson.tokenizers._ import org.higherstate.jameson.failures._ case class MapParser[T](parser:Parser[T]) extends Parser[Map[String,T]] { def parse(tokenizer:Tokenizer, path: Path): Valid[Map[String, T]] = tokeniz...
Explain and rewrite the following Scala code:
/* * Copyright 2001-2013 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:
/* * 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 ...