instruction
stringclasses
1 value
output
stringlengths
5
1M
Explain and rewrite the following Scala code:
package org.odfi.wsb.fwapp.macros import org.scalatest.FunSuite import org.odfi.wsb.fwapp.views.FWappView import fmacros.FormClientUtilsMTrait import org.odfi.wsb.fwapp.module.clientutils.FormClientUtils class TestClientUtilsMacro extends FunSuite { test("Form Switch Test") { val impl = new FWappView with For...
Explain and rewrite the following Scala code:
package repos trait DataMapper[M] { def toBytes(m: M): Array[Byte] def fromBytes(b: Array[Byte]): M }
Explain and rewrite the following Scala code:
/*-------------------------------------------------------------------------*\\ ** ScalaCheck ** ** Copyright (c) 2007-2019 Rickard Nilsson. All rights reserved. ** ** http://www.scalacheck.org ** ** ...
Explain and rewrite the following Scala code:
package scala.test.plugins import scala.tools.nsc import nsc.Global import nsc.Phase import nsc.plugins.Plugin import nsc.plugins.PluginComponent class ThePlugin(val global: Global) extends Plugin { import global.* val name = "multi-rafter" val description = "" val components = List[PluginComponent](thePhase...
Explain and rewrite the following Scala code:
package fpinscala.errorhandling import org.specs2.mutable.Specification class EitherTest extends Specification { "Either" should { "map" in { val toStr: (Any) => String = _.toString val twice: (Int) => Int = _ * 2 Left("error") map twice mustEqual Left("error") Right(3) map twice map to...
Explain and rewrite the following Scala code:
package com.avsystem.commons package serialization import org.scalatest.funsuite.AnyFunSuite case class RecordWithDefaults( @transientDefault a: String = "", b: Int = 42 ) { @generated def c: String = s"$a-$b" } object RecordWithDefaults extends HasApplyUnapplyCodec[RecordWithDefaults] class CustomRecordWithDe...
Explain and rewrite the following Scala code:
package com.kozlowst.oms.orderbot.config import com.kozlowst.oms.common.config.CommonConfig import scala.util.Try /** * Created by tomek on 4/12/17. */ trait OrderBotConfig extends CommonConfig { lazy val exchangeTopic = Try(config.getString("oms.cluster.proxies.order-bot.exchange.topic")).getOrElse("default-e...
Explain and rewrite the following Scala code:
package model import play.api.libs.json.Json case class WidgetStatus( address: String, value: String ) object WidgetStatus { implicit val widgetStatusFormat = Json.format[WidgetStatus] }
Explain and rewrite the following Scala code:
package lore.compiler.types import lore.compiler.semantics.NamePath import lore.compiler.semantics.functions.FunctionSignature import lore.compiler.semantics.structures.{StructDefinition, StructPropertyDefinition} class StructSchema( override val name: NamePath, override val parameters: Vector[TypeVariable], ov...
Explain and rewrite the following Scala code:
package im.actor.server.file.local.http import java.time.{ Duration, Instant } import akka.actor.ActorSystem import akka.event.Logging import akka.http.scaladsl.model.{ HttpResponse, StatusCodes } import akka.http.scaladsl.model.StatusCodes.OK import akka.http.scaladsl.model.headers.ContentDispositionTypes.attachment...
Explain and rewrite the following Scala code:
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you ...
Explain and rewrite the following Scala code:
/* * Copyright 2006-2010 WorldWide Conferencing, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applica...
Explain and rewrite the following Scala code:
/* * Copyright (c) 2013-2014 Christos KK Loverdos */ package com.ckkloverdos.topsort.event /** * A [[com.ckkloverdos.topsort.event.TopSortListener TopSortListener]] * that prints events using a printer function, optionally * transforming the graph nodes to a custom string representation. */ class PrintListener[...
Explain and rewrite the following Scala code:
package com.datastax.spark.connector.cql import java.net.InetAddress import scala.concurrent.duration._ import scala.language.postfixOps import scala.util.Try import scala.util.control.NonFatal import org.apache.spark.{Logging, SparkConf} import com.datastax.driver.core.{ProtocolOptions, SSLOptions} import com.data...
Explain and rewrite the following Scala code:
package is.hail.types.physical import is.hail.annotations.{CodeOrdering, Region, StagedRegionValueBuilder} import is.hail.asm4s.{Code, _} import is.hail.expr.Nat import is.hail.expr.ir.{EmitCodeBuilder, EmitMethodBuilder} import is.hail.types.virtual.TNDArray final class StaticallyKnownField[T, U]( val pType: T, ...
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:
/* * 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) 2018 Georgios Andreadakis * * 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...
Explain and rewrite the following Scala code:
package utils import java.io.File object FileUtils { def listFiles(dir: File): Array[File] = { val these = dir.listFiles these ++ these.filter(_.isDirectory).flatMap(listFiles) } }
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.mogproject.mogami.core.move import com.mogproject.mogami._ import com.mogproject.mogami.core.move.Movement._ import com.mogproject.mogami.core.state.State import com.mogproject.mogami.util.Implicits._ /** * Move builder for CSA-formatted string */ trait MoveBuilder { protected def isCheckMove(state:...
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:
package scalera.moonrover import scalera.moonrover.Simulator.MaxTicks import scalera.moonrover.domain.{Rover, Moon} import scalera.moonrover.domain.Rover.Id import scalera.moonrover.interpreter.Program.LineId import scalera.moonrover.interpreter._ import scala.annotation.tailrec /** * A landing simulator. It's able...
Explain and rewrite the following Scala code:
import org.scalajs.sbtplugin.ScalaJSPlugin.AutoImport._ import sbt.Keys._ import sbt._ object LauncherConfigs { /** ================ React_native task ================ */ val SJS_OUTPUT_PATH = "assets/scalajs-output.js" val fastOptMobile = Def.taskKey[File]("Generate mobile output file for fastOptJS") la...
Explain and rewrite the following Scala code:
package at.ac.tuwien.ifs.ir.model /** * Created by aldo on 10/10/14. */ class QRel(val id: Int, val qrelRecords: List[QRelRecord]) { lazy val mapQRelRecords = qrelRecords.map(qR => (qR.document -> qR)).toMap lazy val documentIDs = qrelRecords.map(qR => (qR.document.id -> qR.rel)).toMap lazy val documents = qre...
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) 2009-2017 Lightbend Inc. <https://www.lightbend.com> */ package play.it.test import java.io.Closeable import java.util.concurrent.TimeUnit import akka.actor.{ ActorSystem, Terminated } import akka.stream.ActorMaterializer import com.typesafe.sslconfig.ssl.{ SSLConfigSettings, SSLLooseConfig } imp...
Explain and rewrite the following Scala code:
object Test extends App { import reflect.ClassTag object SomeEnum extends Enumeration { val one, two, three, four = Value } def sctor[A <: Set[Int]](f: Int => A)(implicit A: ClassTag[A]) : (String, Int => Set[Int]) = (A.runtimeClass.getSimpleName, f) val inits: Seq[(String, Int => Set[Int])] ...
Explain and rewrite the following Scala code:
/* * The MIT License * * Copyright (c) 2017 Fulcrum Genomics LLC * * 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 us...
Explain and rewrite the following Scala code:
/** * Copyright (c) 2013-2016 Extended Mind Technologies Oy * * This file is part of Extended Mind. * * Extended Mind 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 * Li...
Explain and rewrite the following Scala code:
package com.v_standard.vsp import java.util.Calendar import org.scalatest.FunSpec import org.scalatest.matchers.ShouldMatchers /** * Template テストスペッククラス。 */ class TemplateSpec extends FunSpec with ShouldMatchers { describe("build") { describe("正常なフォーマットファイル") { it("展開された文字列を返す") { DefaultTemplateManager....
Explain and rewrite the following Scala code:
package leo.modules import leo.modules.output.logger.Out /** * Command-line parser class that takes the standard string-array input from the main function * and yields an `CLParameterParser` object that offers various * methods for accessing the processed parameters. * * Command line arguments are treated the fo...
Explain and rewrite the following Scala code:
/******************************************************************************* Copyright (c) 2013, KAIST. All rights reserved. Use is subject to license terms. This distribution may include materials developed by third parties. ***********************************************************************...
Explain and rewrite the following Scala code:
package org.repwatch.alexa object SlotNames { val ZipCode = "ZipCode" }
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 2013 TeamNexus * * TeamNexus Licenses this file to you under the MIT License (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at: * * http://opensource.org/licenses/mit-license.php * * Unless required by applicable law ...
Explain and rewrite the following Scala code:
/* * Copyright 2014–2018 SlamData 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 agr...
Explain and rewrite the following Scala code:
package com.github.ligangty.scala.jsoup.nodes import java.nio.charset.CharsetEncoder import com.github.ligangty.scala.jsoup.helper.Strings import com.github.ligangty.scala.jsoup.parser.Parser import scala.collection.mutable import scala.collection.JavaConversions._ import scala.io.Source import scala.util.control.Br...
Explain and rewrite the following Scala code:
/* * Copyright (c) 2013-2013 ICM UW */ package pl.edu.icm.ceon.scala_commons.math import org.junit.Assert._ import org.junit.Test /** * @author Mateusz Fedoryszak (m.fedoryszak@icm.edu.pl) */ class SigmoidFunctionTest { @Test def genTest() { val threshold = List(0.05, 0.001) val span = List(10.0, 40...
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.komanov.future.jmh import java.util.concurrent.{Executors, ThreadFactory, TimeUnit} import com.komanov.future._ import org.openjdk.jmh.annotations._ import scala.concurrent.duration._ import scala.concurrent.{Await, ExecutionContext, Future} @State(Scope.Thread) @BenchmarkMode(Array(Mode.AverageTime)) @...
Explain and rewrite the following Scala code:
package scala.slick.codegen import scala.slick.{model => m} import scala.slick.model.ForeignKeyAction import scala.slick.ast.ColumnOption import scala.slick.SlickException /** Base implementation for a Source code String generator */ abstract class AbstractSourceCodeGenerator(model: m.Model) extend...
Explain and rewrite the following Scala code:
/** Copyright 2015 TappingStone, 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 ...
Explain and rewrite the following Scala code:
sealed trait A enum Nums { case One case Two extends Nums with A case Three } object Test { val list = List[Nums & A](Nums.Two) list.map { case Nums.Two => () } }
Explain and rewrite the following Scala code:
/* * Copyright 2015 HM Revenue & Customs * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or a...
Explain and rewrite the following Scala code:
/* * ScalaCL - putting Scala on the GPU with JavaCL / OpenCL * http://scalacl.googlecode.com/ * * Copyright (c) 2009-2013, Olivier Chafik (http://ochafik.com/) * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following ...
Explain and rewrite the following Scala code:
package controllers import javax.inject.Inject import scala.concurrent.Future import play.api.mvc.Action import play.api.libs.concurrent.Execution.Implicits._ import com.mohiva.play.silhouette.core._ import com.mohiva.play.silhouette.core.providers._ import com.mohiva.play.silhouette.core.services.AuthInfoService impo...
Explain and rewrite the following Scala code:
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may ...
Explain and rewrite the following Scala code:
/* * This file is part of the Linux Variability Modeling Tools (LVAT). * * Copyright (C) 2010 Steven She <shshe@gsd.uwaterloo.ca> * * LVAT 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 v...
Explain and rewrite the following Scala code:
/* * Licensed to Intel Corporation under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * Intel Corporation licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use t...
Explain and rewrite the following Scala code:
/* * Copyright (c) 2015 Contributor. All rights reserved. */ package org.scalaide.debug.internal.expression package context.invoker import org.scalaide.debug.internal.expression.context.JdiContext import org.scalaide.debug.internal.expression.proxies.JdiProxy import org.scalaide.debug.internal.expression.proxies.Obj...
Explain and rewrite the following Scala code:
package zhmyh.yandex.api import scala.util.{Try, Success, Failure} import scalaj.http.{Http, HttpException} import play.api.libs.json.{Json, JsValue} /** * Makes generic Yandex API functionality available to specific API classes. * * @author zhmyh */ trait YandexAPI { /** * The API key and API version. */...
Explain and rewrite the following Scala code:
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not u...
Explain and rewrite the following Scala code:
package controllers import javax.inject.{Inject, Singleton} import play.api.i18n.{Lang, Messages} import controllers.NeedLogin.OptAuthenticated import models._ import play.api.db.Database import play.api.libs.json.{JsObject, JsString, Json} import play.api.mvc.{AnyContent, MessagesAbstractController, MessagesControll...
Explain and rewrite the following Scala code:
package sp.opcua import java.util.UUID import java.util.concurrent.TimeUnit import scala.concurrent.duration._ import scala.util.{Failure, Success} import akka.actor._ import akka.cluster.pubsub.DistributedPubSub import akka.cluster.pubsub.DistributedPubSubMediator.{Publish, Subscribe} import sp.domain._ import sp.d...
Explain and rewrite the following Scala code:
package com.gs.collections.impl.map.mutable /* * Copyright 2011 Goldman Sachs. * * 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.oct.sclaav.visual.computation import com.oct.sclaav.TestHelpers import org.scalatest.{BeforeAndAfter, FunSuite, Matchers} class ComputersTest extends FunSuite with BeforeAndAfter with Matchers with TestHelpers { test("simple pixel location computer") { val gridSize = (8,8) val gridLoc = (2,4) ...
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:
/* * Copyright (c) 2017 Tomas Sezima * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. */ package cz.sezima.chess.core.piece import cz.sezima.chess.core.Colors.{Black, White} import cz.sezima.chess.core.board.Square._ import cz.sezima.chess.core...
Explain and rewrite the following Scala code:
/* * Copyright 2013-2014 JetBrains s.r.o. * * 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 net.fwbrasil.smirror import scala.reflect.runtime.universe._ trait Visibility[C, S <: Symbol] { def symbol: S def owner: SType[C] lazy val privateWithin = symbol.privateWithin match { case NoSymbol => None case symbol => Option(symbol.fullName) } lazy val isProtected = symbol.isProtec...
Explain and rewrite the following Scala code:
package com.softwaremill.macwire.examples.scalatra.logic class LoggedInUser { private var loggedInUsername: Option[String] = None def login(username: String) { loggedInUsername = Some(username) } def username: Option[String] = loggedInUsername }
Explain and rewrite the following Scala code:
package propagator import taintanalysis._ import IFDS.{KillGenInfo, Propagator} import util.Util import org.opalj.tac._ import org.opalj.br.Method abstract class MethodFilteringPropagator(methodSigs: String*) extends Propagator { def canHandle(f: Fact): Boolean = { f.isInstanceOf[Taint] } def propagateNo...
Explain and rewrite the following Scala code:
package json import spray.httpx.Json4sJacksonSupport import org.json4s._ import java.util.UUID /** * author: cvandrei * since: 2016-05-13 */ object Json4sSupport extends Json4sJacksonSupport { implicit def json4sJacksonFormats: Formats = jackson.Serialization.formats(NoTypeHints) + new UUIDFormat //so you...
Explain and rewrite the following Scala code:
class C(a: Any) object F { def byname(a: => Any) = println(a) def hof(a: () => Any) = println(a()) } class COkay extends C(0) { def this(a: Any) { this() def x = "".toString F.byname(x) } } // // The thunk's apply method accesses the MODULE$ // field before it is set. // // 0: getstatic #23; //F...
Explain and rewrite the following Scala code:
package edu.uwm.cs.pir.domain.features.concrete import java.util.Properties trait Configuration { val values : List[Any] val properties : Properties } trait MFeature[X] extends Cloneable with Serializable { val data : X val conf : Configuration } //Marker interface trait Indexable {} //Marker interface tr...
Explain and rewrite the following Scala code:
package at.logic.gapt.proofs.resolution import at.logic.gapt.expr._ import at.logic.gapt.proofs.expansion._ import at.logic.gapt.proofs.lk.ResolutionProofBuilder import at.logic.gapt.proofs.{ Ant, Clause, Sequent, Suc } import at.logic.gapt.utils.SatMatchers import org.specs2.mutable._ class ResolutionTest extends Sp...
Explain and rewrite the following Scala code:
package wakfutcp.protocol.messages.client import wakfutcp.protocol.{ClientMessage, Codec} final case class EndConnectionMessage() extends ClientMessage { override val id = 1 override val arch = 0 } object EndConnectionMessage { implicit val codec: Codec[EndConnectionMessage] = Codec.identity(EndConnectionM...
Explain and rewrite the following Scala code:
package org.openapitools.server.model /** * @param `class` for example: ''null'' * @param displayName for example: ''null'' * @param durationInMillis for example: ''null'' * @param edges for example: ''null'' * @param id for example: ''null'' * @param result for example: ''null'' * @param startTime for ...
Explain and rewrite the following Scala code:
package user import org.atnos.eff._ import org.atnos.eff.all._ import org.atnos.eff.syntax.eval._ import org.atnos.eff.syntax.addon.scalaz.all._ import org.atnos.eff.addon.scalaz._ import cats.Eval import scalaz._ import Scalaz._ import org.specs2._ class ScalazSpec extends Specification { def is = s2""" The Eff m...
Explain and rewrite the following Scala code:
package com.readclosely.snippet /* Copyright 2009-2010 Karl Pichotta 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...
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:
package org.crowdcrawler.proxycrawler.crawler.plugins import java.net.URI import org.crowdcrawler.proxycrawler.ProxyInfo import org.jsoup.Jsoup import scala.collection.JavaConversions._ import scala.collection.mutable /** * For <a href="http://gatherproxy.com/">gatherproxy.com</a>. */ class GatherproxyComPlugin...
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:
/* * Copyright (c) 2002-2018 "Neo Technology," * Network Engine for Objects in Lund AB [http://neotechnology.com] * * This file is part of Neo4j. * * Neo4j 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 Foundatio...
Explain and rewrite the following Scala code:
package im.actor.server.dashboard.controllers.utils.json import play.api.libs.functional.syntax._ import play.api.libs.json.Reads._ import play.api.libs.json.{ JsPath, Reads } import im.actor.server.dashboard.controllers.utils.json.Common._ object ApplicationJsonImplicits { case class LoginForm(email: String, pas...
Explain and rewrite the following Scala code:
package structures import scala.reflect.ClassTag /** * Created by chris on 11/14/17. */ class Row[T:ClassTag](implicit ev: String => T){ var rowId:Int = _ var values:Array[T] = _ var columns:Array[Int] = _ var len:Int = _ def this(str:String)(implicit ev: String => T) { this() parse(str)(ev) ...
Explain and rewrite the following Scala code:
/*********************************************************************** * Copyright (c) 2013-2018 Commonwealth Computer Research, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Apache License, Version 2.0 * which accompanies this distribution and...
Explain and rewrite the following Scala code:
package domala.internal.jdbc.dao import java.sql.Connection import javax.sql.DataSource import org.seasar.doma.DomaNullPointerException object AbstractDaoHelper { def toDataSource(connection: Connection): DataSource = { if (connection == null) throw new DomaNullPointerException("connection") connection mat...
Explain and rewrite the following Scala code:
package newts import cats.instances.AllInstances import newts.syntax.AllSyntax import org.scalacheck.{Arbitrary, Cogen} import org.scalacheck.Arbitrary.arbitrary import org.scalatest.prop.GeneratorDrivenPropertyChecks import org.scalatest.{FunSuite, Matchers} import org.typelevel.discipline.scalatest.Discipline trait...
Explain and rewrite the following Scala code:
package io.peregrine import org.scalatest.{FlatSpec, Matchers} class ShouldSpec extends FlatSpec with Matchers { def removeWhiteSpaces(input: String): String = { input.stripMargin.trim.replaceAll("""(?m)\s+$""", "") } }
Explain and rewrite the following Scala code:
def eval[A, B]: ((A => B), A) => B
Explain and rewrite the following Scala code:
// Copyright: 2010 - 2017 https://github.com/ensime/ensime-server/graphs // License: http://www.gnu.org/licenses/lgpl-3.0.en.html package spray.json /** * Provides additional JsonFormats and helpers */ trait AdditionalFormats { implicit object JsValueFormat extends JsonFormat[JsValue] { def write(value: JsVal...
Explain and rewrite the following Scala code:
/** * FILE: IsUserActorAliveRequester.scala * PERCORSO /Codice/sgad/servertier/src/main/scala/sgad/servertier/presentation/usermanager * DATA CREAZIONE: 25 Febbraio 2014 * AUTORE: ProTech * EMAIL: protech.unipd@gmail.com * * Questo file è proprietà del gruppo ProTech, viene rilasciato sotto licenza Apache v2. *...
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:
object Test { object A }
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 scroll.internal.graph.impl import com.google.common.graph.GraphBuilder import com.google.common.graph.MutableGraph import scroll.internal.graph.RoleGraph object CachedScalaRoleGraph { def copyFrom(from: ScalaRoleGraph, checkForCycles: Boolean): CachedScalaRoleGraph = new CachedScalaRoleGraph(from.root,...
Explain and rewrite the following Scala code:
package io.getquill.ast import io.getquill.Spec import io.getquill.ast.Implicits._ import io.getquill.VIdent import io.getquill.quat.Quat class AstOpsSpec extends Spec { "+||+" - { "unapply" in { BinaryOperation(VIdent("a"), BooleanOperator.`||`, Constant.auto(true)) must matchPattern { case VIde...
Explain and rewrite the following Scala code:
/*********************************************************************** * Copyright (c) 2013-2017 Commonwealth Computer Research, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Apache License, Version 2.0 * which accompanies this distribution and...
Explain and rewrite the following Scala code:
package qrygraph.shared.compilation import qrygraph.shared.data.PigQueryGraph /** detecting cycles in graphs */ object CycleDetection { /** a graph has a cycle if the flattenDependency removed at least one node it */ def graphHasCycle(newGraph: PigQueryGraph): Boolean = GraphFlatten.flattenDependency(newGraph).l...
Explain and rewrite the following Scala code:
package com.github.ldaniels528.trifecta.modules.cassandra import java.io.{File, FileOutputStream, PrintWriter} import java.text.SimpleDateFormat import java.util.concurrent.ExecutorService import com.datastax.driver.core._ import com.github.ldaniels528.commons.helpers.ResourceHelper._ import com.github.ldaniels528.tr...
Explain and rewrite the following Scala code:
package mesosphere.mesos import com.google.protobuf.ByteString import mesosphere.marathon.Protos.HealthCheckDefinition.Protocol import mesosphere.marathon.Protos.MarathonTask import mesosphere.marathon._ import mesosphere.marathon.api.v2.json.V2AppDefinition import mesosphere.marathon.health.HealthCheck import mesosph...
Explain and rewrite the following Scala code:
package sharry.restserver.routes.tus import sharry.common.LenientUri import org.http4s.Request import org.typelevel.ci.CIString object SharryFileName { def apply[F[_]](req: Request[F]): Option[String] = req.headers .get(CIString("sharry-file-name")) .map(_.head.value) .flatMap(LenientUri.per...
Explain and rewrite the following Scala code:
package ir.xamin.providers import ir.xamin.packet.receive.ApplianceGet import org.jivesoftware.smack.packet.IQ import org.jivesoftware.smack.provider.IQProvider import org.xmlpull.v1.XmlPullParser /** this class parses the received packet as an ApplianceGet */ class ApplianceGetProvider extends IQProvider { /** pa...
Explain and rewrite the following Scala code:
import com.alanrodas.scaliapp._ object MainApp extends CLIApp { command named "push" accepts Seq( flag named "verbose" alias "v" as false, flag named "quiet" alias "q" as false, flag named "dry-run" alias "n" as false, flag named "force" alias "f" as false, arg named "repo" taking 1 value, arg named "rec...
Explain and rewrite the following Scala code:
/* * Copyright (C) 2009-2017 Lightbend Inc. <https://www.lightbend.com> */ package play.libs import java.io.ByteArrayInputStream import java.time.Instant import java.util.Optional import com.fasterxml.jackson.databind.{ JsonNode, ObjectMapper } import org.specs2.mutable.Specification import org.specs2.specificatio...
Explain and rewrite the following Scala code:
/* * Copyright 2012 Alexander Bertram * * 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 actors import akka.actor._ import akka.pattern.ask import config.Constants import config.Constants._ import domain.{OutcomeTextMessage, Handshake, IncomeTextMessage} import protocol.WsContainer import scala.util.{Failure, Success} import scala.concurrent.ExecutionContext.Implicits.global class ConnectionActo...
Explain and rewrite the following Scala code:
package controllers.application import controllers.Application import drt.shared._ import play.api.mvc.{Action, AnyContent} import services.graphstages.Crunch import services.{BankHolidayApiClient, OOHChecker, SDate} trait WithContactDetails { self: Application => def getContactDetails: Action[AnyContent] = Act...