instruction
stringclasses
1 value
output
stringlengths
5
1M
Explain and rewrite the following Scala code:
package com.partup import akka.actor._ import com.partup.RawEventJsonProtocol._ import com.partup.utils.IsoDate import org.mongodb.scala.bson.collection.immutable.Document import org.mongodb.scala.{Completed, MongoClient, Observer} import spray.httpx.SprayJsonSupport import spray.json.{DefaultJsonProtocol, pimpAny} i...
Explain and rewrite the following Scala code:
package pl.mpieciukiewicz.webapp import akka.actor.ActorSystem import pl.mpieciukiewicz.webapp.actors.HelloActor import pl.mpieciukiewicz.webapp.actors.HelloActor.SayHello import pl.mpieciukiewicz.webapp.webserver.EnhancedScalatraServlet class RestHandler(actorSystem: ActorSystem) extends EnhancedScalatraServlet(acto...
Explain and rewrite the following Scala code:
package io.vamp.pulse import akka.actor.{ Actor, ActorRef } import io.vamp.common.akka.CommonActorLogging import io.vamp.model.event.Event import scala.collection.mutable object Percolator { sealed trait PercolatorMessage case class GetPercolator(name: String) extends PercolatorMessage case class RegisterPe...
Explain and rewrite the following Scala code:
import edu.uta.diql._ import Math._ import scala.io.Source import scala.collection.parallel.ParIterable object Factorization { def main ( args: Array[String] ) { //explain(true) val n = args(1).toLong val m = args(2).toLong val l = args(3).toLong var R = Source.fromFile(args(0)).getLines ...
Explain and rewrite the following Scala code:
package ca.uwaterloo.gsd.rangeFix import gsd.linux._ import Kconfig._ class KconfigLoader(modelFile:String, configPath:String) extends ModelLoader { private[this] val parsedModel = KConfigParser.parseKConfigFile(modelFile) private[this] val kc = new Kconfig2(parsedModel) private[this] val choices = kc.cho...
Explain and rewrite the following Scala code:
package breeze.optimize import breeze.linalg.norm import breeze.linalg.operators.OpMulMatrix import breeze.math.MutableVectorField import breeze.optimize.linear.ConjugateGradient import breeze.util.Implicits._ import breeze.util.SerializableLogging /** * Implements a TruncatedNewton Trust region method (like Tron). ...
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 2012 Comcast Cable Communications Management, 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 require...
Explain and rewrite the following Scala code:
package ejemplos.polinomios class Termino(c: Float, e: Int) { private val coeficiente = c private val exponente = e def evaluar(x: Float) : Float = { var resultado: Float = 1 for (i <- 1 to exponente) { resultado = resultado * x } coeficiente * resultado } def grado(): Int = this.ex...
Explain and rewrite the following Scala code:
package org.crudible.lift.markup import org.crudible.core.table.AbstractTableMarkupFactory import org.crudible.core.table.Table import scala.xml.NodeSeq import net.liftweb.util.Helpers import net.liftweb.http.SHtml import net.liftweb.http.js.JsCmds import org.crudible.core.table.TableRowModel import org.crudible.core....
Explain and rewrite the following Scala code:
package todomvc import java.util.UUID import org.scalajs.dom import pushka.annotation.pushka object Model { import pushka.json._ object ItemId { def apply(): ItemId = ItemId(UUID.randomUUID()) } @pushka case class ItemId(value: UUID) extends AnyVal @pushka case class Item(id: ItemId = ItemId(),...
Explain and rewrite the following Scala code:
import scala.io.Source.fromFile import java.util._ //val iter: Iterator[String] = // fromFile("Call-by-name.scala").getLines() lazy val firstLazy = { println("first lazy") 1 } lazy val secondLazy = { println("second lazy") 2 } def add(a: Int, b: Int) = { a + b }
Explain and rewrite the following Scala code:
/* * Artificial Intelligence for Humans * Volume 2: Nature Inspired Algorithms * Java Version * http://www.aifh.org * http://www.jeffheaton.com * * Code repository: * https://github.com/jeffheaton/aifh * * Copyright 2014 by Jeff Heaton * * Licensed under the Apache License, Version 2.0 (the "License"); * y...
Explain and rewrite the following Scala code:
// #hello_world_2 import akka.actor.ActorSystem import colossus.core.{IOSystem, InitContext, ServerContext} import colossus.protocols.http.Http import colossus.protocols.http.HttpMethod._ import colossus.protocols.http.UrlParsing._ import colossus.protocols.http.{HttpServer, Initializer, RequestHandler} import colossus...
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 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 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:
package it.polimi.genomics.core.DataStructures.JoinParametersRD /** * Each join condition can be made of up to 4 atomic condition * If more than one atomic condition is provided, then the filtering must be performed in order */ case class JoinQuadruple(first : Option[AtomicCondition], secon...
Explain and rewrite the following Scala code:
/** * Copyright (C) 2009-2011 the original author or authors. * See the notice.md file distributed with this work for additional * information regarding copyright ownership. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * Yo...
Explain and rewrite the following Scala code:
/* Copyright (C) 2008-2016 University of Massachusetts Amherst. This file is part of "FACTORIE" (Factor graphs, Imperative, Extensible) http://factorie.cs.umass.edu, http://github.com/factorie Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with...
Explain and rewrite the following Scala code:
package models import javax.inject.{Inject, Singleton} import anorm.JodaParameterMetaData._ import anorm._ import org.joda.time.DateTime import play.api.db.Database /** * Created by pdeboer on 20/11/15. */ class Log @Inject()(db:Database) { def createEntry(url: String, ip: String, userId: Long): Unit = { db....
Explain and rewrite the following Scala code:
package com.outr.arango.api.model import io.circe.Json case class GeneralGraphListVertexHttpExamplesRc200(error: Boolean, code: Option[Int] = None, collections: Option[List[String]] = None)
Explain and rewrite the following Scala code:
package skinny.orm.feature.associations import scala.language.existentials import skinny.orm.feature._ import scala.collection.mutable /** * Association. * * @tparam Entity entity */ sealed trait Association[Entity] { /** * ORM mapper instance. */ def mapper: AssociationsFeature[Entity] /** * Jo...
Explain and rewrite the following Scala code:
package test.orbroker.example import scala.math.{ BigDecimal => Decimal } import scala.math.BigDecimal.RoundingMode._ import org.orbroker._ import org.orbroker.enrich._ class Item(val name: String, private var _price: Decimal) { price = _price // Round def price = _price def price_=(prc: Decimal) { _price = prc...
Explain and rewrite the following Scala code:
// Copyright (c) 2011 Paul Butcher // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish,...
Explain and rewrite the following Scala code:
package julienrf.forms.twirl import julienrf.forms.{Field, Presenter, InputType, Mandatory} import play.twirl.api.Html object TypedField { def input[A : Mandatory : InputType](label: Html, inputAttrs: (String, String)*): Presenter[A, Html] = Presenter.flatten { field => Field.input[A]( InputType[...
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 com.thetestpeople.trt.importer.teamcity import com.thetestpeople.trt.utils.UriUtils._ import java.net.URI case class TeamCityJobLink(serverUrl: URI, buildTypeId: String) { def relativePath(path: String): URI = uri(serverUrl.toString + path) }
Explain and rewrite the following Scala code:
package org.fedoraproject.mobile import android.graphics.Color import android.util.Log import argonaut._, Argonaut._ import scalaz._, Scalaz._ import scalaz.concurrent.Task import scalaz.concurrent.Task._ import scalaz.effect._ import java.io.{ InputStreamReader } import java.net.{ HttpURLConnection, URL, URLEncode...
Explain and rewrite the following Scala code:
package breeze.linalg.support import breeze.linalg.{DenseVector, argtopk, QuasiTensor} import breeze.collection.mutable.Beam /** * TODO * * @author dlwh **/ private[linalg] trait LowPriorityArgTopK { implicit def argtopkWithQT[Q,I,V](implicit qt: Q<:<QuasiTensor[I, V], ord: Ordering[V]) :argtopk.Impl2[Q, Int, I...
Explain and rewrite the following Scala code:
/******************************************************************************* * Copyright (c) 2019. Carl Minden * * 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 ...
Explain and rewrite the following Scala code:
package de.twentyone.cli.microtools.output import shapeless.{Nat, Sized} class MarkdownTableAutoSupport[N <: Nat](titles: Sized[Seq[String], N]) { def contentLines(rows: Seq[Sized[Seq[String], N]]): Seq[String] = { val dimensions = rows.foldLeft(titles.map(_.length)) { case (dimensions, row) => (d...
Explain and rewrite the following Scala code:
/* * Copyright 2015 PayPal * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in ...
Explain and rewrite the following Scala code:
/* * Copyright 2016 Nicolas Rinaudo * * 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:
/* * Copyright 2017 Datamountaineer. * * 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 lila.fishnet import org.joda.time.DateTime import chess.format.Uci import JsonApi.Request.{ CompleteAnalysis, PartialAnalysis, Evaluation } import lila.analyse.{ Analysis, Info } import lila.game.GameRepo private object AnalysisBuilder { def apply(client: Client, work: Work.Analysis, evals: List[Evaluatio...
Explain and rewrite the following Scala code:
package models import slick.driver.MySQLDriver.api._ import slick.lifted.{ Tag => SlickTag } case class Category( id: Int, url: String, title: String) extends KeyedEntity class CategoryTable(tag: SlickTag) extends Table[Category](tag, "category") with KeyedEntityTable { def id = column[Int]("id", O.Prim...
Explain and rewrite the following Scala code:
package models.daos import models.User import models.NamedLocation import org.joda.time.Interval import models.GeoCoord trait NamedLocationDao { def addLocation(location: NamedLocation, user: User) def updateLocation(location: NamedLocation, user: User) def loadLocations(user: User): List[NamedLocation] d...
Explain and rewrite the following Scala code:
package org.akoshterek.backgammon.agent.gnubg import com.google.common.io.LittleEndianDataInputStream import resource.managed /** * Created by Alex on 03-05-17. */ object Escapes { private val anEscapes0: Array[Int] = loadTable("/org/akoshterek/backgammon/agent/gnubg/escapes0.dat") private val anEscapes1: Arr...
Explain and rewrite the following Scala code:
package org.jetbrains.sbt package resolvers import java.io.{Closeable, File, FileNotFoundException} import com.intellij.openapi.progress.ProgressIndicator import org.apache.maven.index._ import org.apache.maven.index.artifact.DefaultArtifactPackagingMapper import org.apache.maven.index.context.{IndexCreator, IndexUti...
Explain and rewrite the following Scala code:
package Tutorial import Chisel._ import Node._ import Literal._ import scala.collection.mutable.HashMap import scala.collection.mutable.ArrayBuffer class gioArbiter[T <: Data](n: Int)(data: => T) extends Bundle { val out = (new gFIFOIO()) {data} val in = Vec(n) {(new gFIFOIO()) {data} }.flip val chosen = Bits...
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:
/** * FILE: BuildConstruction.scala * PERCORSO /Codice/sgad/servertier/src/main/scala/sgad/servertier/businesslogic/operations * DATA CREAZIONE: 25 Febbraio 2014 * AUTORE: ProTech * EMAIL: protech.unipd@gmail.com * * Questo file è proprietà del gruppo ProTech, viene rilasciato sotto licenza Apache v2. * * DIAR...
Explain and rewrite the following Scala code:
/* Copyright (C) 2008-2014 University of Massachusetts Amherst. This file is part of "FACTORIE" (Factor graphs, Imperative, Extensible) http://factorie.cs.umass.edu, http://github.com/factorie Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with...
Explain and rewrite the following Scala code:
/* * This file is part of Evo2DSim. * * Evo2DSim is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Evo2DSim is distrib...
Explain and rewrite the following Scala code:
/* * Copyright 2007-2011 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:
/* * Copyright 2015 Nicolas Rinaudo * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed...
Explain and rewrite the following Scala code:
package fpscala.c02 object Exercise3 { def curry[A, B, C](f: (A, B) => C): A => (B => C) = (a: A) => (b: B) => f(a, b) }
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 ducttape.syntax import ducttape.util.AbstractTest import ducttape.syntax.GrammarParser.Parser import org.junit.runn...
Explain and rewrite the following Scala code:
package me.jeffmay.neo4j.client.ws.json.rest import me.jeffmay.neo4j.client.cypher.{CypherProps, CypherStatement} import me.jeffmay.neo4j.client.ws.json.rest.RestFormats._ import play.api.libs.json.{JsObject, OWrites} import scala.language.implicitConversions /** * The request sent to Neo4j's REST API for Cypher t...
Explain and rewrite the following Scala code:
package com.dataintuitive.luciuscore package api import model.v4._ import Statistics._ import com.dataintuitive.luciuscore.TestData import org.scalatest.flatspec.AnyFlatSpec import org.scalatest.matchers.should._ import org.apache.spark.sql.Dataset import org.apache.spark.sql.SparkSession class StatisticsTest exten...
Explain and rewrite the following Scala code:
/* * Copyright 2014 nidkil * * 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 com.tecniplast.device import purejavacomm._ import java.io._ import akka.actor._ import scala.concurrent.duration._ import NewSerialDeviceMsgs._ case class NewSerialDevice(portName: String, speed: Integer) extends Actor { def portId = if (System.getProperty("os.name").startsWith("Windows")) try...
Explain and rewrite the following Scala code:
package org.squeryl.sharding import org.scalatest.matchers.{MustMatchers, ShouldMatchers} import org.scalatest.{FlatSpec, FunSuite} import org.jmock.Expectations._ import org.junit.runner.RunWith import org.scalatest.junit.{JUnitRunner, MustMatchersForJUnit} import org.scalatest.mock.{JMockExpectations, JMockCycle} ...
Explain and rewrite the following Scala code:
package cn.changhong.web.router /** * 判断是否存在爬虫->异常捕捉->设置日志->设置超时->前端路由器 */ import java.util.UUID import java.util.concurrent.{Executors} import cn.changhong.web.controller.ForeFamilyMemberAction import cn.changhong.web.controller.auth.ForeAuthAction import cn.changhong.web.init.GlobalConfigFactory import cn.changh...
Explain and rewrite the following Scala code:
package blended.itestsupport.http import scala.concurrent.duration.FiniteDuration import akka.actor.ActorSystem import blended.itestsupport.condition.AsyncCondition class HttpAvailableCondition(url: String)(implicit val actorSystem: ActorSystem) extends AsyncCondition( HttpChecker.props(url, 200), s"Check ...
Explain and rewrite the following Scala code:
/* * The MIT License (MIT) * * Copyright (c) 2015 Lookout, Inc * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use,...
Explain and rewrite the following Scala code:
package mesosphere.marathon.core.task.update.impl import javax.inject.{ Inject, Named } import mesosphere.marathon.core.task.update.TaskStatusUpdateProcessor import mesosphere.util.CapConcurrentExecutions import org.apache.mesos.Protos.TaskStatus import scala.concurrent.Future object ThrottlingTaskStatusUpdateProce...
Explain and rewrite the following Scala code:
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may ...
Explain and rewrite the following Scala code:
package com.github.andr83.parsek.spark.streaming import com.github.andr83.parsek.PValue import com.github.andr83.parsek.spark.SparkPipeContext import com.github.andr83.parsek.spark.SparkPipeContext.LongCountersAccumulable import org.apache.spark.streaming.dstream.DStream /** * Repository to get access to streams an...
Explain and rewrite the following Scala code:
package io.dylemma.spac package json import cats.Show import cats.data.Chain /** ADT for tokens in a JSON stream. * * @group event */ sealed trait JsonEvent extends HasLocation { import JsonEvent._ def isObjectStart: Boolean = false def isObjectEnd: Boolean = false def isArrayStart: Boolean = false def is...
Explain and rewrite the following Scala code:
package stealthnet.scala.cryptography import suiryc.scala.util.Hash /** * Message class companion object. */ object Message { /** Factory method from bytes array. */ def apply(bytes: Array[Byte]) = new Message(bytes) /** Factory method from message string. */ def apply(message: String) = new Message(messa...
Explain and rewrite the following Scala code:
package scalan import java.lang.reflect.Method import scala.reflect.runtime.universe._ import scalan.compilation.{GraphVizConfig, GraphVizExport} import scalan.staged.BaseExp import scalan.util.Invariant trait TypeWrappers extends Base { self: Scalan => trait TypeWrapper[TBase, TWrapper] extends Def[TWrapper] { ...
Explain and rewrite the following Scala code:
/** * Generated by API Builder - https://www.apibuilder.io * Service version: 0.10.78 * apibuilder 0.15.33 app.apibuilder.io/flow/common/latest/play_2_8_mock_client */ package io.flow.common.v0.mock { object Factories { def randomString(length: Int = 24): String = { _root_.scala.util.Random.alphanumer...
Explain and rewrite the following Scala code:
package looty.poeapi import looty.poeapi.PoeTypes.Inventory import scala.concurrent.ExecutionContext import looty.poeapi.PoeTypes.StashTab import looty.poeapi.PoeTypes.StashTabInfos import scala.concurrent.Future import looty.poeapi.PoeTypes.Characters ////////////////////////////////////////////////////////////// ...
Explain and rewrite the following Scala code:
import scala.reflect.runtime.universe._ import scala.reflect.runtime.{currentMirror => cm} import scala.tools.reflect.{ToolBox, ToolBoxError} import scala.tools.reflect.Eval object Test extends dotty.runtime.LegacyApp { object Extractor { def unapply(x: Int): Option[Int] = Some(x) } val extractor = reify { 2 m...
Explain and rewrite the following Scala code:
package firebase.app import scala.scalajs.js import js.annotation._ import js.| import firebase.Promise @js.native trait App extends js.Object { def auth(): firebase.auth.Auth = js.native def database(): firebase.database.Database = js.native def delete(): Promise[js.Any] = js.native ...
Explain and rewrite the following Scala code:
package models import org.joda.time.{LocalDate, DateTime} import play.api.libs.json.Json case class Menu(date: LocalDate, menu: String) object Menu { implicit val fmt = Json.format[Menu] }
Explain and rewrite the following Scala code:
package io.vamp.persistence import akka.actor.Actor import akka.util.Timeout import io.vamp.common.{ Config, ConfigMagnet } import io.vamp.common.akka.SchedulerActor import io.vamp.model.resolver.NamespaceValueResolver import scala.concurrent.duration.FiniteDuration object SearchSynchronizeActor { sealed trait Sea...
Explain and rewrite the following Scala code:
import scala.reflect.runtime.universe._ import scala.reflect.runtime.{currentMirror => cm} import scala.reflect.ClassTag class Foo{ import Test._ def foo = { val classTag = implicitly[ClassTag[R.type]] val sym = cm.moduleSymbol(classTag.runtimeClass) val cls = cm.reflectModule(sym) try { cls.instance }...
Explain and rewrite the following Scala code:
/* * Wire * Copyright (C) 2016 Wire Swiss GmbH * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This progr...
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:
// t750 object Test extends App { val a = Array(1, 2, 3) AO.f(a) AO.f[Int](a) }
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:
package applications import play.api.libs.concurrent.Execution.Implicits._ import slick.codegen.SourceCodeGenerator import slick.driver.PostgresDriver import slick.driver.PostgresDriver.backend.Database import slick.jdbc.meta.MTable import scala.concurrent.duration.Duration import scala.concurrent.{Await, Future} ob...
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 chess import scala.concurrent.duration._ case class Move( piece: Piece, orig: Pos, dest: Pos, before: Board, after: Board, capture: Option[Pos], promotion: Option[PromotableRole], castle: Option[((Pos, Pos), (Pos, Pos))], enpassant: Boolean, lag: FiniteDuration = 0.mill...
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.github.gigurra.glasciia /** * Created by johan on 2017-02-04. */ object TextureRegionLoader { def apply(): AtlasTextureRegionLoader = { AtlasTextureRegionLoader() } }
Explain and rewrite the following Scala code:
package io.apibuilder.validation.zip import java.io.{File, PrintWriter} import scala.io.Source object FileUtil { def readFileAsString(file: File): String = { val source = Source.fromFile(file, "UTF-8") try { source.mkString("") } finally { source.close() } } def writeToTempFile( ...
Explain and rewrite the following Scala code:
/* Copyright 2014 Twitter, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
Explain and rewrite the following Scala code:
package io.finch import cats.{Applicative, MonadError} import cats.syntax.all._ import com.twitter.finagle.http.{Method, Request, Response, Status, Version} import io.finch.internal.currentTime import scala.annotation.implicitNotFound import shapeless._ /** * Compiles a given list of [[Endpoint]]s and their content-...
Explain and rewrite the following Scala code:
/* * Copyright 2012 Twitter Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed ...
Explain and rewrite the following Scala code:
package io.lightspeed7.interview import org.scalatest.{ FunSuite, Matchers } class ConsecutiveCharactersTest extends FunSuite with Matchers { test("consecutive chars") { def greatestConsecutiveRun(s: String, n: Int): String = { def spanByPrefix(s: String): List[String] = { val (prefix, rest) = ...
Explain and rewrite the following Scala code:
package io.youi.paint import io.youi.drawable.Context import scala.scalajs.js case class RadialGradientPaint(x0: Double, y0: Double, r0: Double, x1: Double, y1: Double, ...
Explain and rewrite the following Scala code:
/* * ____ ____ _____ ____ ___ ____ * | _ \\ | _ \\ | ____| / ___| / _/ / ___| Precog (R) * | |_) | | |_) | | _| | | | | /| | | _ Advanced Analytics Engine for NoSQL Data * | __/ | _ < | |___ | |___ |/ _| | | |_| | Copyright (C) 2010 - 2013 SlamData, In...
Explain and rewrite the following Scala code:
/* Copyright 2015 Coursera Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
Explain and rewrite the following Scala code:
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may ...
Explain and rewrite the following Scala code:
object Test extends dotty.runtime.LegacyApp { def foo(f: String => Array[String])(s: String) = f(s) val test = foo(Array(_)) _ println(test("x").toList) }
Explain and rewrite the following Scala code:
package org.jetbrains.plugins.scala package lang package psi package impl package expr import com.intellij.lang.ASTNode import com.intellij.psi._ import com.intellij.psi.scope._ import org.jetbrains.plugins.scala.lang.psi.api.expr._ import org.jetbrains.plugins.scala.lang.psi.api.statements.params.{ScParameter, ScPara...
Explain and rewrite the following Scala code:
package bad.robot.radiate.ui import java.beans.PropertyChangeEvent class AlphaTransparencyChangeEvent(action: AnyRef, oldValue: Float, newValue: Float) extends PropertyChangeEvent(action, "fade", oldValue, newValue)
Explain and rewrite the following Scala code:
package org.raisercostin.jedi import scala.util.Try import scala.util.Success /** * Should take into consideration several composable/ortogonal aspects: * - end of line: win,linux,osx - internal standard: \\n * - file separator: win,linux,osx - internal standard: / (like linux, fewer colisions with string es...
Explain and rewrite the following Scala code:
package com.github.mjreid.flinkwrapper import play.api.libs.json._ import play.api.libs.functional.syntax._ case class FlinkConfig(key: String, value: String) object FlinkConfig { implicit val reads: Reads[FlinkConfig] = ( (JsPath \\ "key").read[String] and (JsPath \\ "value").read[String] )(FlinkCon...
Explain and rewrite the following Scala code:
/* * sbt-haxe * Copyright 2014 深圳岂凡网络有限公司 (Shenzhen QiFun Network Corp., LTD) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * ...
Explain and rewrite the following Scala code:
package com.davebsoft.minecraft.mods.misc import com.davebsoft.minecraft.framework.CustomCommandBase import net.minecraft.block.Block import net.minecraft.command.ICommandSender import net.minecraft.entity.player.EntityPlayer case class BuildingBuilder() extends CustomCommandBase("buildbuilding", "bb") { override 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:
package com.socrata.soql.collection import scala.collection.GenTraversableOnce import scala.collection.immutable.{HashMap, MapLike} import scala.collection.generic.{CanBuildFrom, ImmutableMapFactory} class OrderedMap[A, +B](underlying: Map[A, (Int, B)], ordering: Vector[A]) extends Map[A,B] with MapLike[A, B, Ordered...
Explain and rewrite the following Scala code:
package scalabpe.plugin import java.util.Timer import java.util.TimerTask import java.util.TreeMap import java.util.concurrent.ArrayBlockingQueue import java.util.concurrent.RejectedExecutionException import java.util.concurrent.ThreadFactory import java.util.concurrent.ThreadPoolExecutor import java.util.concurrent.T...
Explain and rewrite the following Scala code:
package pl.combosolutions.backup.dsl import java.lang.System.exit import pl.combosolutions.backup.{ Cleaner, Logging } import scala.util.{ Failure, Success, Try } abstract class Script(override val name: String) extends ArgumentParser with ScriptExecutor with Cleaner with Logging { final def printHelp(): Unit = ...