instruction
stringclasses
1 value
output
stringlengths
5
1M
Explain and rewrite the following Scala code:
/* * Copyright 2011-2018 GatlingCorp (http://gatling.io) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applic...
Explain and rewrite the following Scala code:
package org.apache.spark.examples.h2o import java.io.File import hex.deeplearning.DeepLearning import hex.deeplearning.DeepLearningParameters import hex.deeplearning.DeepLearningParameters.Activation import org.apache.spark.h2o.{DoubleHolder, H2OContext, H2OFrame} import org.apache.spark.rdd.RDD import org.apache.spa...
Explain and rewrite the following Scala code:
val (capacityA, capacityB, target) = args.toList match { case a :: b :: c :: Nil => (a.toInt, b.toInt, c.toInt) case _ => (5, 3, 4) } case class Bucket(name: String, capacity: Int, value: Int) { private val free = capacity - value val satisfied = value == target def fill = copy(value = capacity) def dump =...
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 lila.team import actorApi._ import akka.actor.ActorSelection import lila.db.dsl._ import lila.hub.actorApi.forum.MakeTeam import lila.hub.actorApi.timeline.{ Propagate, TeamJoin, TeamCreate } import lila.user.{ User, UserRepo, UserContext } import org.joda.time.Period import reactivemongo.api.Cursor final cla...
Explain and rewrite the following Scala code:
/* * Copyright 2017 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, Scodec * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this * list of conditions a...
Explain and rewrite the following Scala code:
package skinny.validator import org.scalatest._ import org.scalatest.matchers._ class intMaxValueSpec extends FlatSpec with ShouldMatchers { behavior of "intMaxValue" it should "be available" in { val max = 3 val validate = new intMaxValue(max) validate.name should equal("intMaxValue") validate...
Explain and rewrite the following Scala code:
/* Copyright (c) 2012-2014, Université de Lorraine, Nancy, France Copyright (c) 2014-2015, Christophe Calvès All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of...
Explain and rewrite the following Scala code:
/* * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ package swave.core import org.reactivestreams.{Publisher, Subscriber} import scala.annotation.unchecked.{unch...
Explain and rewrite the following Scala code:
package org.showgregator.service.view import java.text.DateFormatSymbols import org.joda.time.DateTime import com.twitter.finatra.View import org.showgregator.service.model._ /** * Created with IntelliJ IDEA. * User: cmarshall * Date: 1/25/15 * Time: 10:11 PM * To change this template use File | Settings | File...
Explain and rewrite the following Scala code:
package com.betfair.robots import java.math.{BigDecimal, RoundingMode} /** * This class rounds a price either <code>UP</code> or <code>DOWN</code> to the * nearest valid Betfair price. * * @author geraint.jones * */ object ShortPriceFormat { /** * For a given <code>DIRECTION</code>, round the suppl...
Explain and rewrite the following Scala code:
package org.orbeon.oxf.util import java.io.{BufferedInputStream, IOException, InputStream, OutputStream} import org.orbeon.io.IOUtils import org.orbeon.oxf.common.OXFException import org.orbeon.oxf.http.Headers import org.orbeon.oxf.xml.XMLConstants import org.xml.sax.ContentHandler import org.xml.sax.helpers.Attribu...
Explain and rewrite the following Scala code:
package es.upm.oeg.epnoi.matching.metrics.topics import es.upm.oeg.epnoi.matching.metrics.domain.entity.Author /** * Created by cbadenes on 24/04/15. */ object Authors { val a1: Author = Author("ro.oeg.es/author/000001","Jon","Snow") val a2: Author = Author("ro.oeg.es/author/000002","Tyrion","Lannister") va...
Explain and rewrite the following Scala code:
package org.scalaide.core.internal.builder import java.io.File import org.eclipse.core.resources.IFile import org.eclipse.core.resources.IMarker import org.eclipse.core.runtime.IProgressMonitor import org.eclipse.core.runtime.SubMonitor import xsbti.compile.CompileAnalysis /** * Abstraction which exposes sbt compi...
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:
package epic.parser import epic.trees.{UnaryRule, BinaryRule, Span} import scala.collection.mutable.ArrayBuffer import breeze.linalg.CSCMatrix /** * This class is mostly an implementation detail. It's used for * [[epic.parser.SimpleGrammar]] instances to accelerate parsing. It's kind of * like a compressed sparse ...
Explain and rewrite the following Scala code:
package monocle import java.net.URL import org.scalacheck.{Arbitrary, Cogen, Gen} import cats.Eq private[monocle] trait PlatformSpecificTestInstances { implicit val urlEqual: Eq[URL] = Eq.instance((a, b) => a.toURI() == b.toURI()) implicit def urlArbitrary: Arbitrary[URL] = Arbitrary { val idGen = Gen....
Explain and rewrite the following Scala code:
/* * Copyright (c) 2014-2015 by its authors. Some rights reserved. * See the project homepage at: http://www.monifu.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://...
Explain and rewrite the following Scala code:
/* ,i::, :;;;;;;; ;:,,::;. 1ft1;::;1tL t1;::;1, :;::; _____ __ ___ __ fCLff ;:: tfLLC / ___/ / |/ /____ _ _____ / /_ CLft11 :,, i1tffLi \\__ \\ ____ / /|_/...
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 org.obrafamily.mavlink import akka.actor.ActorRef import akka.util.ByteString /** * Created by brendan on 10/27/16. */ case class MavlinkMessage(data:ByteString,requestor:ActorRef,endpoint:ActorRef)
Explain and rewrite the following Scala code:
// Databricks notebook source // MAGIC %md // MAGIC // MAGIC # [SDS-2.2, Scalable Data Science](https://lamastex.github.io/scalable-data-science/sds/2/2/) // COMMAND ---------- // MAGIC %md // MAGIC Archived YouTube video of this live unedited lab-lecture: // MAGIC // MAGIC [![Archived YouTube video of this live un...
Explain and rewrite the following Scala code:
package akka.persistence.cassandra.journal import akka.actor._ import akka.persistence._ import akka.persistence.cassandra.CassandraLifecycle import akka.testkit._ import com.typesafe.config.ConfigFactory import org.scalatest._ import scala.concurrent.duration._ import scala.language.postfixOps object CassandraLoadS...
Explain and rewrite the following Scala code:
package test.support import java.io.{File, IOException} import java.nio.file._ import java.nio.file.attribute.BasicFileAttributes import akka.actor.{ActorIdentity, Identify, Props} import akka.cluster.Cluster import akka.persistence.Persistence import akka.persistence.journal.leveldb.{SharedLeveldbJournal, SharedLeve...
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 u...
Explain and rewrite the following Scala code:
/* Copyright 2009-2013 EPFL, Lausanne */ package leon import annotation._ import lang._ import collection._ import scala.language.implicitConversions import scala.annotation.StaticAnnotation package object mem { /** * A class representing named function calls. These are entities that are memoized. * This sh...
Explain and rewrite the following Scala code:
package korolev.http.protocol import korolev.data.BytesLike import korolev.data.syntax._ import korolev.effect.syntax._ import korolev.effect.{Decoder, Effect, Stream} import korolev.web.Response.Status import korolev.web.{Headers, PathAndQuery, Request, Response} import scala.collection.mutable class Http11[B: Byte...
Explain and rewrite the following Scala code:
package io.taig.android.viewvalue.syntax import android.view.View import io.taig.android.viewvalue._ import scala.language.implicitConversions trait value { implicit def viewValueSyntax[V <: View]( view: V ): operation.value[V] = { new operation.value( view ) } } object value extends value
Explain and rewrite the following Scala code:
/* * Copyright © 2015-2019 the contributors (see Contributors.md). * * This file is part of Knora. * * Knora 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 *...
Explain and rewrite the following Scala code:
package io.buoyant.test import org.scalatest.Assertions trait Exceptions extends Assertions { // assertThrows is like intercept, but discards the intercepted exception. def assertThrows[T <: AnyRef: Manifest](f: => Any): Unit = { val _ = intercept[T](f) } }
Explain and rewrite the following Scala code:
package lolchat.data case class Region(url: String, abbr: String) object Region { val NA = Region("chat.na2.lol.riotgames.com", "na") val BR = Region("chat.br.lol.riotgames.com", "br") val EUNE = Region("chat.eun1.lol.riotgames.com", "eune") val EUW = Region("chat.euw1.lol.riotgames.com", "euw") val KR = Re...
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:
/* * The MIT License (MIT) * <p/> * Copyright (c) 2016 SWEeneyThreads * <p/> * 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 right...
Explain and rewrite the following Scala code:
/*********************************************************************** * Copyright (c) 2013-2020 Commonwealth Computer Research, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Apache License, Version 2.0 * which accompanies this distribution and...
Explain and rewrite the following Scala code:
/* * Copyright 2001-2009 Artima, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agre...
Explain and rewrite the following Scala code:
package com.twitter.finagle.http.filter import com.twitter.conversions.DurationOps._ import com.twitter.finagle.Service import com.twitter.finagle.http.{Method, Request, Response, Version} import com.twitter.logging.{BareFormatter, Logger, StringHandler} import com.twitter.util.{Await, Future, Time} import java.time.Z...
Explain and rewrite the following Scala code:
package com.arcusys.learn.liferay.constants import com.liferay.portal.kernel.lar.PortletDataHandlerKeys object PortletDataHandlerKeysHelper { val PERMISSIONS = PortletDataHandlerKeys.PERMISSIONS val PORTLET_DATA = PortletDataHandlerKeys.PORTLET_DATA val PORTLET_DATA_CONTROL_DEFAULT = PortletDataHandlerKeys.PORT...
Explain and rewrite the following Scala code:
/* * Copyright 2019 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:
/* * 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 dedep.bonobo._match.evaluator import dedep.bonobo._match.Match import dedep.bonobo._match.result.MatchResult trait MatchEvaluator { def eval(m: Match): MatchResult }
Explain and rewrite the following Scala code:
/* * Copyright (c) 2014, Brook 'redattack34' Heisler * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, t...
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:
/* * Image/J Plugins * Copyright (C) 2002-2014 Jarek Sacha * Author's email: jsacha at users dot sourceforge dot net * * This library 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 * ver...
Explain and rewrite the following Scala code:
package org.pgscala.converters /** Do not edit - generated in Builder / PGBooleanConverterBuilder.scala */ object PGOptionBooleanConverter extends PGConverter[Option[Boolean]] { val PGType = PGBooleanConverter.PGType def toPGString(ob: Option[Boolean]): String = ob match { case None => null ...
Explain and rewrite the following Scala code:
package scaladownunder import scala.annotation.tailrec import scala.concurrent._ import scala.concurrent.duration.Duration import scala.concurrent.duration._ import scala.reflect.ClassTag import akka.actor._ import akka.testkit._ import akka.util.Timeout import org.mockito.ArgumentCaptor import org.mockito.Mockito im...
Explain and rewrite the following Scala code:
package org.jetbrains.plugins.scala package codeInsight package hints import org.jetbrains.plugins.scala.base.ScalaLightCodeInsightFixtureTestAdapter abstract class InlayHintsTestBase extends ScalaLightCodeInsightFixtureTestAdapter { protected def doTest(text: String, setOption: Boolean => Unit = _ => ()): Unit = ...
Explain and rewrite the following Scala code:
/* * Copyright 2010 LinkedIn * * 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 org.apache.spark.ml.bundle.ops.feature import ml.combust.bundle.BundleContext import ml.combust.bundle.dsl._ import ml.combust.bundle.op.OpModel import ml.combust.mleap.core.types.TensorShape import org.apache.spark.ml.bundle.{ParamSpec, SimpleParamSpec, SimpleSparkOp, SparkBundleContext} import org.apache.spa...
Explain and rewrite the following Scala code:
package example import cucumber.api.CucumberOptions import cucumber.api.junit.Cucumber import org.junit.runner.RunWith @RunWith(classOf[Cucumber]) @CucumberOptions( features = Array("classpath:"), glue = Array("classpath:"), plugin = Array("pretty", "html:target/cucumber/report.html"), strict = true ) class C...
Explain and rewrite the following Scala code:
package intellijhocon.highlight import com.intellij.openapi.options.colors.{AttributesDescriptor, ColorSettingsPage} import com.intellij.icons.AllIcons import com.intellij.openapi.fileTypes.SyntaxHighlighterFactory import scala.collection.JavaConverters._ import intellijhocon.lang.HoconLanguage import intellijhocon.hi...
Explain and rewrite the following Scala code:
/* * Copyright 2016-2018 Michal Harish, michal.harish@gmail.com * * 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 u...
Explain and rewrite the following Scala code:
/* sbt -- Simple Build Tool * Copyright 2010 Mark Harrah */ package sbt // used instead of Either[Incomplete, T] for type inference /** Result of completely evaluating a task.*/ sealed trait Result[+T] { def toEither: Either[Incomplete, T] } /** Indicates the task did not complete normally and so it does not have...
Explain and rewrite the following Scala code:
/* * Copyright (c) 2015-2017 EpiData, Inc. */ import cassandra.DB import com.epidata.lib.models.{ Measurement => Model } import com.epidata.lib.models.util.Binary import java.util.Date import models.MeasurementService import models.SensorMeasurement import org.specs2.mutable._ import org.specs2.runner._ import org.ju...
Explain and rewrite the following Scala code:
package uk.gov.gds.ier.transaction.overseas.confirmation import org.joda.time.{YearMonth, Years} import play.api.data.Forms._ import play.api.data.validation.{Invalid, Valid, Constraint} import uk.gov.gds.ier.model._ import uk.gov.gds.ier.form.OverseasFormImplicits import uk.gov.gds.ier.serialiser.WithSerialiser impor...
Explain and rewrite the following Scala code:
package biz.jackman.brewmaster.inject import Prelude._ import reflect.Manifest /** A simple key used to quicken lookups for static converters */ private[inject] case class BrewverterKey[A,B](from : Class[A], to : Class[B]) /** The base trait of both static and dynamic brewverters * for static from is the class con...
Explain and rewrite the following Scala code:
package org.baseservices.persistence.dao import java.util.UUID import org.baseservices.persistence.entity.AuthUser import org.baseservices.test.PersistenceFixture import org.mockito.ArgumentCaptor import org.mockito.Matchers._ import org.mockito.Mockito.verify import scala.slick.jdbc.{ResultSetHoldability, ResultSe...
Explain and rewrite the following Scala code:
package manu.tron.service import manu.tron.common.Vocabulary._ trait GameBasicLogicService { def allDirections: Seq[Direction] def anyDirection: Direction def validDirections(status: GameStatus, selfId: PlayerId): Seq[Direction] def isPosValid(p: Pos, status: GameStatus): Boolean def isPosInBoard(p: Po...
Explain and rewrite the following Scala code:
package idbase package models import com.typesafe.config.Config import scala.collection.JavaConversions._ final class Lists(config: Config, val notions: List[String] = Nil) { val niveau = getList("niveau") val methodePedagogique = getList("methodePedagogique") val interdisciplinarite = getList("interdisciplina...
Explain and rewrite the following Scala code:
abstract class test4 { trait Type; val x : Type = null; val x : Int = 10; }
Explain and rewrite the following Scala code:
package org.scalameter import org.scalameter.picklers.Pickler import scala.reflect.ClassTag abstract class DSL[U] extends BasePerformanceTest[U] { import BasePerformanceTest._ case object performance { def of(modulename: String) = Scope(modulename, setupzipper.value.current.context) } case ob...
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 pl.tk.scalaconstructs.typeclasses trait PlusOperation[A] { def plus(a1:A, a2:A) : A } object PlusOperation { def plus[A:PlusOperation](a1:A,a2:A) : A = implicitly[PlusOperation[A]].plus(a1,a2) implicit object PlusOperations extends PlusOperation[String] { override def plus(a1: String,...
Explain and rewrite the following Scala code:
/* * Copyright (C) 2016-2019 Lightbend Inc. <https://www.lightbend.com> */ package com.lightbend.lagom.internal.registry import java.net.InetAddress import java.net.URI import akka.actor.ActorSystem import akka.discovery.ServiceDiscovery.Resolved import akka.discovery.ServiceDiscovery.ResolvedTarget import akka.te...
Explain and rewrite the following Scala code:
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may ...
Explain and rewrite the following Scala code:
/* * Copyright (c) 2012-2017 Snowplow Analytics Ltd. All rights reserved. * * This program is licensed to you under the Apache License Version 2.0, * and you may not use this file except in compliance with the Apache License Version 2.0. * You may obtain a copy of the Apache License Version 2.0 at http://www.apach...
Explain and rewrite the following Scala code:
/* * 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 com.haskforce.cabal.lang.parser class CabalParserTest extends CabalParserTestBase with CabalParsingTestCases { // Allow error elements in this test override def testError00001() = doTestPermitErrors() }
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 eventstreams.agent case class RemoveEventsource() extends AgentControllerMessage
Explain and rewrite the following Scala code:
package nz.wicker.autoencoder import org.scalatest.matchers.{ MatchResult, BeMatcher, HavePropertyMatcher, HavePropertyMatchResult } import nz.wicker.autoencoder.math.structure.VectorSpace import nz.wicker.autoencoder.math.matrix.Mat trait CustomMatchers { case class NormMatcher[V <: VectorSpace[V]](exp...
Explain and rewrite the following Scala code:
package com.xhachi.gae4s.datastore import com.google.appengine.tools.development.testing.LocalDatastoreServiceTestConfig import com.xhachi.gae4s.datastore.meta.property import com.xhachi.gae4s.tests.AppEngineTestSuite import org.scalatest.FunSuite class SeqStoreTest extends FunSuite with AppEngineTestSuite { over...
Explain and rewrite the following Scala code:
package spgui.components import japgolly.scalajs.react.vdom.VdomNode import japgolly.scalajs.react.vdom.html_<^._ /** * Provides type-safe access to Font Awesome icons */ object Icon { type Icon = VdomNode def apply(name: String): Icon = <.i(^.className := s"fa fa-$name") def adjust = apply("adjust") def a...
Explain and rewrite the following Scala code:
package com.github.kczulko.chapter2.adts case class IceCream(name: String, numCherries: Int, inCone: Boolean)
Explain and rewrite the following Scala code:
package com.nthportal.euler.h0.t4 object Problem42Helper { def words: List[String] = List( "A","ABILITY","ABLE","ABOUT","ABOVE","ABSENCE","ABSOLUTELY","ACADEMIC","ACCEPT","ACCESS", "ACCIDENT","ACCOMPANY","ACCORDING","ACCOUNT","ACHIEVE","ACHIEVEMENT","ACID","ACQUIRE", "ACROSS","ACT","ACTION","ACTIVE",...
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 * distributed ...
Explain and rewrite the following Scala code:
/* * Copyright 2019 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:
import java.io.File import scala.io.Source object Expressifier { var inX = 0 var inY = 0 var inZ = 0 var inA = 0 var enteredValX : Boolean = false var enteredValY : Boolean = false var enteredValZ : Boolean = false var enteredValA : Boolean = false lazy val exp1: Tree = Plus(Var("x"),Times(Var("x...
Explain and rewrite the following Scala code:
object Main11 { def main(args: Array[String]) = { println("Hi 11!") MainLeaf.main(Array.empty) } }
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 scalera.moonrover.interpreter import scalera.moonrover.BaseTest class CommandTest extends BaseTest("Command") { val myCommand = new Command[Int]{ override def perform(state: State[Int]): State[Int] = state.update(state.value + 1) } it should "be able to perform changes over some state" in { ...
Explain and rewrite the following Scala code:
package approximation import approximation.TwoDGrid.Bounds._ import approximation.TwoDGrid._ import org.specs2._ import piecewise._ /** * */ class TwoDGridUnit extends Specification{override def is = s2""" correctly update X ${updateX} correctly update Y ${updateY} correct horizontal iteration ...
Explain and rewrite the following Scala code:
package org.scalatra package swagger import org.json4s._ import org.scalatra.json.JacksonJsonSupport import org.scalatra.test.specs2.ScalatraSpec import org.specs2.matcher.JsonMatchers class SubPathSwaggerSpec extends ScalatraSpec with JsonMatchers { def is = s2""" Swagger integration should list resources $l...
Explain and rewrite the following Scala code:
package beam.utils.scenario.urbansim import beam.utils.scenario.InputType import beam.utils.scenario.urbansim.DataExchange._ import beam.utils.{ParquetReader, ProfilingUtils} import com.typesafe.scalalogging.LazyLogging import org.apache.avro.generic.GenericRecord import org.apache.commons.lang3.math.NumberUtils impo...
Explain and rewrite the following Scala code:
package pl.touk.nussknacker.engine.types import java.lang.reflect._ import java.util.Optional import cats.data.StateT import cats.effect.IO import org.apache.commons.lang3.{ClassUtils, StringUtils} import pl.touk.nussknacker.engine.api.process.PropertyFromGetterExtractionStrategy.{AddPropertyNextToGetter, DoNothing, R...
Explain and rewrite the following Scala code:
package net.ellisw.quvault.lift import scala.collection.mutable.ArrayBuffer class ScoreData { val asCorrect = new ArrayBuffer[String] val asSemiCorrect = new ArrayBuffer[String] val asMissing = new ArrayBuffer[String] val asWrong = new ArrayBuffer[String] var sErrors: String = _ }
Explain and rewrite the following Scala code:
/* * A real-time collaborative tool to develop files over the network. * Copyright (C) 2010 Mauro Ciancio and Leandro Gilioli * {maurociancio,legilioli} at gmail dot com * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Publi...
Explain and rewrite the following Scala code:
/*********************************************************************** * Copyright (c) 2013-2019 Commonwealth Computer Research, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Apache License, Version 2.0 * which accompanies this distribution and...
Explain and rewrite the following Scala code:
/* * Copyright 2015 LG CNS. * * 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 com.xhachi.gae4s.datastore import com.xhachi.gae4s.datastore.meta.property class User(val key: Key[User], @property(indexed = true) var name: String = "") extends Entity[User] with CreatedAt with Version with UpdatedAt { @property(indexed = true) var height: Int = 0 @property(indexed = true) ...
Explain and rewrite the following Scala code:
/* * Copyright 2016 The BigDL Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agr...
Explain and rewrite the following Scala code:
package com.rockymadden.stringmetric trait StringAlgorithm[A, B] extends Algorithm[String, A, B] { def compute(charArray: Array[Char])(implicit a: A): Option[Array[Char]] } object StringAlgorithm { type Metaphone = com.rockymadden.stringmetric.phonetic.MetaphoneAlgorithm val Metaphone = com.rockymadden.stringmetri...
Explain and rewrite the following Scala code:
package app.utils.auth import scala.concurrent.Future import com.mohiva.play.silhouette.api.actions.UnsecuredErrorHandler import play.api.mvc.RequestHeader import play.api.mvc.Results._ /** * Custom unsecured error handler. */ class CustomUnsecuredErrorHandler extends UnsecuredErrorHandler { /** * Called when...
Explain and rewrite the following Scala code:
/* * Copyright (c) 2017. Yuriy Stul */ package com.stulsoft.ysps.padt /** * @author Yuriy Stul */ object FizzBuzz extends App { def test1(): Unit = { println("==>test1") LazyList(1 to 10: _*).map(FizzBuzzADT(_)).foreach(println) println("<==test1") } def test2(): Unit = { println("==>te...
Explain and rewrite the following Scala code:
package im.mange.jetpac.page import net.liftweb.common.Full import net.liftweb.sitemap.Menu.Menuable import net.liftweb.sitemap.{ConvertableToMenu, Loc, Menu} import net.liftweb.util.StringHelpers import scala.xml.{Elem, NodeSeq} trait Page { protected def params: Seq[Loc.LocParam[Any]] = Seq() def title: String...
Explain and rewrite the following Scala code:
package com.twitter.concurrent import java.io.EOFException import scala.collection.mutable.ArrayBuffer import com.twitter.util.{Await, Duration, Future, Return, Throw} /** * A spool is an asynchronous stream. It more or less mimics the scala * {{Stream}} collection, but with cons cells that have either eager or ...
Explain and rewrite the following Scala code:
package common import akka.Done import akka.actor._ import akka.stream.KillSwitch import akka.stream.scaladsl._ import scala.concurrent.Future trait MQProtocol { def createProducer[A]() (mapper: A => ProducerData[String]) (implicit system: ActorSystem): SourceQueueWithComplete[A]; def createConsumerSourc...
Explain and rewrite the following Scala code:
package org.psesd.srx.shared.core import org.psesd.srx.shared.core.exceptions.{ArgumentInvalidException, ArgumentNullOrEmptyOrWhitespaceException, ExceptionMessage} import org.psesd.srx.shared.core.extensions.TypeExtensions._ import org.psesd.srx.shared.core.sif._ import org.scalatest.FunSuite import scala.xml.Node ...
Explain and rewrite the following Scala code:
package io.vamp.model.reader import io.vamp.model.notification.{ MissingPathValueError, ModelNotificationProvider, UnexpectedInnerElementError, UnexpectedTypeError } import scala.collection.immutable.:: import scala.collection.mutable import scala.language.{ implicitConversions, postfixOps } import scala.reflect._ im...