instruction
stringclasses
1 value
output
stringlengths
5
1M
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 Reactific Software LLC. All Rights Reserved. * * 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 us...
Explain and rewrite the following Scala code:
import java.io.File object Test { Some(new File(".")) .map(_.listFiles).getOrElse(Array.empty) // error: undetermined ClassTag .map(_.listFiles) }
Explain and rewrite the following Scala code:
package utils import tests.UnitSpec import play.api.libs.json.{JsValue, Json} import scala.concurrent.{Future, Await, future} import scala.concurrent.duration.Duration import utils.components.{PersonaServiceComponent, PersonaRequesterComponent} class PersonaServiceSpec extends UnitSpec { implicit val context = sca...
Explain and rewrite the following Scala code:
val x: (Int) => (Int) => String = null x(2)(<caret>) //v1: Int
Explain and rewrite the following Scala code:
package org.bitcoins.core.serializers.p2p.messages import org.bitcoins.core.p2p.TypeIdentifier.MsgTx import org.bitcoins.core.util.BytesUtil import org.bitcoins.crypto.DoubleSha256Digest import org.bitcoins.testkitcore.util.BitcoinSUnitTest /** Created by chris on 6/1/16. */ class RawInventorySerializerTest extends...
Explain and rewrite the following Scala code:
package at.logic.gapt.prooftool import java.awt.Color import at.logic.gapt.proofs.{ DagProof, SequentIndex, SequentProof } import scala.swing.event.Event import scala.swing.{ Color, Component, Publisher, Reactor } class ProofToolPublisher extends Publisher case object ShowLeaf extends Event case object HideLeaf ex...
Explain and rewrite the following Scala code:
package org.scalatra package servlet import javax.servlet.ServletContext import javax.servlet.http.{HttpServletRequest, HttpSession} /** * Some implicits to make the Servlet API more Scala-idiomatic. */ trait ServletApiImplicits { implicit def requestWrapper(r: HttpServletRequest) = RichRequest(r) implicit def ...
Explain and rewrite the following Scala code:
package org.jetbrains.plugins.scala package codeInspection package packageNameInspection import com.intellij.codeInsight.{FileModificationService, CodeInsightUtilBase} import com.intellij.ide.util.PackageUtil import com.intellij.openapi.ui.Messages import com.intellij.refactoring.move.moveClassesOrPackages.{MoveClass...
Explain and rewrite the following Scala code:
package dbpedia.dataparsers.coordinate trait SingleGeoCoordinate { def toDouble : Double; }
Explain and rewrite the following Scala code:
// import required spark classes import org.apache.spark.SparkContext import org.apache.spark.SparkContext._ import org.apache.spark.SparkConf // define main method (scala entry point) object HelloWorld { def main(args: Array[String]) { // initialise spark context val conf = new SparkConf().setAppName("Hell...
Explain and rewrite the following Scala code:
/* * Copyright 2014 Treode, 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...
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 file is part of Kiama. * * Copyright (C) 2011-2015 Anthony M Sloane, Macquarie University. * * Kiama is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the * Free Software Foundation, either version 3 of the License, or ...
Explain and rewrite the following Scala code:
package com.twitter.util import com.twitter.util.Promise.Detachable import org.openjdk.jmh.annotations._ @State(Scope.Benchmark) @Warmup(iterations = 5) @Measurement(iterations = 5) class PromiseBenchmark extends StdBenchAnnotations { private[this] val StringFuture = Future.value("hi") private[this] val Value =...
Explain and rewrite the following Scala code:
package org.orbeon.dom.io import java.io._ import java.{lang ⇒ jl, util ⇒ ju} import org.orbeon.dom._ import org.orbeon.dom.tree.NamespaceStack object XMLWriter { val DefaultFormat = OutputFormat(indent = false, newlines = false, trimText = false) } /** * `XMLWriter` takes a tree and formats it to a stream of c...
Explain and rewrite the following Scala code:
package extruder.circe import cats.Applicative import cats.syntax.applicative._ import extruder.core.{Decoder, ExtruderErrors, HasValue, Parser} import extruder.data.PathElement import io.circe.{Json, Decoder => CDecoder} import shapeless.{<:!<, LowPriority} import cats.syntax.traverse._ import cats.instances.vector._...
Explain and rewrite the following Scala code:
/** * Copyright (c) 2002-2012 "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 Foundati...
Explain and rewrite the following Scala code:
package poly.collection import cats.data._ import cats.implicits._ import poly.collection.exception._ import poly.collection.factory._ import poly.collection.impl._ import poly.collection.mut._ import poly.collection.typeclass._ import scala.language.higherKinds import scala.language.reflectiveCalls /** * The base ...
Explain and rewrite the following Scala code:
package mesosphere import akka.stream.ActorMaterializerSettings import java.util.concurrent.{LinkedBlockingDeque, TimeUnit} import akka.actor.{ActorSystem, Scheduler} import akka.stream.{ActorMaterializer, Materializer} import akka.testkit.{TestActor, TestActorRef, TestKitBase} import akka.util.Timeout import com.mes...
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 2011-2019 Asakusa Framework Team. * * 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 ...
Explain and rewrite the following Scala code:
package fr.hmil.roshttp.node.http import scala.scalajs.js import scala.scalajs.js.annotation.{JSGlobal, JSGlobalScope, JSName} /** * The node http API. * * Server-related stuff not included. * createClient not included because it is deprecated. * * @see https://nodejs.org/api/http.html */ @js.native pri...
Explain and rewrite the following Scala code:
package yuuto.yuutolib.utill import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; class OreIdentifire(ore:String) extends ItemIdentifire{ def getOreName():String={ return ore; } def getOreID():Int={ return OreDictionary.getOreID(ore); } override def matches(sta...
Explain and rewrite the following Scala code:
/* * Copyright (c) 2018. Fengguo Wei and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Apache License v2.0 * which accompanies this distribution, and is available at * https://www.apache.org/licenses/LICENSE-2.0 * * Detailed contributors ar...
Explain and rewrite the following Scala code:
package util /** Yet another random object with a utility function. @author bluebear94 */ object UnescapeString { private def isOctal(c: Char): Boolean = '0' <= c && c < '8' private def isHex(c: Char): Boolean = '0' <= c && c <= '9' || 'A' <= c && c <= 'F' || 'a' <= c && c <= 'f' private def toHexValue(c: C...
Explain and rewrite the following Scala code:
package org.smitt.camel import org.smitt.Endpoint sealed class CamelEndpoint(endpoint: String) extends Endpoint { override def asString: String = endpoint }
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:
package com.arcusys.learn.scorm.manifest.sequencing.storage.impl.liferay import org.specs2.mock.Mockito import org.specs2.matcher.ThrownExpectations import org.specs2.mutable.SpecificationWithJUnit import org.specs2.specification.Scope import com.arcusys.learn.storage.impl.{ EntityStorage, KeyedEntityStorage } import ...
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:
import sbt._ import Keys._ object BuildSettings { val buildSettings = Defaults.defaultSettings ++ Seq ( organization := "org.mybatis.scala", version := "1.0.3", scalaVersion := "2.11.6" ) val mybatisVersion = "3.2.8" } object Resolvers { val sonatypeSnapshots = "Sonatype OSS Snapshots" at "ht...
Explain and rewrite the following Scala code:
/* * hol2folTest.scala */ package at.logic.gapt.expr.fol import at.logic.gapt.expr._ import org.specs2.mutable._ class hol2folTest extends Specification { def imap = Map[Expr, String]() // the scope for most tests is just the term itself def iid = new Counter "HOL terms" should { val hx = Var( "x", Ti -...
Explain and rewrite the following Scala code:
package com.eevolution.context.dictionary.infrastructure.service import java.util.UUID import akka.NotUsed import com.eevolution.context.dictionary.domain._ import com.eevolution.context.dictionary.domain.model.Rule import com.eevolution.utils.PaginatedSequence import com.lightbend.lagom.scaladsl.api.{Service, Servic...
Explain and rewrite the following Scala code:
/* * Copyright (C) 2014 - 2019 Dennis Vriend <https://github.com/dnvriend> * Copyright (C) 2019 - 2021 Lightbend Inc. <https://www.lightbend.com> */ package akka.persistence.jdbc.journal import scala.concurrent.duration._ import akka.persistence.CapabilityFlag import akka.persistence.jdbc.config._ import akka.per...
Explain and rewrite the following Scala code:
package com.twitter.finagle.redis.integration import com.twitter.finagle.builder.ClientBuilder import com.twitter.finagle.redis.protocol.{Limit, _} import com.twitter.finagle.redis.util.{CBToString, RedisCluster, ReplyFormat, StringToChannelBuffer} import com.twitter.finagle.redis.{ClientError, Redis, TransactionalCli...
Explain and rewrite the following Scala code:
/* * Copyright (c) 2010 e.e d3si9n * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish...
Explain and rewrite the following Scala code:
/* sbt -- Simple Build Tool * Copyright 2009 Mark Harrah */ package xsbt.datatype sealed trait Line extends NotNull { val line: Int } final class ClassLine(val name: String, val level: Int, val line: Int) extends Line final class EnumLine(val name: String, val members: Seq[String], val line: Int) extends Line final...
Explain and rewrite the following Scala code:
/* ______________ ___ __ ___ _____ _____ ____ __ ____________ *\\ ** / __/_ __/ __ \\/ _ \\/ |/ / / __/ |/ / _ \\/ __ \\/ / / /_ __/ __/ ** ** _\\ \\ / / / /_/ / , _/ /|_/ / / _// / , _/ /_/ / /_/ / / / / _/ ** ** /___/ /_/ \\____/_/|_/_/ /_/ /___/_/|_/_/|_|\\____/\\____/ /_/ /___/ ** **...
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 utils import org.scalatest.FunSuite import org.junit.runner.RunWith import org.scalatest.junit.JUnitRunner /** * This class is a test suite for the methods in object FunSets. To run * the test suite, you can either: * - run the "test" command in the SBT console * - right-click the file in eclipse and ch...
Explain and rewrite the following Scala code:
package uk.co.grahamcox.oauth import java.util.UUID /** * Representation of a Nonce in the OAuth transaction * @param value The value of the nonce */ class Nonce(val value: String = UUID.randomUUID().toString)
Explain and rewrite the following Scala code:
package org.openapitools.server.model /** * @param nodes for example: ''null'' * @param log for example: ''null'' * @param self for example: ''null'' * @param actions for example: ''null'' * @param steps for example: ''null'' * @param `class` for example: ''null'' */ final case class PipelineRunImpllinks ...
Explain and rewrite the following Scala code:
package ru.primetalk.synapse.core.runtime import ru.primetalk.synapse.core.components.SignalsApi /** Basic definitions for trellis processing*/ trait TrellisApi extends SignalsApi {//with RuntimeSystemApi { /** The simplest signal processor. Corresponds to FlatMap. */ type SimpleSignalProcessor = Signal[_] => Si...
Explain and rewrite the following Scala code:
package akka.persistence.pg.perf import java.util.concurrent.atomic.AtomicInteger import akka.actor.Props import akka.persistence.PersistentActor import akka.persistence.pg.event.{EventWrapper, ExtraDBIOSupport} import akka.persistence.pg.PgPostgresProfile import akka.persistence.pg.perf.Messages.{Altered, Alter} imp...
Explain and rewrite the following Scala code:
/* * Copyright 2015-2016 Snowflake Computing * Copyright 2015 TouchType Ltd * * 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 * * Un...
Explain and rewrite the following Scala code:
package org.scalaide.core.internal.quickassist import org.eclipse.jdt.core.ICompilationUnit import org.eclipse.jdt.ui.JavaUI import org.eclipse.jface.text.IDocument import org.eclipse.ui.texteditor.ITextEditor import org.scalaide.core.internal.quickassist.expand.ExpandingProposalBase import org.scalaide.core.internal....
Explain and rewrite the following Scala code:
/* * Copyright 2014 Intelix Pty Ltd * * 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 unluac.decompile class OpcodeMap { private var map: Array[Op] = null def this(version: Int) { this() if (version == 0x51) { map = new Array[Op](38) map(0) = Op.MOVE map(1) = Op.LOADK map(2) = Op.LOADBOOL map(3) = Op.LOADNIL map(4) = Op.GETUPVAL map(5) = Op...
Explain and rewrite the following Scala code:
package com.pygmalios.reactiveinflux.command.query import java.net.URI import com.pygmalios.reactiveinflux.ReactiveInfluxCommand import com.pygmalios.reactiveinflux.impl.URIUtils abstract class BaseQueryCommand(baseUri: URI) extends ReactiveInfluxCommand { protected val queryUri = URIUtils.appendPath(baseUri, Base...
Explain and rewrite the following Scala code:
package poly.collection.mut import poly.collection._ import poly.collection.typeclass._ import poly.collection.factory._ import poly.collection.impl._ /** * A special implementation of map keyed by integer pairs backed by a 2-D array. * This is efficient when most of the keys lies in the space [0, n) × [0, n) and ...
Explain and rewrite the following Scala code:
/* * BoundedProbFactor.scala * Factors over variables. * * Created By: Avi Pfeffer (apfeffer@cra.com) * Creation Date: Jan 15, 2014 * * Copyright 2013 Avrom J. Pfeffer and Charles River Analytics, Inc. * See http://www.cra.com or email figaro@cra.com for information. * * See http://www.github.com/p2...
Explain and rewrite the following Scala code:
package com.metl.data import com.metl.utils._ import com.metl.model._ import net.liftweb.common._ import net.liftweb.util.Helpers._ import Privacy._ import com.metl.external.ForeignRelationship import net.liftweb.json.{Formats, MappingException, NoTypeHints, Serialization, TypeInfo} import net.liftweb.json.JsonAST._ ...
Explain and rewrite the following Scala code:
package net.spals.appbuilder.app.finatra.sample import com.google.inject.name.Names import com.twitter.inject.TwitterModule /** * A sample [[TwitterModule]] for * [[net.spals.appbuilder.app.finatra.FinatraWebApp#addModule]] * * @author tkral */ private[sample] class SampleFinatraTwitterModule extends Twitte...
Explain and rewrite the following Scala code:
package scalacookbook.chapter04 import org.scalatest.FunSuite /** * Created by liguodong on 2016/9/8. */ class PersonTests extends FunSuite { import section15._ // these first two instances should be equal val nimoy = new Person("Leonard Nimoy", 82) val nimoy2 = new Person("Leonard Nimoy", 82) val sh...
Explain and rewrite the following Scala code:
package com.geeksville.andropilot.gui import android.os.Bundle import scala.collection.JavaConverters._ import com.geeksville.util.ThreadTools._ import android.support.v4.app.Fragment import android.view.LayoutInflater import android.view.ViewGroup import com.ridemission.scandroid.AndroidUtil._ import com.geeksville.a...
Explain and rewrite the following Scala code:
package com.typesafe.sbt.packager.archetypes.scripts import java.io.File import com.typesafe.sbt.packager.Keys._ import com.typesafe.sbt.packager.archetypes.JavaAppPackaging import sbt.Keys.sourceDirectory import sbt._ /** * == Java Application == * * This class is an alternate to JavaAppPackaging designed to ...
Explain and rewrite the following Scala code:
/** * ____ __ ____ ____ ____,,___ ____ __ __ ____ * ( _ \\ /__\\ (_ )(_ _)( ___)/ __) ( _ \\( )( )( _ \\ Read * ) / /(__)\\ / /_ _)(_ )__) \\__ \\ )___/ )(__)( ) _ < README.txt * (_)\\_)(__)(__)(____)(____)(____)(___/ (__) (______)(____/ LICENSE.txt */ ...
Explain and rewrite the following Scala code:
package scala.generator import java.util.UUID import org.joda.time.format.ISODateTimeFormat.dateTimeParser import lib.Datatype import lib.generator.GeneratorUtil import lib.Text.initLowerCase import play.api.libs.json._ import play.api.Logger sealed trait ScalaDatatype { def asString(originalVarName: String): Stri...
Explain and rewrite the following Scala code:
package ckit package rest import spray.json.DefaultJsonProtocol import Binding._ object CkitJsonProtocol extends DefaultJsonProtocol { implicit val SimpleCoreBindingFormat = jsonFormat2(SimpleCoreBinding.apply) implicit val SimpleCoreBindingFormatE = eitherFormat[Int,SimpleCoreBinding] implicit val N...
Explain and rewrite the following Scala code:
/* * Copyright (c) 2014 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.apache.org...
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 controllers import java.util.concurrent.TimeoutException import com.google.inject.Inject import controllers.Payment.AuthorisedStatus import email.{EmailData, EmailFlags, FailureEmailMessageBuilder, ReceiptEmailMessageBuilder, RetainEmailService} import models.{BusinessDetailsModel, CacheKeyPrefix, ConfirmForm...
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:
package de.htwg.zeta.common.format.project.gdsl.style import de.htwg.zeta.common.models.project.gdsl.style.Dashed import de.htwg.zeta.common.models.project.gdsl.style.Dotted import de.htwg.zeta.common.models.project.gdsl.style.Line import de.htwg.zeta.common.models.project.gdsl.style.LineStyle import de.htwg.zeta.comm...
Explain and rewrite the following Scala code:
package com.typesafe.sbt package packager package universal import sbt._ /** Helper methods to package up files into compressed archives. */ object Archives { /** * Makes a zip file in the given target directory using the given name. * @param target folder to build package in * @param name of output (w...
Explain and rewrite the following Scala code:
package edu.msstate.dasi.csb.workload.neo4j import edu.msstate.dasi.csb.workload.Workload import org.apache.spark.graphx.Graph import scala.reflect.ClassTag /** * Collects all incoming edges for each vertex. */ class InEdges(engine: Neo4jEngine) extends Workload { val name = "In-edges" /** * Collects all i...
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 ...
Explain and rewrite the following Scala code:
// Copyright 2013 trananh // // 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:
/* * 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.datastax.spark.connector import com.datastax.oss.driver.api.core.ProtocolVersion import com.datastax.spark.connector.cql._ import com.datastax.spark.connector.mapper.DataFrameColumnMapper import org.apache.spark.SparkContext import org.apache.spark.sql.{Dataset, Encoder} import org.apache.spark.sql.cassand...
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.github.diegopacheco.sandbox.scala.csv.json.main import com.github.tototoshi.csv._ import java.io.File import com.fasterxml.jackson.databind.ObjectMapper import com.fasterxml.jackson.module.scala.DefaultScalaModule import com.fasterxml.jackson.module.scala.OptionModule import com.fasterxml.jackson.module.sc...
Explain and rewrite the following Scala code:
import java.net.URL import java.io.File import java.io.InputStream import java.io.OutputStream import scala.language.reflectiveCalls import scala.language.implicitConversions import org.apache.commons.io.FileUtils import org.apache.commons.io.input.ProxyInputStream import org.apache.commons.io.output.ProxyOutputStream ...
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 scala.collection.mutable import scala.language.{ reflectiveCalls } object Test extends App { def last0(ml: mutable.MutableList[Int]) = ml.asInstanceOf[{def last0: mutable.LinkedList[Int]}].last0 def first0(ml: mutable.MutableList[Int]) = ml.asInstanceOf[{def first0: mutable.LinkedList[Int]}].first...
Explain and rewrite the following Scala code:
package com.eclipsesource.schema.internal.refs import com.eclipsesource.schema.drafts.{Version4, Version7} import com.eclipsesource.schema.internal.constraints.Constraints.Minimum import com.eclipsesource.schema.internal.draft7.constraints.NumberConstraints7 import com.eclipsesource.schema.{JsonSource, SchemaNumber, S...
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:
/* * 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 2015 Mohiva Organisation (license at mohiva dot 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 req...
Explain and rewrite the following Scala code:
package uk.gov.gds.ier.service.apiservice import uk.gov.gds.ier.model._ import uk.gov.gds.ier.model.DateOfBirth import uk.gov.gds.ier.model.IsoNationality import uk.gov.gds.ier.model.PostalVote import uk.gov.gds.ier.model.Name import uk.gov.gds.ier.model.PreviousName import uk.gov.gds.ier.model.Nino import uk.gov.gds....
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.walmartlabs.mupd8 import org.junit.runner.RunWith import org.scalatest.junit.JUnitRunner import org.scalatest.FunSuite import org.scalatest.BeforeAndAfterEach import org.scalatest.mock.MockitoSugar import org.mockito.Mockito._ import org.mockito.Matchers._ import java.io.BufferedReader import java.lang.R...
Explain and rewrite the following Scala code:
/* * Copyright 2015 Heiko Seeberger * * 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-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 org.kimbasoft.akka.router.group import akka.actor.Actor import akka.routing.{Broadcast, FromConfig, RoundRobinGroup} import org.kimbasoft.akka.router.ActorWorker.Exceptions.IllegalRequestException import org.kimbasoft.akka.router.ActorWorker.Messages.{ConfRouterRequest, ProgRouterRequest, RouterRequest, Router...
Explain and rewrite the following Scala code:
// Copyright 2011 Kiela" Hodgesb" package replicant import org.scalatest._ import org.scalatest.matchers._ import org.scalatest.junit.JUnitRunner import org.junit._ import org.junit.runner._ import testing._ @RunWith(classOf[JUnitRunner]) class Mocker2Test extends junit.JUnit3Suite with ShouldMatchers { outer => ...
Explain and rewrite the following Scala code:
/* * ____ ____ _____ ____ ___ ____ * | _ \ | _ \ | ____| / ___| / _/ / ___| Precog (R) * | |_) | | |_) | | _| | | | | /| | | _ Advanced Analytics Engine for NoSQL Data * | __/ | _ < | |___ | |___ |/ _| | | |_| | Copyright (C) 2010 - 2013 SlamData, Inc....
Explain and rewrite the following Scala code:
/* * ____ ____ _____ ____ ___ ____ * | _ \\ | _ \\ | ____| / ___| / _/ / ___| Precog (R) * | |_) | | |_) | | _| | | | | /| | | _ Advanced Analytics Engine for NoSQL Data * | __/ | _ < | |___ | |___ |/ _| | | |_| | Copyright (C) 2010 - 2013 SlamData, In...
Explain and rewrite the following Scala code:
package dk.itu.coqoon.opam import org.osgi.framework.BundleContext import org.eclipse.ui.plugin.AbstractUIPlugin import dk.itu.coqoon.opam.ui.OPAMPreferences class Activator extends AbstractUIPlugin { override def start(context : BundleContext) = { super.start(context) Activator.instance = this } over...
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.typesafe.sbt.packager.docker import org.scalatest._ class DockerApiVersionSpec extends FlatSpec with DiagrammedAssertions { "DockerApiVersion" should "parse 1.40" in { val v = DockerApiVersion.parse("1.40") assert(v == Some(DockerApiVersion(1, 40))) } }
Explain and rewrite the following Scala code:
package com.arcusys.learn.liferay.update.version300.migrations.scorm import com.arcusys.valamis.persistence.common.SlickProfile import com.arcusys.valamis.persistence.impl.scorm.model.ActivityStateNodeModel import com.arcusys.valamis.persistence.impl.scorm.schema.ActivityStateNodeTableComponent import slick.driver.Jdb...
Explain and rewrite the following Scala code:
/* * * * Copyright 2015 Skymind,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 * * * * U...
Explain and rewrite the following Scala code:
package me.reminisce.analysis.difficulty import me.reminisce.analysis.DataTypes._ import me.reminisce.analysis.clustering.cluster.{GeoClusterer, TimeClusterer} import me.reminisce.analysis.clustering.model.{PostGeolocationClusterable, PostTimeClusterable} import me.reminisce.analysis.model.UserSummary import me.remini...
Explain and rewrite the following Scala code:
import scala.quoted.* object Macro { inline def optimize[T](inline x: T): Any = ${ Macro.impl('x) } def impl[T: Type](x: Expr[T])(using Quotes): Expr[Any] = { def optimize(x: Expr[Any]): Expr[Any] = x match { case '{ ($ls: List[t]).filter($f).filter($g) } => optimize('{ $ls.filter(x => $f(x) &...
Explain and rewrite the following Scala code:
package controllers import models.{Vote, Votes} import play.api.Logger import play.api.data.Form import play.api.data.Forms._ import play.api.libs.json.Json import play.api.mvc._ object Application extends Controller { def logger = Logger.logger val voteForm = Form(single("vote" -> number)) def index = Action...
Explain and rewrite the following Scala code:
package Registers import Chisel._ import MicroCodes.MicroCodes._ class RegistersDebugShow extends Bundle{ val rs = UInt(OUTPUT,1024) } class RegisterReadIO extends Bundle{ val reg_id = UInt(INPUT,6) val enable = Bool(INPUT) val reg_data = UInt(OUTPUT,32) val reg_in_use = Bool(OUTPUT) } class RegisterWrite...
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...