instruction
stringclasses
1 value
output
stringlengths
5
1M
Explain and rewrite the following Scala code:
/** * Copyright 2012-2014 Jorge Aliss (jaliss at gmail dot com) - twitter: @jaliss * * 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 *...
Explain and rewrite the following Scala code:
package mesosphere.marathon package json import java.util.concurrent.TimeUnit import mesosphere.marathon.raml.{GroupConversion, Raml} import mesosphere.marathon.state.{AppDefinition, Group, RootGroup, Timestamp} import org.openjdk.jmh.annotations._ import org.openjdk.jmh.infra.Blackhole import play.api.libs.json.{JsV...
Explain and rewrite the following Scala code:
/*********************************************************************** * Copyright (c) 2013-2022 Commonwealth Computer Research, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Apache License, Version 2.0 * which accompanies this distribution and...
Explain and rewrite the following Scala code:
package mypipe import com.typesafe.config.ConfigFactory import mypipe.api.consumer.{BinaryLogConsumer, BinaryLogConsumerListener} import mypipe.api.event.{InsertMutation, Mutation} import mypipe.mysql._ import scala.concurrent.{Await, Future} import scala.concurrent.duration._ import java.util.concurrent.{LinkedBlock...
Explain and rewrite the following Scala code:
package spur.shouty import org.jboss.netty.handler.codec.http.{HttpHeaders, DefaultHttpChunk, DefaultHttpChunkTrailer} import org.jboss.netty.channel.group.{DefaultChannelGroup, ChannelGroupFuture} import org.jboss.netty.channel.{Channel,ChannelFuture,ChannelFutureListener} ...
Explain and rewrite the following Scala code:
package org.rebeam.boxes.graph import Axis._ import GraphMouseEventType._ import java.awt.Color import java.text.DecimalFormat import org.rebeam.boxes.core._ import org.rebeam.boxes.core.BoxScriptImports._ import org.rebeam.boxes.core.BoxTypes._ import org.rebeam.boxes.core.BoxUtils._ import org.rebeam.boxes.swing.Swi...
Explain and rewrite the following Scala code:
// Databricks notebook source // MAGIC %md // MAGIC ScaDaMaLe Course [site](https://lamastex.github.io/scalable-data-science/sds/3/x/) and [book](https://lamastex.github.io/ScaDaMaLe/index.html) // COMMAND ---------- // MAGIC %md // MAGIC # Finding trends in oil price data. // MAGIC // MAGIC Johannes Graner ([Linked...
Explain and rewrite the following Scala code:
package com.jamontes79.scala.movielist.utils import android.content.Context import android.os.Environment import com.jamontes79.database.{DBUtil, DataDictionary} import com.jamontes79.scala.movielist.utils.json.entities.ApiConfiguration import scala.concurrent.Future object MyUtils{ var config = new ApiConfigurati...
Explain and rewrite the following Scala code:
package ml.wolfe.util import cc.factorie.la._ import scala.language.implicitConversions /** * @author rockt */ object PimpMyFactorie { //FIXME: for some reason this methods is not applied implicitly implicit def applyElementwise(fun: Double => Double): (Tensor => Tensor) = { (tensor: Tensor) => for (...
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 not use this f...
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:
// Solution-2.scala // Solution to Exercise 2 in "map & reduce" import com.atomicscala.AtomicTest._ val v = Vector(1, 2, 3, 4) // This doesn't produce a result: v.foreach(n=>((n*11) + 10)) is Vector(21, 32, 43, 54) /* OUTPUT_SHOULD_BE () [Error] expected: Vector(21, 32, 43, 54) */
Explain and rewrite the following Scala code:
package cobase.play.user import javax.inject.Inject import cobase.group.GroupService import cobase.post.PostService import cobase.user.User import com.mohiva.play.silhouette.api.{Environment, Silhouette} import com.mohiva.play.silhouette.impl.authenticators.CookieAuthenticator import play.api.i18n.MessagesApi import ...
Explain and rewrite the following Scala code:
/* * Copyright 2015-2016 IBM Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agree...
Explain and rewrite the following Scala code:
package pimpathon.java.util.concurrent import java.util.concurrent.ThreadFactory import pimpathon.PSpec import pimpathon.any._ import pimpathon.java.util.concurrent.threadFactory._ class ThreadFactorySpec extends PSpec { "naming" in basic.naming("name:" + _).calc(factory ⇒ { factory.newThread(runnable).getName...
Explain and rewrite the following Scala code:
package gitbucket.core.ssh import java.security.PublicKey import gitbucket.core.service.{DeployKeyService, SshKeyService} import gitbucket.core.servlet.Database import gitbucket.core.model.Profile.profile.blockingApi._ import gitbucket.core.ssh.PublicKeyAuthenticator.AuthType import org.apache.sshd.server.auth.pubkey...
Explain and rewrite the following Scala code:
/* * Copyright 2014 Databricks * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
Explain and rewrite the following Scala code:
import sbt._ import Keys._ import play.Project._ object ApplicationBuild extends Build { val appName = "BookServer" val appVersion = "1.0-SNAPSHOT" val appDependencies = Seq( jdbc, anorm, "org.reactivemongo" %% "play2-reactivemongo" % "0.9" ) val main = play.Project(appName, appVersion, appDependencies)....
Explain and rewrite the following Scala code:
package org.trustedanalytics.sparktk.frame.internal.ops.statistics.descriptives import org.trustedanalytics.sparktk.frame.internal.{ FrameState, FrameSummarization, BaseFrame } import org.trustedanalytics.sparktk.frame.internal.rdd.FrameRdd trait CategoricalSummarySummarization extends BaseFrame { /** * Compute ...
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.quoted.* object Macro_1: inline def stringLiteral(inline s: String): String = ${showExpr('s)} def showExpr(s: Expr[?])(using Quotes): Expr[String] = Expr(s.show.toString)
Explain and rewrite the following Scala code:
package com.github.vitalsoftware.scalaredox.models import org.joda.time.DateTime import com.github.vitalsoftware.util.JsonImplicits.jodaISO8601Format import com.github.vitalsoftware.macros._ import com.github.vitalsoftware.util.RobustPrimitives /** * Medication to be given. */ @jsonDefaults case class MedicationPla...
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 model import db.Tables.{PredictionRow, TxRow} import db.{DB, Tables} import org.joda.time.{DateTime} import slick.driver.PostgresDriver.api._ import scala.concurrent.ExecutionContext.Implicits.global import DB.Implicits._ object Performance { def storePredictions(predictor: Predictor, txs: Seq[TxRow]): Uni...
Explain and rewrite the following Scala code:
package org.jetbrains.plugins.scala package lang package folding import com.intellij.lang.ASTNode import com.intellij.lang.folding.{CustomFoldingBuilder, FoldingDescriptor} import com.intellij.openapi.editor.{Document, FoldingGroup} import com.intellij.openapi.project.PossiblyDumbAware import com.intellij.openapi.util...
Explain and rewrite the following Scala code:
/* * Copyright (c) 2013-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://...
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:
/* * Copyright 2016 The BigDL Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agr...
Explain and rewrite the following Scala code:
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you ...
Explain and rewrite the following Scala code:
/** * Copyright (C) 2016 Hurence (bailet.thomas@gmail.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 ...
Explain and rewrite the following Scala code:
//====================================================================================================================== // Facsimile: A Discrete-Event Simulation Library // Copyright © 2004-2020, Michael J Allen. // // This file is part of Facsimile. // // Facsimile is free software: you can redistribute it and/or mod...
Explain and rewrite the following Scala code:
package it.polimi.genomics.spark.implementation.RegionsOperators.GenometricMap import com.google.common.hash.Hashing import it.polimi.genomics.core.DataStructures.RegionAggregate import it.polimi.genomics.core.DataTypes._ import it.polimi.genomics.core.{GDouble, GNull, GRecordKey, GValue} import it.polimi.genomics.cor...
Explain and rewrite the following Scala code:
package com.github.ldaniels528.scalascript.extensions import com.github.ldaniels528.scalascript.core.HttpPromise import org.scalajs.dom._ import scala.scalajs.js /** * AngularJS File Upload * @author lawrence.daniels@gmail.com */ @js.native trait FileUpload extends js.Object { def upload[T <: js.Any](config: Fi...
Explain and rewrite the following Scala code:
package cookbook.core // fintrospect-core object Combining_Modules_Example extends App { import com.twitter.finagle.http.Method.Get import com.twitter.finagle.http.path.Root import com.twitter.finagle.http.{Request, Response} import com.twitter.finagle.{Http, Service} import com.twitter.util.Await.ready i...
Explain and rewrite the following Scala code:
package com.pfalabs.tiny.dao import javax.persistence.{ Column, Entity, Id, Table } import scala.beans.BeanProperty @Entity @Table(name = "tokens") class Token extends Serializable { @Id @Column @BeanProperty var id: Int = _ @BeanProperty @Column(length = 150, nullable = false) var token: String = nu...
Explain and rewrite the following Scala code:
package maker.utils import java.io.{File, FileInputStream, FileOutputStream} import java.util.jar.{JarEntry, JarOutputStream} import java.util.zip.ZipEntry import maker.utils.FileUtils._ object BuildJar{ type ErrorMessage = String def build(jarFile : File, directories : Seq[File], fileFilter: File => Boolean = ...
Explain and rewrite the following Scala code:
package wordCount1 import akka.actor.Actor import akka.actor.Props object AggregateActor { def props = Props[AggregateActor] } class AggregateActor extends Actor { var finalReduceMap = Map.empty[String, Int] def receive: Receive = { case ReduceData(data) => aggregate(data) case Result => ...
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 2016 Coursera Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed t...
Explain and rewrite the following Scala code:
package no.nextgentel.oss.akkatools.cluster import akka.actor.{Actor, ActorRef, ActorSystem, Props} import akka.testkit.{TestKit, TestProbe} import com.typesafe.config.ConfigFactory import org.scalatest.{BeforeAndAfter, BeforeAndAfterAll, FunSuiteLike, Matchers} import org.slf4j.LoggerFactory import scala.uti...
Explain and rewrite the following Scala code:
package net.fwbrasil.radon.problems import scala.util.Random import org.junit.runner._ import org.specs2.runner._ import org.specs2.mutable._ import net.fwbrasil.radon.TestRadonContext._ import Thread._ @RunWith(classOf[JUnitRunner]) class BankFrenzy extends Specification { case class Transfer(amount: ...
Explain and rewrite the following Scala code:
package uk.co.odinconsultants.bitcoin.integration.spark import org.apache.spark.{SparkConf, SparkContext} object SparkForTesting { val master: String = "local[*]" val appName: String = "Tests" val sparkConf: SparkConf = new SparkConf().setMaster(master).setAppName(appName) val sc: SparkContext = Sp...
Explain and rewrite the following Scala code:
/* * SubsumptionAlgorithm.scala * */ package at.logic.gapt.proofs.lk.algorithms.subsumption import at.logic.gapt.proofs.lk.base.FSequent trait SubsumptionAlgorithm { /** * A predicate which is true iff s2 is subsumed by s1. * @param s1 a clause * @param s2 a clause * @return true iff s1 subsumes s2 ...
Explain and rewrite the following Scala code:
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\\ * @ @ * * # # # # (c) 2017 CAB * * # # # # # # ...
Explain and rewrite the following Scala code:
package almond.logger.internal import almond.logger.Level object NopLogger extends ActualLogger { def level: Level.None.type = Level.None def log(level: Level, message: String, exception: Throwable): Unit = () }
Explain and rewrite the following Scala code:
package com.rasterfoundry.datamodel import io.circe._ import cats.syntax.either._ sealed abstract class ExportType(val repr: String) { override def toString = repr } object ExportType { case object Dropbox extends ExportType("DROPBOX") case object S3 extends ExportType("S3") case object Local extends ExportT...
Explain and rewrite the following Scala code:
package models import java.sql.Timestamp import java.time.Instant import play.api.db.slick.Config.driver.simple._ package object db { implicit val InstantColumnType = MappedColumnType.base[Instant, Timestamp]( { i => Timestamp.from(i)}, { t => t.toInstant} ) }
Explain and rewrite the following Scala code:
package org.fuckboi class BranchStatementTest extends FuckboiGeneratorTest { it should "function using simple if statements" in { val code = "NETFLIX\\n" + "YO vartrue\\n" + "ASL? @FINALLY THE TRUTH\\n" + "PLEASE? vartrue\\n" + "IS IT TOO LATE NOW TO SAY SORRY? \\"this branc...
Explain and rewrite the following Scala code:
/*********************************************************************** * Copyright (c) 2013-2018 Commonwealth Computer Research, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Apache License, Version 2.0 * which accompanies this distribution and...
Explain and rewrite the following Scala code:
package com.twitter.finatra.http.internal.marshalling import com.fasterxml.jackson.databind.node.ObjectNode import com.google.inject.Injector import com.twitter.finagle.httpx.Request import com.twitter.finatra.conversions.string._ import com.twitter.finatra.http.exceptions.BadRequestException import com.twitter.finatr...
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 scalanlp.stats package distributions /* Copyright 2009 David Hall, Daniel Ramage 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 teleporter.integration.core import java.nio.file.{Files, Paths} import akka.actor.{Actor, ActorRef} import akka.stream.scaladsl.{FileIO, Source} import akka.util.ByteString import org.apache.commons.lang.StringUtils import org.apache.logging.log4j.scala.Logging import teleporter.integration.cache.{PersistentC...
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:
/* * Copyright 2016 Stefan Roehrbein * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agree...
Explain and rewrite the following Scala code:
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may ...
Explain and rewrite the following Scala code:
package net.flatmap.cobra import java.nio.ByteBuffer import boopickle.Default._ import net.flatmap.collaboration._ import scala.util.matching.Regex sealed trait ClientMessage sealed trait ServerMessage sealed trait SnippetMessage { val id: String } case object HeartBeat extends ClientMessage with ServerMessage ca...
Explain and rewrite the following Scala code:
/* * Copyright (c) 2014-2021 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:
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: /** @author John Miller, Zhe Jin * @version 1.3 * @date Sat Apr 30 13:53:16 EDT 2015 * @see LICENSE (MIT style license file). */ package scalation.analytics.classifier.par import java.util.concurrent.ForkJoinPool import scala.coll...
Explain and rewrite the following Scala code:
package com.twitter.finagle.netty4 import com.twitter.finagle.Stack import com.twitter.finagle.toggle.flag import java.net.SocketAddress import org.junit.runner.RunWith import org.scalatest.FunSuite import org.scalatest.junit.JUnitRunner @RunWith(classOf[JUnitRunner]) class Netty4ToggleTest extends FunSuite { test...
Explain and rewrite the following Scala code:
package breeze.signal.support import breeze.signal.{filterMedian, OptOverhang} import breeze.stats._ import breeze.linalg.{convert, DenseVector} import breeze.macros.expand import scala.collection.mutable import breeze.numerics.isOdd /**A relatively optimized median filter, using TreeSet * @author ktakagaki * @date...
Explain and rewrite the following Scala code:
package fr.inria.spirals.sigma.ttc14.fixml.objlang.support import fr.inria.spirals.sigma.ttc14.fixml.objlang.ArrayLiteral; import fr.inria.spirals.sigma.ttc14.fixml.objlang.Classifier; import fr.inria.spirals.sigma.ttc14.fixml.objlang.Constructor; import fr.inria.spirals.sigma.ttc14.fixml.objlang.ConstructorCall; impo...
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 Test extends App { def f(x: { type D; def m: D }): Null = null class Tata abstract class Toto[A <: Object] { type B <: Object def f1[C <: Object](x: Object{ type D <: Object; def m[E >: Null <: Object](x: A): Object; val x: A }) = x.m[Tata](x.x) //fail def f2[C <: Object](x: Object{ type D ...
Explain and rewrite the following Scala code:
package scalaz.netty import java.util.concurrent.atomic.AtomicLong import io.netty.channel.ChannelConfig import scalaz.concurrent.{Strategy, Task} import scalaz.stream._ /** * A wrapper around async queue to implement back pressure by means of calling Netty's ChannelConfig.setAutoRead when needed. * * @param limi...
Explain and rewrite the following Scala code:
package structures package laws package discipline import org.typelevel.discipline.scalatest.Discipline import org.scalatest.FunSuite import org.scalacheck.Arbitrary import structures.std._ class LawTests extends FunSuite with Discipline { checkAll("Byte", MonoidDiscipline[Byte].monoid) checkAll("Short", MonoidD...
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 package dotc package typer import core._ import ast.{Trees, untpd, tpd, TreeInfo} import Contexts._ import Types._ import Flags._ import NameOps._ import Symbols._ import Decorators._ import Names._ import StdNames._ import Trees._ import Inferencing._ import util.Positions._ import collection.muta...
Explain and rewrite the following Scala code:
/* ************************************************************************************* * Copyright 2011 Normation SAS ************************************************************************************* * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in complian...
Explain and rewrite the following Scala code:
package argonaut object StringWrapMonocle extends StringWrapMonocles trait StringWrapMonocles { }
Explain and rewrite the following Scala code:
/* ASIB - A Scala IRC Bot Copyright (C) 2012 Iain Cambridge This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later versio...
Explain and rewrite the following Scala code:
package coursier.publish.fileset import java.nio.charset.StandardCharsets import java.time.{Instant, ZoneOffset} import coursier.publish import coursier.publish.{Content, Pom} import coursier.publish.dir.DirContent import coursier.core.{ModuleName, Organization, Version} import coursier.maven.MavenRepository import c...
Explain and rewrite the following Scala code:
package beam.agentsim.agents.ridehail.allocation import beam.agentsim.agents.ridehail.RideHailManager.{PoolingInfo} import beam.agentsim.agents.ridehail.RideHailVehicleManager.RideHailAgentLocation import beam.agentsim.agents.ridehail.{RideHailManager, RideHailRequest} import beam.agentsim.agents.vehicles.VehicleProto...
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.nulabinc.backlog.migration.service import com.google.inject.Guice import com.nulabinc.backlog.migration.common.client.params.ImportIssueParams import com.nulabinc.backlog.migration.common.conf.BacklogApiConfiguration import com.nulabinc.backlog.migration.common.modules.DefaultModule import com.nulabinc.bac...
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:
/* * Copyright 2015-2016 IBM Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agree...
Explain and rewrite the following Scala code:
package org.zhutou.skeeter import scala.collection.mutable.Map import io.netty.channel.nio.NioEventLoopGroup import io.netty.channel.socket.nio.NioServerSocketChannel import io.netty.bootstrap.ServerBootstrap import io.netty.channel._ import io.netty.channel.socket.SocketChannel import io.netty.util.concurrent.Defaul...
Explain and rewrite the following Scala code:
package ece.chrome import ece.{Utils, EncryptedContext} import scala.util.{Try, Success, Failure} import org.apache.commons.codec.binary.Base64 import java.security.{PublicKey, KeyPair} import javax.crypto.Cipher import javax.crypto.spec.{GCMParameterSpec, SecretKeySpec} object Codec { val PRKLengthBytes = 32 val...
Explain and rewrite the following Scala code:
/* * Part of NDLA article-api. * Copyright (C) 2017 NDLA * * See LICENSE */ package db.migration import no.ndla.articleapi.model.domain.ArticleType import org.flywaydb.core.api.migration.{BaseJavaMigration, Context} import org.json4s.JsonAST.JString import org.json4s.native.JsonMethods.{compact, parse, render} i...
Explain and rewrite the following Scala code:
/* * Copyright (c) 2015-2017 EpiData, Inc. */ package com.epidata.lib.models import java.sql.Timestamp import java.util.{ Date, Map => JMap, LinkedHashMap => JLinkedHashMap, LinkedList => JLinkedList } import java.lang.{ Long => JLong, Double => JDouble } import com.datastax.driver.core.Row import com.epidata.lib.m...
Explain and rewrite the following Scala code:
object opassign { var count: Int = 0 def next = { count += 1; count } var x: Int = 0 x += 1 { var x: Int = 0 x += 1 } class Ref { var x: Int } val r = new Ref r.x += 1 val arr = new Array[Int](10) arr(0) += 1 def f(x: Int): Ref = new Ref f(next).x += 1 val buf...
Explain and rewrite the following Scala code:
/* * Copyright (c) 2016 SnappyData, Inc. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); you * may not use this file except in compliance with the License. You * may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by ap...
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:
import sbt._ import Keys._ /** * based on https://github.com/harrah/xsbt/wiki/Getting-Started-Multi-Project */ object TopBuild extends Build { // aggregate: running a task on the aggregate project will also run it on the aggregated projects. // dependsOn: a project depends on code in another project. // witho...
Explain and rewrite the following Scala code:
/* Copyright 2013 Originate 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 ...
Explain and rewrite the following Scala code:
package cromwell.database.migration.metadata.table.symbol import java.sql.PreparedStatement import wom.values.WomValue class CallOutputSymbolTableMigration extends SymbolTableMigration { override def processSymbol(statement: PreparedStatement, workflowUuid: 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"); yo...
Explain and rewrite the following Scala code:
package org.jetbrains.plugins.scala.injection import com.intellij.openapi.util.io.FileUtil import com.intellij.openapi.util.text.StringUtil import com.intellij.util.ThrowableRunnable import junit.framework.TestSuite import org.intellij.lang.regexp.RegExpLanguage import org.jetbrains.plugins.scala.injection.RegexpLang...
Explain and rewrite the following Scala code:
package extruder.metrics.dimensional import cats.kernel.Monoid case class ResetNamespace[T](value: T) extends AnyVal object ResetNamespace { implicit def monoid[A](implicit A: Monoid[A]): Monoid[ResetNamespace[A]] = new Monoid[ResetNamespace[A]] { override def empty: ResetNamespace[A] = ResetNamespace[A](A.emp...
Explain and rewrite the following Scala code:
/** * Swaggy Jenkins * Jenkins API clients generated from Swagger / Open API specification * * The version of the OpenAPI document: 1.1.2-pre.0 * Contact: blah@cliffano.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not ed...
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.ViewAttributeTrl import com.eevolution.utils.PaginatedSequence import com.lightbend.lagom.scaladsl.api.{Ser...
Explain and rewrite the following Scala code:
// code-examples/AppDesign/options-nulls/option-for-comp-script.scala case class User(userName: String, name: String, email: String, bio: String) val newUserProfiles = List( Map("userName" -> "twitspam", "name" -> "Twit Spam"), Map("userName" -> "bucktrends", "name" -> "Buck Trends", "email" -> "thebuck@sto...
Explain and rewrite the following Scala code:
package viper.carbon.modules.impls import org.scalatest.GivenWhenThen import viper.carbon.modules._ import viper.carbon.modules.components.{TransferComponent, DefinednessComponent} import viper.carbon.verifier.Verifier import viper.carbon.boogie._ import viper.carbon.boogie.Implicits._ import viper.silver.ast.utility...
Explain and rewrite the following Scala code:
package org.scalacheck.ops import org.scalacheck.{Arbitrary, Gen} import org.scalatest.FreeSpec class ArbitraryAsGenSpec extends FreeSpec { private val it = classOf[ArbitraryAsGen].getSimpleName s"$it should implicitly convert a Gen to Arbitrary" in { def f(arb: Arbitrary[Char]): Unit = () f(Gen.numChar...
Explain and rewrite the following Scala code:
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may ...
Explain and rewrite the following Scala code:
/* * Copyright 2001-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:
/* 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 org.locationtech.geomesa.stream.datastore import java.nio.charset.StandardCharsets import java.util.concurrent.atomic.AtomicLong import com.google.common.io.Resources import org.apache.commons.io.IOUtils import org.apache.commons.net.DefaultSocketFactory import org.geotools.data.DataStoreFinder import org.geo...
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 ...