instruction
stringclasses
1 value
output
stringlengths
5
1M
Explain and rewrite the following Scala code:
package scuff import org.junit._ import org.junit.Assert._ import java.io.File import java.nio.charset.Charset class TestProps { @Test(expected = classOf[IllegalStateException]) def `invalid value`(): Unit = { System.setProperty("foo", "baz") SysProps.optional("foo", Set("foo", "bar")) fail("Should ha...
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 Webtrends (http://www.webtrends.com) * See the LICENCE.txt 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....
Explain and rewrite the following Scala code:
package graphql import org.parboiled.scala.parserunners.TracingParseRunner import org.scalatest.{Matchers, FunSuite} class GraphQLParserTest extends FunSuite with Matchers with ParboiledTestKit { val parser = new GraphQLParser /** * Arguments test */ test("should parse Arguments") { new ResultTest[M...
Explain and rewrite the following Scala code:
import java.io.File import org.apache.commons.io.FileUtils import play.api._ import utils.EmbeddedESServer import play.libs.Akka import akka.actor.Props import actors.LogEntryProducerActor import actors.ElasticsearchActor import actors.UserChannelsActor import actors.StatisticsActor import actors.ServerTickActor import...
Explain and rewrite the following Scala code:
package io.youi.style sealed abstract class UserSelect(val value: String) object UserSelect extends Stringify[UserSelect] { case object None extends UserSelect("none") case object Auto extends UserSelect("auto") case object Text extends UserSelect("text") case object Contain extends UserSelect("contain") ca...
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 lila.push import akka.actor._ import com.typesafe.config.Config import lila.common.PimpedConfig._ final class Env( config: Config, db: lila.db.Env, getLightUser: String => Option[lila.common.LightUser], roundSocketHub: ActorSelection, system: ActorSystem) { private val CollectionDevice...
Explain and rewrite the following Scala code:
package com.github.okapies.finagle.gntp.protocol import scala.collection._ import org.apache.commons.codec.binary.Hex import org.jboss.netty.buffer.ChannelBuffers import com.twitter.naggati._ import com.github.okapies.finagle.gntp._ import com.github.okapies.finagle.gntp.Header._ private object GntpMessageCodec { ...
Explain and rewrite the following Scala code:
package json.converter import java.io.{BufferedWriter, File, FileWriter} import json.converter.TazOutput._ import play.api.libs.json.Json import scala.collection.JavaConverters._ object TncToday { def processJson(inputJson: String): Seq[TazStructure] = { val res = Json.parse(inputJson) val tazViz = res.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:
import org.specs2.mutable._ import org.specs2.runner._ import org.junit.runner._ import play.api.test._ import play.api.test.Helpers._ /** * Add your spec here. * You can mock out a whole application including requests, plugins etc. * For more information, consult the wiki. */ @RunWith(classOf[JUnitRunner]) class...
Explain and rewrite the following Scala code:
/** * Copyright 2015 Otto (GmbH & Co KG) * * 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...
Explain and rewrite the following Scala code:
/* * Shadowsocks - A shadowsocks client for Android * Copyright (C) 2014 <max.c.lv@gmail.com> * * 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 y...
Explain and rewrite the following Scala code:
package pdi.jwt import play.api.libs.json.JsObject case class JsonDataEntry( algo: JwtAlgorithm, header: String, headerClass: JwtHeader, header64: String, signature: String, token: String, tokenUnsigned: String, tokenEmpty: String, headerJson: JsObject ) extends JsonDataEntryTrait[...
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.holmesprocessing.totem.services.cfgangr import dispatch.Defaults._ import dispatch.{url, _} import org.json4s.JsonAST.{JString, JValue} import org.holmesprocessing.totem.types.{TaskedWork, WorkFailure, WorkResult, WorkSuccess} import collection.mutable case class cfgAngrWork(key: Long, filename: String, ...
Explain and rewrite the following Scala code:
import play.sbt.PlayLayoutPlugin import sbt.Keys._ import sbt._ import scrupal.sbt.ScrupalPlugin import scrupal.sbt.ScrupalPlugin.autoImport._ import scala.language.postfixOps object ExampleBuild extends Build { lazy val ExampleProject = Project("scrupal-example", file(".")). settings( version := "0.1.0-...
Explain and rewrite the following Scala code:
package com.enkidu.lignum.parsers.ast.statement.modifers case object Static extends Modifier
Explain and rewrite the following Scala code:
Html{ val chart = List( ("E", 267), ("FP", 133), ("TOZ", 93), ("LPED", 69), ("PECFD", 54), ("EDFCZP", 40), ("FELOPZD", 34), ("DEFPOTEC", 27), ("LEFODPCT", 20), ("FDPLTCEO", 17), ("PEZOLCFTD", 13) ).map{ case (l, x) => val m = x / 3 ...
Explain and rewrite the following Scala code:
/* * This file is part of AckCord, licensed under the MIT License (MIT). * * Copyright (c) 2019 Katrix * * 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 ...
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 EntityStore.Metadata import EntityInterface.DefaultValueType._ import EntityInterface.EntityType class EntityProperty { // This class will be reflected thus we have to hide the Vars in an val class object to avoid the reflection error private class localVars () { var _complexType:EntitySchema = _; var _ap...
Explain and rewrite the following Scala code:
package model import model.pokedex.Pokedex /** * Created by salim on 12/09/2016. */ case class Game(world: World, pokedex: Pokedex, snGenerator: () => Int) { def spawnPlayer: Player = { Player(snGenerator()) } } object Game { def boot(): Game = { val g = snGenratorFactory() Game(World.fac...
Explain and rewrite the following Scala code:
import collection.immutable._ import org.scalacheck._ import Prop._ import Gen._ import Arbitrary._ import util._ import Buildable._ object Test extends Properties("TreeMap") { def genTreeMap[A: Arbitrary: Ordering, B: Arbitrary]: Gen[TreeMap[A, B]] = for { keys <- listOf(arbitrary[A]) values <- list...
Explain and rewrite the following Scala code:
package yiris.objects.advancedsecondarytreatment.uvdisinfectionbasins import equations.massbalance.MassBalance.MX import org.scalatest.{FlatSpec, Matchers} import yiris.core.math.Math._ import yiris.objects.advancedsecondarytreatment.uvdisinfectionbasins.UVDisinfectionBasins._ /** * Created by kasonchan on 11/17/15....
Explain and rewrite the following Scala code:
package com.github.misberner.scalamacros.updated.generator import scala.reflect.api.Universe /** * Compatibility enabler for the `scala.reflect.api.Universe` trait * and its `Flags` member. * * @author Malte Isberner */ object UniverseCompat { // Not a member of Flags in 2.10 def CASEACCESSOR(implicit u: U...
Explain and rewrite the following Scala code:
package redmine4s.api.resource import play.api.libs.json._ import redmine4s.api.json.JsonHelper.trackerReads import redmine4s.api.model.Tracker /** * Trackers * http://www.redmine.org/projects/redmine/wiki/Rest_Trackers */ trait TrackerResource extends BaseResource { /** Returns the list of all trackers. */ ...
Explain and rewrite the following Scala code:
package the.dude import org.scalatra._ class DudeServlet extends DudeStack { get("/") { <html> <body> <h1>Hello, world!</h1> Say <a href="hello-scalate">hello to Scalate</a>. </body> </html> } }
Explain and rewrite the following Scala code:
package scodec.bits import ByteVector._ import java.io.OutputStream import java.nio.{ ByteBuffer, CharBuffer } import java.nio.charset.{ CharacterCodingException, Charset } import java.security.{ AlgorithmParameters, GeneralSecurityException, Key, MessageDigest, SecureRandom } import java.util.concurrent.atomic.Atomi...
Explain and rewrite the following Scala code:
package org.scalaide.core.ui import org.eclipse.jdt.core.IJavaProject import org.eclipse.jdt.core.JavaCore import org.eclipse.jdt.core.formatter.{ DefaultCodeFormatterConstants => Dcfc } import org.eclipse.jdt.internal.core.JavaProject import org.eclipse.jdt.internal.ui.JavaPlugin import org.eclipse.jdt.ui.PreferenceC...
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:
/* __ *\ ** ________ ___ / / ___ __ ____ Scala.js Benchmarks ** ** / __/ __// _ | / / / _ | __ / // __/ (c) 2013, Jonas Fonseca ** ** __\ \/ /__/ __ |/ /__/ __ |/_// /_\ \ ** ** /____/\___/_/ |_/...
Explain and rewrite the following Scala code:
package com.atanana import javax.inject.Inject import com.atanana.parsers.{SiteJsonParser, TeamParser} import scala.concurrent.ExecutionContext.Implicits.global import scala.concurrent.Future class DuelResultGenerator @Inject()(siteConnector: SiteConnector, teamParser: TeamParser, jsonParser: SiteJsonParser) { de...
Explain and rewrite the following Scala code:
/* * LazyValues.scala * Lazily compute the range of values of elements. * * Created By: Avi Pfeffer (apfeffer@cra.com) * Creation Date: Dec 27, 2013 * * Copyright 2013 Avrom J. Pfeffer and Charles River Analytics, Inc. * See http://www.cra.com or email figaro@cra.com for information. * * See http://www...
Explain and rewrite the following Scala code:
package com.scalaAsm.x86 package Instructions package x87 // Description: Reverse Subtract // Category: general/arith trait FSUBR extends InstructionDefinition { val mnemonic = "FSUBR" } object FSUBR extends OneOperand[FSUBR] with FSUBRImpl trait FSUBRImpl extends FSUBR { implicit object _0 extends OneOp[m32] {...
Explain and rewrite the following Scala code:
package it.unibo.drescue.communication.messages import it.unibo.drescue.communication.builder.MessageBuilder import it.unibo.drescue.model.ObjectModel import scala.collection.mutable.ListBuffer /** * Trait modelling a message to forward. */ sealed trait ForwardMessage { /** * @return the cpID list name to...
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:
/* * 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 scalaz.stream.mongodb import java.util.UUID import com.mongodb.{DB, DBCollection} import org.specs2.specification.{Step, Fragments, Scope} import org.specs2.SpecificationLike import java.nio.file.{Paths, Path} /** * Specification, that will spawn the mongo databases for each spec instance run and shares the...
Explain and rewrite the following Scala code:
package com.lot.marketEvent.dao import akka.actor.Actor import com.typesafe.scalalogging.LazyLogging import slick.driver.JdbcProfile import com.lot.utils.{ DbModule } import scala.concurrent.Future import com.lot.marketEvent.model.TriggeredEventTable import slick.driver.MySQLDriver.api._ import com.lot.marketEvent.mod...
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 agreed to in writ...
Explain and rewrite the following Scala code:
/** * Copyright 2015 Yahoo Inc. Licensed under the Apache License, Version 2.0 * See accompanying LICENSE file. */ package kafka.manager import java.nio.charset.StandardCharsets import java.util.concurrent.{LinkedBlockingQueue, TimeUnit, ThreadPoolExecutor} import akka.pattern._ import akka.actor.{ActorPath, Prop...
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:
package dental import scala.io.Source import scala.util.matching.Regex import scala.collection.mutable.LinkedHashMap object DBTool { def main(args: Array[String]): Unit = { val lines = Source.fromFile("tools/ERDatabase.sql"); val p1 : Regex = "CREATE TABLE (.+)".r; val p2 : Regex = "\\t([^\\...
Explain and rewrite the following Scala code:
package chee.metadata import chee.util.Render object RecElement { sealed trait Element sealed trait RecordEl extends Element sealed trait Entry extends Element case class Field(label: String, value: String, pos: Int) extends RecordEl case class Comment(text: String, pos: Int) extends RecordEl with Entry ...
Explain and rewrite the following Scala code:
// Copyright (c) 2013-2020 Rob Norris and Contributors // This software is licensed under the MIT License (MIT). // For more information see LICENSE or https://opensource.org/licenses/MIT package doobie package util trait PutSuitePlatform { self: munit.FunSuite => test("Put should be derived for unary products (An...
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:
/** * Copyright 2015, deepsense.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 applicable law or agreed ...
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 sbt._ import sbt.Keys._ object BuildSettings { val buildVersion = "0.11.0-SNAPSHOT" val buildSettings = Defaults.defaultSettings ++ Seq( organization := "org.reactivemongo", version := buildVersion, scalaVersion := "2.10.2", crossScalaVersions := Seq("2.10.2"), crossVersion := CrossVers...
Explain and rewrite the following Scala code:
//package com.sksamuel.avro4s.github // //import com.sksamuel.avro4s.{Decoder, Encoder, RecordFormat} //import org.apache.avro.generic.GenericRecord //import org.scalatest.funsuite.AnyFunSuite //import org.scalatest.matchers.should.Matchers // //import scala.language.higherKinds // //class Github265 extends AnyFunSuite...
Explain and rewrite the following Scala code:
/* # Copyright 2016 Georges Lipka # # 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 wri...
Explain and rewrite the following Scala code:
package foil import scala.io.Source import java.util import scala.collection.JavaConversions._ import scala.collection.mutable.Map /** * Getting a map of predicate name and tuples */ class DataSource (val clauses: java.util.List[Literal]){ val tuples = getConstants.toArray val literals = getLitera...
Explain and rewrite the following Scala code:
/** * Copyright (C) 2019 Orbeon, Inc. * * This program is free software; you can redistribute it and/or modify it under the terms of the * GNU Lesser General Public License as published by the Free Software Foundation; either version * 2.1 of the License, or (at your option) any later version. * * This p...
Explain and rewrite the following Scala code:
package org.jetbrains.plugins.scala package worksheet.ui import java.awt.event.{ActionEvent, ActionListener, AdjustmentEvent, AdjustmentListener} import java.awt.{BorderLayout, Color, Dimension} import java.util import javax.swing.{JComponent, JLayeredPane, Timer} import com.intellij.ide.DataManager import com.intell...
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) 2013 Carnegie Mellon University * * 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 appl...
Explain and rewrite the following Scala code:
package spark.repl import java.io._ import java.net.URLClassLoader import scala.collection.mutable.ArrayBuffer import scala.collection.JavaConversions._ import org.scalatest.FunSuite import com.google.common.io.Files class ReplSuite extends FunSuite { def runInterpreter(master: String, input: String): String = { ...
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 controllers.actor import no.uio.musit.security.BearerToken import no.uio.musit.test.{FakeUsers, MusitSpecWithServerPerSuite} import play.api.http.Status class UserControllerIntegrationSpec extends MusitSpecWithServerPerSuite { val token = BearerToken(FakeUsers.fakeGuestToken) "The UserController" must {...
Explain and rewrite the following Scala code:
// Wei Chen - Random Cut Forest // 2022-03-05 package com.scalaml.algorithm import com.scalaml.general.MatrixFunc._ class RandomCutForest() extends Abnormal { val algoname: String = "RandomCutForest" val version: String = "0.1" var trees = Array[RandomCutTree]() var tree_n = 10 // Number of Trees ...
Explain and rewrite the following Scala code:
/* * Copyright (c) 2016, Robby, Kansas State University * 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 *...
Explain and rewrite the following Scala code:
package skuber import java.io._ import org.apache.commons.io.IOUtils /** * @author David O'Riordan */ case class Secret( val kind: String ="Secret", override val apiVersion: String = v1, val metadata: ObjectMeta, data: Map[String, Array[Byte]] = Map(), val `type`: String = "") extends ObjectRe...
Explain and rewrite the following Scala code:
package org.k33nteam.jade.propagation.base import org.k33nteam.jade.bean.VulnResult import soot.{Scene, SootClass, SootMethod} import scala.collection.JavaConversions._ import scala.collection.immutable.List trait IAPICheckPlugin { def getResult(scene: Scene): Iterable[VulnResult] def getDesc: String } trait IAPI...
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:
/* * 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) 2016 Verizon. 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 applicable law o...
Explain and rewrite the following Scala code:
import bintry.Attr package object bintray { type AttrMap = Map[String, Iterable[Attr[_]]] }
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 aia.stream import java.nio.file.{ Files, Path, Paths } import java.nio.file.StandardOpenOption import java.nio.file.StandardOpenOption._ import java.time.ZonedDateTime import scala.concurrent.duration._ import scala.concurrent.ExecutionContext import scala.concurrent.Future import scala.util.{ Success, Failu...
Explain and rewrite the following Scala code:
package com.afronski.http4s.starter import scala.concurrent.{ ExecutionContext, Future } import org.http4s.dsl._ import org.http4s.server._ import org.http4s.dsl./ object HelloWorld { def service(implicit executionContext: ExecutionContext = ExecutionContext.global) = HttpService { case GET -> Root / "hello" ...
Explain and rewrite the following Scala code:
package slick.memory import scala.language.{implicitConversions, existentials} import scala.collection.mutable.{Builder, HashMap} import slick.SlickException import slick.dbio._ import slick.ast._ import slick.ast.TypeUtil._ import slick.compiler._ import slick.relational.{ResultConverter, CompiledMapping} import slic...
Explain and rewrite the following Scala code:
package plantae.citrus.mqtt.actors.session import java.util.UUID import java.util.concurrent.TimeUnit import akka.actor._ import plantae.citrus.mqtt.actors.SystemRoot import plantae.citrus.mqtt.actors.topic._ import plantae.citrus.mqtt.dto.connect.{ReturnCode, Will} import plantae.citrus.mqtt.packet._ import scodec.b...
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 jumpmicro.jmscalajs //import com.typesafe.scalalogging.Logger //: ------------------------------------------------------------------------------------- //: Copyright © 2017 Philip Andrew https://github.com/PhilAndrew All Rights Reserved. //: Released under the MIT License, refer to the project website for li...
Explain and rewrite the following Scala code:
import leon.lang._ import leon.collection._ object FlatMap { def append[T](l1: List[T], l2: List[T]): List[T] = { l1 match { case Cons(head, tail) => Cons(head, append(tail, l2)) case Nil() => l2 } } ensuring { res => (res == l1) || (l2 != Nil[T]()) } def flatMap[T,U](list: List[T], f: T =>...
Explain and rewrite the following Scala code:
package at.nonblocking.cliwix.integrationtest import java.io.File import at.nonblocking.cliwix.core._ import at.nonblocking.cliwix.core.filedata.FileDataResolverFileSystemImpl import at.nonblocking.cliwix.core.validation.{CliwixValidationException, DefaultCompanyLiferayConfigValidator} import at.nonblocking.cliwix.mo...
Explain and rewrite the following Scala code:
package io.eels.component.kafka import java.util import java.util.{Properties, UUID} import io.eels.schema.{Field, StringType, StructType} import io.eels.{Frame, Row} import net.manub.embeddedkafka.{EmbeddedKafka, EmbeddedKafkaConfig} import org.apache.kafka.clients.consumer.KafkaConsumer import org.apache.kafka.clie...
Explain and rewrite the following Scala code:
package fsm import actors.DisplayOrderActor.{DisplayOrderCommand, OrderDisplayedEvent} import akka.actor.{ActorRef, FSM, Props} import domain._ import domain.models.response.FSMProcessInfoResponse import scala.concurrent.duration._ @deprecated("No longer supported! There is new persistence version of this FSM actor"...
Explain and rewrite the following Scala code:
package moe.pizza.crestapi import moe.pizza.crestapi.contacts.Types.{ContactCreate, ContactCreateInner} import moe.pizza.evewho.Evewho import scala.concurrent.Await import scala.concurrent.ExecutionContext.Implicits.global import moe.pizza.eveapi.{EVEAPI, SyncableFuture} import org.http4s.client.blaze.PooledHttp1Clie...
Explain and rewrite the following Scala code:
package models import akka.http.scaladsl.marshallers.sprayjson.SprayJsonSupport import spray.json.DefaultJsonProtocol object QuoteResult extends SprayJsonSupport with DefaultJsonProtocol { implicit val quoteResultFormat = jsonFormat2(QuoteResult.apply) } case class QuoteResult ( tripDetails: DistanceResult, qu...
Explain and rewrite the following Scala code:
package com.github.mdr.mash.ns.os import com.github.mdr.mash.functions.FunctionHelpers.asPathString import com.github.mdr.mash.functions.{ BoundParams, MashFunction, ParameterModel } import com.github.mdr.mash.ns.core.StringClass import com.github.mdr.mash.os.linux.LinuxEnvironmentInteractions import com.github.mdr.ma...
Explain and rewrite the following Scala code:
// Equites, a Scala chess playground // Copyright © 2013-2014 Frank S. Thomas <frank@timepit.eu> // // 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 ...
Explain and rewrite the following Scala code:
/* * Copyright 2013-2015 Websudos, Limited. * * 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, * this list of c...
Explain and rewrite the following Scala code:
package com.landoop.streamreactor.connect.hive.sink.staging import com.landoop.streamreactor.connect.hive.{TopicPartition, TopicPartitionOffset} import com.typesafe.scalalogging.slf4j.StrictLogging import org.apache.hadoop.fs.{FileSystem, Path} import com.landoop.streamreactor.connect.hive.formats.HiveWriter /** * ...
Explain and rewrite the following Scala code:
package modules import play.api.db.evolutions.EvolutionsComponents import play.api.db.slick.evolutions.SlickEvolutionsComponents import play.api.db.slick.{DbName, SlickComponents} import services.DatabaseService import slick.jdbc.JdbcProfile import scala.concurrent.ExecutionContext trait DatabaseModule extends Slick...
Explain and rewrite the following Scala code:
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may ...
Explain and rewrite the following Scala code:
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may ...
Explain and rewrite the following Scala code:
/* * Copyright ActionML, LLC under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * ActionML licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except...
Explain and rewrite the following Scala code:
package ohnosequences.awstools import com.amazonaws.auth._ import com.amazonaws.services.autoscaling.{ AmazonAutoScaling, AmazonAutoScalingClientBuilder } import com.amazonaws.services.autoscaling.model._ import com.amazonaws.{ ClientConfiguration, PredefinedClientConfigurations } import com.amazonaws.waiters._ import...
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:
/* * 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) 2013-2014 Telefónica Investigación y Desarrollo S.A.U. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unles...
Explain and rewrite the following Scala code:
package ru.avhaliullin.whatever.semantic.module import ru.avhaliullin.whatever.frontend.sources.{SourceTree, SourceTreeNode} import ru.avhaliullin.whatever.frontend.syntax.SyntaxTree import ru.avhaliullin.whatever.frontend.{syntax => syn} import ru.avhaliullin.whatever.semantic.function.{FnAnalyzer, FnConverter, FnSig...
Explain and rewrite the following Scala code:
import org.specs2.mutable._ import org.specs2.runner._ import org.junit.runner._ import play.api.test._ import play.api.test.Helpers._ @RunWith(classOf[JUnitRunner]) class ApplicationSpec extends Specification { "Application" should { "Send JavaScript content" in { running(FakeApplication()) { va...
Explain and rewrite the following Scala code:
package uk.gov.gds.ier.validation.constraints.overseas import uk.gov.gds.ier.validation._ import play.api.data.validation.{Invalid, Valid, Constraint} import uk.gov.gds.ier.model._ import scala.Some import uk.gov.gds.ier.validation.constraints.CommonConstraints import org.joda.time.{YearMonth, DateTime} import uk.gov....
Explain and rewrite the following Scala code:
object Test { def main(args: Array[String]): Unit = { println("CaseNums") test(CaseNums) println() println("IntNums") test(IntNums) } def test(numbers: Numbers) = { import numbers._ val zero: Nat = Zero() val one: Nat = Succ(zero) val two: Nat = Succ(one) val t...
Explain and rewrite the following Scala code:
/* * ProbEvidenceAlgorithm.scala * Algorithms that compute probability of evidence. * * Created By: Avi Pfeffer (apfeffer@cra.com) * Creation Date: Jan 1, 2009 * * Copyright 2013 Avrom J. Pfeffer and Charles River Analytics, Inc. * See http://www.cra.com or email figaro@cra.com for information. * * ...