instruction
stringclasses
1 value
output
stringlengths
5
1M
Explain and rewrite the following Scala code:
package org.jetbrains.plugins.scala package lang package parser package parsing package expressions import org.jetbrains.plugins.scala.lang.parser.parsing.builder.ScalaPsiBuilder /** * @author Alexander Podkhalyuzin * Date: 03.03.2008 */ /* * PrefixExpr ::= ['-' | '+' | '~' | '!'] SimpleExpr */ object PrefixExpr ...
Explain and rewrite the following Scala code:
package com.datamountaineer.streamreactor.connect.influx.converters import com.datamountaineer.streamreactor.connect.influx.helpers.Util import com.datamountaineer.streamreactor.connect.influx.writers.KcqlDetails.Path import com.datamountaineer.streamreactor.connect.influx.writers.ValuesExtractor import com.fasterxml....
Explain and rewrite the following Scala code:
package com.flowy.common.models import java.time.OffsetDateTime import java.util.UUID case object TrailingStopLossRegistration case object BittrexWebsocketClientRegistration case class PriceCheck(exchangeName: Exchange.Value, marketName: String, price: BigDecimal) case class TradeHistory(id: UUID, ...
Explain and rewrite the following Scala code:
package akka.persistence.cassandra.snapshot trait CassandraStatements { def config: CassandraSnapshotStoreConfig def createKeyspace = s""" CREATE KEYSPACE IF NOT EXISTS ${config.keyspace} WITH REPLICATION = { 'class' : ${config.replicationStrategy} } """ def createTable = s""" CREATE TABL...
Explain and rewrite the following Scala code:
package examples.hzip import org.scalatest._ import org.scalatest.concurrent.ScalaFutures class HsequenceSpec extends FlatSpec with Matchers with ScalaFutures { import shapeless._ import scala.concurrent.ExecutionContext.Implicits.global import scala.concurrent.Future._ "hsequence" should "calculate hzip of h...
Explain and rewrite the following Scala code:
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may ...
Explain and rewrite the following Scala code:
package org.leialearns.crystallize.expectations import grizzled.slf4j.Logging import org.leialearns.crystallize.item.Item import org.leialearns.crystallize.model.ItemCounts import org.leialearns.crystallize.util.{Dump, Oracle, OrderedRational, Rational} import org.leialearns.crystallize.util.Rational._ object ItemCou...
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.twitter.finagle.param import com.twitter.finagle.Stack import com.twitter.finagle.factory.TimeoutFactory import com.twitter.util.Duration /** * A collection of methods for configuring sessions of the Finagle clients. * * Session might be viewed as logical connection that wraps a physical connection * ...
Explain and rewrite the following Scala code:
package model import scala.slick.driver.MySQLDriver.simple._ import scala.slick.ast.ColumnOption.{Default, NotNull} /** *  CREATE TABLE IF NOT EXISTS `wordnet31_snapshot`.`words` ( `wordid` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0', `lemma` VARCHAR(80) NOT NULL, PRIMARY KEY (`wordid`), UNIQUE INDEX `unq_wor...
Explain and rewrite the following Scala code:
package com.googlecode.kanbanik.model abstract class DocumentField extends Enumeration { val id = Value("_id") val name = Value("name") val version = Value("version") }
Explain and rewrite the following Scala code:
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may ...
Explain and rewrite the following Scala code:
/* * Copyright 2022 HM Revenue & Customs * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or a...
Explain and rewrite the following Scala code:
/* * Copyright 2015 University of Basel, Graphics and Vision Research Group * * 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 * * Unl...
Explain and rewrite the following Scala code:
/* * Copyright 2016 Spotify AB. * * 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:
package org.scalajs.core.compiler.test import org.scalajs.core.compiler.test.util._ import org.junit.Test import org.junit.Ignore // scalastyle:off line.size.limit class JSInteropTest extends DirectTest with TestHelpers { override def preamble: String = """ import scala.scalajs.js import scala.scalaj...
Explain and rewrite the following Scala code:
package edu.umass.cs.iesl.apassos import cc.factorie.app.nlp._ import cc.factorie.app.nlp.load._ import cc.factorie.app.nlp.mention.{MentionType, Mention, MentionList} import cc.factorie.app.nlp.coref.{EntityKey, ConllCorefLoader} import cc.factorie.app.nlp.hcoref.{EntityVariable, EntityRef} /** * User: apassos * D...
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 2006-2010 WorldWide Conferencing, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applica...
Explain and rewrite the following Scala code:
package uk.gov.gds.ier.transaction.complete import uk.gov.gds.ier.mustache.InheritedGovukMustache import uk.gov.gds.ier.guice.{WithRemoteAssets, WithConfig} import uk.gov.gds.ier.service.apiservice.EroAuthorityDetails import uk.gov.gds.ier.langs.Messages import play.api.i18n.Lang trait CompleteMustache { self: With...
Explain and rewrite the following Scala code:
class Macros { class Macros { def foo: Unit = macro Impls.foo } } object Test extends App { val outer = new Macros() new outer.Macros().foo }
Explain and rewrite the following Scala code:
/** * Copyright (C) 2009-2017 Lightbend Inc. <http://www.lightbend.com> */ package akka.actor.dungeon import akka.dispatch.sysmsg.{ Unwatch, Watch, DeathWatchNotification } import akka.event.Logging.{ Warning, Debug } import akka.actor.{ InternalActorRef, Address, Terminated, Actor, ActorRefScope, ActorCell, ActorR...
Explain and rewrite the following Scala code:
/* * Copyright (C) 2016-2019 Lightbend Inc. <https://www.lightbend.com> */ package com.lightbend.lagom.dev import java.io.Closeable import java.io.File import java.net.URI import java.net.URL import java.util.concurrent.CompletableFuture import java.util.concurrent.CompletionStage import java.util.concurrent.TimeUn...
Explain and rewrite the following Scala code:
package beam.replanning.utilitybased import beam.agentsim.agents.memberships.HouseholdMembershipAllocator import beam.agentsim.agents.vehicles.BeamVehicle import beam.replanning.utilitybased.ChainBasedTourVehicleAllocator.{SubtourRecord, VehicleRecord, VehicleRecordFactory} import beam.router.Modes import beam.router....
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 beam.agentsim.agents.household import java.util.concurrent.TimeUnit import akka.actor.FSM.Failure import akka.actor.SupervisorStrategy.Stop import akka.actor.{Actor, ActorLogging, ActorRef, OneForOneStrategy, Props, Status, Terminated} import akka.pattern._ import akka.util.Timeout import beam.agentsim.Resour...
Explain and rewrite the following Scala code:
package json.schema import java.net.{URI, URISyntaxException} import argonaut.Argonaut._ import argonaut.{ACursor, HCursor, Json} import json.pointer.JsonPointer import json.reference.ReferenceResolver import scala.util.control.Exception import scalaz.\\/ package object scope { private[scope] trait JsonTraverser...
Explain and rewrite the following Scala code:
import sbt._ object Dependencies { object v { final val Logback = "1.2.3" final val Slf4j = "1.7.25" final val ScalaTest = "3.0.4" final val Trove4j = "3.0.3" } lazy val Logback = "ch.qos.logback" % "logback-classic" % v.Logback lazy val Slf4j = "org.slf4j" % "slf4j-api" % v.Slf4j la...
Explain and rewrite the following Scala code:
/* * Copyright 2015 – 2016 Martin Seeler * * 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:
/* * sbt * Copyright 2011 - 2018, Lightbend, Inc. * Copyright 2008 - 2010, Mark Harrah * Licensed under Apache License 2.0 (see LICENSE) */ package sbt.internal.graph.rendering import org.scalatest.flatspec.AnyFlatSpec import org.scalatest.matchers.should.Matchers import sbt.internal.graph.rendering.TreeView.cre...
Explain and rewrite the following Scala code:
import stainless.lang._ import stainless.annotation._ object GhostOverrides { abstract class Test { @ghost def doStuff(x: BigInt): BigInt } case class GhostTest() extends Test { @ghost override def doStuff(x: BigInt): BigInt = { x + 1 } } case class NonGhostTest() extends Test { ...
Explain and rewrite the following Scala code:
package uk.gov.gds.ier.transaction.forces.address import uk.gov.gds.ier.test.FormTestSuite import uk.gov.gds.ier.model.HasAddressOption class AddressFirstFormTests extends FormTestSuite with AddressForms with AddressFirstForms { it should "error out on empty input" in { val js = JsNull addressFirstFo...
Explain and rewrite the following Scala code:
package com.github.diegopacheco.sandbox.scala.akka.cluster.advanced import akka.actor._ import akka.cluster.ClusterEvent.ClusterDomainEvent import com.github.diegopacheco.sandbox.scala.akka.util.{TimeUtils, ClusterUtils} object AdvancedClusterAppNodeA { def main(args:Array[String]):Unit = { val (cluster,syst...
Explain and rewrite the following Scala code:
object App2 { inline def power(x: Long, n: Int): Long = { if (n == 0) 1L else if (n % 2 == 1) x * power(x, n - 1) else { val y: Long = x * x power(y, n / 2) } } val x: Long = 5L power(x, 10) // def badPower(x: Long, n: Int): Long = { // power(x, n) // error: Maxi...
Explain and rewrite the following Scala code:
package org.bitcoins.protocol.script import org.bitcoins.util.{TestUtil, BitcoinjConversions, BitcoinJTestUtil, BitcoinSUtil} import org.scalatest.{FlatSpec, MustMatchers} /** * Created by chris on 3/2/16. */ class ScriptPubKeyFactoryTest extends FlatSpec with MustMatchers { "ScriptPubKeyFactory" must "create a ...
Explain and rewrite the following Scala code:
/* * Copyright (C) 2016 Typesafe Inc. <http://www.typesafe.com> */ package akka.persistence.cassandra.query.scaladsl import scala.concurrent.duration._ import akka.actor.{ Props, ActorSystem } import akka.stream.scaladsl.Sink import akka.stream.ActorMaterializer import akka.testkit.{ ImplicitSender, TestKit } import...
Explain and rewrite the following Scala code:
/* * Copyright 2022 HM Revenue & Customs * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or a...
Explain and rewrite the following Scala code:
package scorex.transaction import scorex.block.{BlockProcessingModule, Block} trait TransactionModule[TransactionBlockData] extends BlockProcessingModule[TransactionBlockData]{ val state: State val history: History def isValid(block: Block):Boolean def transactions(block: Block): Seq[Transaction] def p...
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.twitter.finagle.zookeeper import com.twitter.conversions.DurationOps._ import com.twitter.finagle.{Announcer, Addr, Address} import com.twitter.util.{Await, Duration, Var} import java.io.{InputStreamReader, BufferedReader} import java.net.{InetSocketAddress, URL} import org.scalactic.source.Position import...
Explain and rewrite the following Scala code:
package org.jetbrains.plugins.scala package editor.smartEnter.fixers import com.intellij.openapi.editor.Editor import com.intellij.psi._ import com.intellij.util.text.CharArrayUtil import org.jetbrains.plugins.scala.editor.smartEnter.ScalaSmartEnterProcessor import org.jetbrains.plugins.scala.lang.psi.api.expr.{ScExpr...
Explain and rewrite the following Scala code:
package com.incra import org.apache.log4j.{Level, Logger} import scopt.OptionParser import breeze.linalg.{DenseVector, squaredDistance} import org.apache.spark.{SparkConf, SparkContext} import org.apache.spark.SparkContext._ import org.apache.spark.mllib.clustering.KMeans import org.apache.spark.mllib.linalg.{Vecto...
Explain and rewrite the following Scala code:
package validation import org.scalatest.FunSuite import org.junit.runner.RunWith import org.scalatest.junit.JUnitRunner import Arithmetic.P31.P31._ @RunWith(classOf[JUnitRunner]) class P31TestSuite extends FunSuite { test("7.isPrime should return true") { assert(7.isPrime === true) } test("2.isPrime shoul...
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.szadowsz.starform import com.szadowsz.starform.profile.starform.FoggProfile import com.szadowsz.starform.sim.FoggSimulation import org.slf4j.{Logger, LoggerFactory} /** * A Modification of DoleAccretionTestCase. Simple Application to generate and print off planets to the logs. * * @author Zakski : 0...
Explain and rewrite the following Scala code:
class Issue10 { def compiles: Unit = {} }
Explain and rewrite the following Scala code:
/* * EitherWriter.scala * (Serial) * * Copyright (c) 2011-2021 Hanns Holger Rutz. All rights reserved. * * This software is published under the GNU Lesser General Public License v2.1+ * * * For further information, please contact Hanns Holger Rutz at * contact@sciss.de */ package de.sciss.serial package i...
Explain and rewrite the following Scala code:
package com.nummulus.amqp.driver.blackbox import scala.concurrent.Promise private[blackbox] sealed trait BlackBoxMessage private[blackbox] case class TellMessage(message: String) private[blackbox] case class AskMessage(message: String, promise: Promise[String])
Explain and rewrite the following Scala code:
/** * An example MapReduce application using Scala and HBase. * * * The MIT License (MIT) * * Copyright (c) 2014 Jeremy Fisher * * 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 Sof...
Explain and rewrite the following Scala code:
/* sbt -- Simple Build Tool * Copyright 2009 Mark Harrah */ package sbt.extract import java.io.{ByteArrayOutputStream, File} import FileUtilities.{classLocationFile, clean, createTemporaryDirectory, download, transferAndClose, unzip, write, zip} import SelfExtractingProject.{flat, separator} trait SelfExtractingPro...
Explain and rewrite the following Scala code:
/*§ =========================================================================== GraphsJ =========================================================================== Copyright (C) 2009-2017 Gianluca Costa =========================================================================== Licensed under the Apache Lic...
Explain and rewrite the following Scala code:
/* * Copyright 2013 http4s.org * * 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:
package org.jetbrains.plugins.scala.failed.resolve import org.jetbrains.plugins.scala.PerfCycleTests import org.jetbrains.plugins.scala.lang.psi.api.base.ScReferenceElement import org.junit.Assert._ import org.junit.experimental.categories.Category /** * @author Nikolay.Tropin */ @Category(Array(classOf[PerfCycle...
Explain and rewrite the following Scala code:
package quizleague.web.site.team import quizleague.web.core._ import quizleague.web.core.RouteConfig import scalajs.js import js.JSConverters._ import quizleague.web.service.team.TeamGetService import quizleague.web.service.statistics.StatisticsGetService import quizleague.web.site.text.TextService import quizleague....
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 2016 Thomas Puhl * * 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 w...
Explain and rewrite the following Scala code:
package lila.i18n private[i18n] object Contributors { val all = Map( "fr" -> List("Thibault Duplessis", "Calinou"), "ru" -> List("Nikita Milovanov"), "de" -> List("Patrick Gawliczek", "Kurt Keller (DE)"), "tr" -> List("Yakup Ipek", "Usolando"), "sr" -> List("Nenad Nikolić"), "lv" -> List("An...
Explain and rewrite the following Scala code:
package commands import play.api.libs.json.{Json, Writes} /** * Created by daz on 07/08/2016. */ case class NewMessageCommand(fromUser: String, to: String, text: String, uuid: String, timestamp: Long) case class RegisterUserCommand(uuid: String, name: String, phonenumber: String, email: String) case class CreateR...
Explain and rewrite the following Scala code:
package models import javax.inject.Singleton import javax.inject.Inject import java.nio.file.{Files, Path} import java.io.{BufferedReader, StringReader} import scala.collection.immutable import scala.annotation.tailrec import java.time.format.DateTimeFormatter import java.time.Instant import scala.util.control.TailC...
Explain and rewrite the following Scala code:
/* * Copyright 2012 The SIRIS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applica...
Explain and rewrite the following Scala code:
/* * Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com> */ package play.api.db import javax.inject.{ Inject, Provider, Singleton } import scala.util.control.NonFatal import play.api.{ Configuration, Logger } /** * DB API for managing application databases. */ trait DBApi { /** * All configure...
Explain and rewrite the following Scala code:
package ru.maizy.ambient7.core /** * Copyright (c) Nikita Kovaliov, maizy.ru, 2016-2017 * See LICENSE.txt for details. */ import com.typesafe.scalalogging.Logger package object config { val configLogger = Logger("ru.maizy.ambient7.core") }
Explain and rewrite the following Scala code:
package opennlp.scalabha.util import scala.collection.generic.CanBuildFrom object Pattern { object UnapplyInt { def x = 1 val IntRE = """^(-?\\d+)$""".r def unapply(v: String): Option[Int] = v match { case IntRE(s) => Some(s.toInt) case _ => None } } // implicit def int2unapplyInt(...
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 bubblewrap import org.scalatest.FlatSpec import scala.concurrent.Await import scala.concurrent.duration.DurationInt import scala.concurrent.ExecutionContext.Implicits.global class HttpClientIntegrationSpec extends FlatSpec { it should "fetch some page" in { val url = "https://www.indix.com" val cl...
Explain and rewrite the following Scala code:
package org.mozartoz.bootcompiler package transform import scala.collection.mutable.ListBuffer import oz._ import ast._ import symtab._ object DesugarFunctor extends Transformer with TreeDSL { override def transformExpr(expression: Expression) = expression match { case functor @ FunctorExpression(name, require...
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 io.github.hamsters import java.util.Date import org.scalatest.{FlatSpec, Matchers} class ShowSpec extends FlatSpec with Matchers { @ShowMacro case class Name(firstName: String, lastName: String) @ShowMacro case class Person(name : Name, age: Int) @ShowMacro case class AdditionalShowInstances( ...
Explain and rewrite the following Scala code:
/* * Copyright 2016 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) 2013-2015 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 is ...
Explain and rewrite the following Scala code:
import scala.language.`future-migration` import scala.reflect.ClassTag def f3_1m[T: ClassTag](x: Any): Unit = x match case _: T =>
Explain and rewrite the following Scala code:
package com.novocode.junit import sbt.testing._ import scala.collection.mutable import Ansi._ final class RichLogger private (loggers: Array[Logger], settings: RunSettings) { private[this] val currentTestClassName = new mutable.Stack[String]() def this(loggers: Array[Logger], settings: RunSettings, test...
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 katas.scala.network /** * @author DKandalov */ /* TODO broken after moving to scala 2.10; should change code below to use akka object Traversal { def main(args: Array[String]) { val tree = Tree(0, Tree(1), Tree(2) ) new PreOrder(tree).iterator.foreach(println) } } case class...
Explain and rewrite the following Scala code:
package com.sageserpent.neptunium import com.sageserpent.neptunium.YamlModel._ import org.scalatest.{FlatSpec, Matchers} class YamlModelSpec extends FlatSpec with Matchers { val lineMapping = null.asInstanceOf[LineMapping] import lineMapping.{Container, File, ParsingError, Terminal} val aFile = null.asInstanceO...
Explain and rewrite the following Scala code:
package org.opencompare.api.scala import java.util.Date trait Value // Simple values case class BooleanValue(value : Boolean) extends Value case class IntegerValue(value : Int) extends Value case class RealValue(value : Double) extends Value case class StringValue(value : String) extends Value case class NotApplica...
Explain and rewrite the following Scala code:
// Project: angulate2-examples // Module: // Description: // Copyright (c) 2016. Distributed under the MIT License (see included LICENSE file). package router.crisis import angulate2.Data @Data case class Crisis(id: Int, var name: String)
Explain and rewrite the following Scala code:
package pages.disposal_of_vehicle import org.openqa.selenium.WebDriver import org.scalatest.selenium.WebBrowser import WebBrowser.find import WebBrowser.id import WebBrowser.Element import uk.gov.dvla.vehicles.presentation.common.helpers import helpers.webbrowser.{Page, WebDriverFactory} import views.disposal_of_vehic...
Explain and rewrite the following Scala code:
/* * * 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 * distri...
Explain and rewrite the following Scala code:
package com.goyeau.kubernetes.client.api import cats.effect.Async import com.goyeau.kubernetes.client.KubeConfig import com.goyeau.kubernetes.client.operation._ import io.circe._ import io.k8s.api.policy.v1beta1.{PodDisruptionBudget, PodDisruptionBudgetList} import org.http4s.Uri import org.http4s.client.Client import...
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:
/** * Licensed to Big Data Genomics (BDG) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The BDG licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use ...
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 mesosphere.marathon.state import com.codahale.metrics.MetricRegistry import mesosphere.marathon.MarathonConf import mesosphere.marathon.metrics.Metrics import mesosphere.marathon.state.StorageVersions._ import mesosphere.util.Mockito import mesosphere.util.state.{ PersistentEntity, PersistentStore, PersistentS...
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) 2011 Romain Reuillon * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This progra...
Explain and rewrite the following Scala code:
package im.actor.server.activation.common import akka.actor.{ Actor, ActorLogging, Props } import akka.http.scaladsl.util.FastFuture import akka.pattern.pipe import cats.data.Xor import scala.concurrent.Future import scala.concurrent.duration._ object ActivationStateActor { private[activation] final case class Se...
Explain and rewrite the following Scala code:
package org.littlewings.javaee7.cdi import javax.enterprise.inject.spi.CDI import org.jboss.weld.environment.se.Weld import org.scalatest.FunSpec import org.scalatest.Matchers._ class DecoratorSpec extends FunSpec { describe("CDI Decorator Spec") { ignore("no Decorator") { withWeld { val messageS...
Explain and rewrite the following Scala code:
/* Copyright 2011 Andrew Fowler <andrew.fowler@devframe.com> This file is part of Terinology2ODM Terminology2ODMConverter. Terminology2ODMConverter 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 v...
Explain and rewrite the following Scala code:
package uk.ac.ncl.openlab.intake24.sql.tools.food.nutrients import org.rogach.scallop.ScallopConf import uk.ac.ncl.openlab.intake24.foodsql.admin.NutrientTablesAdminImpl import uk.ac.ncl.openlab.intake24.nutrientsndns.{CsvNutrientTableMapping, CsvNutrientTableParser} import uk.ac.ncl.openlab.intake24.sql.tools.{Databa...
Explain and rewrite the following Scala code:
package org.graphexecutor import scalala.tensor.dense._ trait Work { def solve } class NoopWork extends Work { def solve { println("solving a noop") } } /** * Linear system model * b = Ax * solve for x */ class LinearModel( size: Int ) extends Work { var b = DenseVector.rand( size ) var x = Dens...
Explain and rewrite the following Scala code:
package com.github.aselab.activerecord.validations import org.specs2.mock._ import java.util.Locale import com.github.aselab.activerecord._ object ErrorsSpec extends DatabaseSpecification with Mockito { val userClass = classOf[models.User] "Errors" should { "add message only" in { val errors = new Err...
Explain and rewrite the following Scala code:
package com.github.ldaniels528.trifecta.ui.models import play.api.libs.json.Json /** * Decoder JSON model * @author lawrence.daniels@gmail.com */ case class DecoderJs(topic: String, schemas: Seq[SchemaJs]) /** * Decoder JSON Companion Object * @author lawrence.daniels@gmail.com */ object DecoderJs { i...
Explain and rewrite the following Scala code:
package cc.emberwalker.artemis.compat /** * Mod compat interface. * * @author Arkan <arkan@drakon.io> */ trait IModCompat { def getModId:String def setupCompat() }
Explain and rewrite the following Scala code:
package codecheck.github package operations import org.scalatest.FunSpec import org.scalatest.BeforeAndAfter import scala.concurrent.Await import org.joda.time.DateTime import org.joda.time.DateTimeZone import codecheck.github.models.OrganizationInput class OrganizationOpSpec extends FunSpec with api.Constants with ...
Explain and rewrite the following Scala code:
package dwaspada.krl.trip.domain.service import dwaspada.krl.trip.domain.model.{Card, DomainRegistry, Trip, TripChecker} class GateTripChecker extends TripChecker { override def isCardAlreadyTappedIn(card: Card): Boolean = { DomainRegistry.tripRepository.findByCard(card.id) match { case Some(_: Trip) => t...
Explain and rewrite the following Scala code:
package scalaz.stream import collection.immutable.Queue import concurrent.duration._ import scalaz.{\\/, -\\/, \\/-} import Process._ import These.{This,That} trait wye { /** * Transform the left input of the given `Wye` using a `Process1`. */ def attachL[I0,I,I2,O](p: Process1[I0,I])(w: Wye[I,I2,O]): W...
Explain and rewrite the following Scala code:
package collins.util 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 import collins.models.lshw.Cpu import collins.models.lshw.Cpu.CpuFormat import collins.models.lshw.Disk import collins.models.ls...
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...