instruction
stringclasses
1 value
output
stringlengths
5
1M
Explain and rewrite the following Scala code:
/* * Copyright 2014 JHC Systems Limited * * 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 ag...
Explain and rewrite the following Scala code:
/* * Copyright (c) 2013 Christos KK Loverdos * * 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:
package gr.cslab.ece.ntua.musqle.catalog import java.io._ import scala.collection.mutable import com.fasterxml.jackson.databind.ObjectMapper import com.fasterxml.jackson.module.scala.DefaultScalaModule import gr.cslab.ece.ntua.musqle.MuSQLEContext import gr.cslab.ece.ntua.musqle.engine.{Engine, Postgres, Spark} impor...
Explain and rewrite the following Scala code:
package net.sansa_stack.rdf.spark.io.rdfxml import java.io.InputStream import scala.reflect.ClassTag import com.google.common.io.ByteStreams import net.sansa_stack.rdf.spark.utils.ScalaUtils import org.apache.hadoop.conf.Configuration import org.apache.hadoop.fs.{FileStatus, Path} import org.apache.hadoop.io.{LongWr...
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.jetbrains.plugins.scala package codeInsight.intention.types import com.intellij.codeInsight.intention.PsiElementBaseIntentionAction import org.jetbrains.plugins.scala.lang.psi.ScImportsHolder import com.intellij.psi.util.PsiTreeUtil import org.jetbrains.plugins.scala.lang.psi.api.toplevel.packaging.ScPacka...
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 sbt import DependencyFilter._ final case class ConflictWarning(label: String, level: Level.Value, failOnConflict: Boolean) { @deprecated("`filter` is no longer used", "0.13.0") val filter: ModuleFilter = (_: ModuleID) => false @deprecated("`group` is no longer used", "0.13.0") val group: ModuleID => S...
Explain and rewrite the following Scala code:
package mot.protocol import mot.buffer.WriteBuffer import mot.buffer.ReadBuffer /** * Empty frame that signals the normal finalization of a connection. Nothing is sent or received after this frame. */ case class ByeFrame() extends Frame { def messageType = MessageTypes.Bye def length = 0 def writeSpecific(w...
Explain and rewrite the following Scala code:
package sbt package std import language.experimental.macros import scala.reflect._ import reflect.macros._ import reflect.internal.annotations.compileTimeOnly import Def.{ Initialize, ScopedKey } import appmacro.ContextUtil import complete.Parser /** Implementation detail. The wrap methods temporarily hold inputs (...
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 questions import org.scalatest.{FreeSpec, MustMatchers} class QuestionGeneratorSpec extends FreeSpec with MustMatchers { "QuestionGenerator generates" - { "correct question" in new Fixture { questionAndAnswer(-2, 10, Plus).expectedAnswer mustBe 8 questionAndAnswer(-2, 10, Minus).expectedAn...
Explain and rewrite the following Scala code:
// // Copyright 2014 Commonwealth Bank of Australia // // // // 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:
/* * Copyright (c) 2014-16 Miles Sabin * * 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) 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 com.mammatustech import io.advantageous.qbit.admin.ManagedServiceBuilder import io.advantageous.qbit.annotation.RequestMapping /** * Created by fadi on 10/12/15. */ @RequestMapping(Array("/hello")) object HelloWorldService { def main(args: Array[String]) { val managedServiceBuilder: ManagedServiceBuil...
Explain and rewrite the following Scala code:
package models import models.daos._ import com.mohiva.play.silhouette.api.LoginInfo import slick.driver.JdbcProfile import slick.lifted.ProvenShape.proveShapeOf import com.mohiva.play.silhouette.api.LoginInfo import com.mohiva.play.silhouette.impl.daos.DelegableAuthInfoDAO import com.mohiva.play.silhouette.impl.prov...
Explain and rewrite the following Scala code:
package uk.gov.gds.ier.validation.constraints import uk.gov.gds.ier.validation.{FormKeys, ErrorMessages, Key} import uk.gov.gds.ier.model.{OverseasParentName, Name, PreviousName} import play.api.data.validation.{Invalid, Valid, Constraint} import play.api.data.Mapping import play.api.data.Forms._ import play.api.Logge...
Explain and rewrite the following Scala code:
/*============================================================================ This Chisel source file is part of a pre-release version of the HardFloat IEEE Floating-Point Arithmetic Package, by John R. Hauser (with some contributions from Yunsup Lee and Andrew Waterman, mainly concerning testing). Copyright 2010, ...
Explain and rewrite the following Scala code:
package net.tobysullivan.shorturl import scala.collection.mutable.HashMap object InMemoryDataStore extends HashStore with StatsStore { private val hashStore = new HashMap[Int, String] def findNextAvailableHash(): Int = { // Search the mappings for the largest hash used val maxHash = hashStore.foldLeft(0)...
Explain and rewrite the following Scala code:
package com.twitter.finagle.stats import com.twitter.common.metrics.{MetricCollisionException, Metrics} import org.junit.runner.RunWith import org.scalatest.junit.JUnitRunner import org.scalatest.FunSuite @RunWith(classOf[JUnitRunner]) class MetricsStatsReceiverTest extends FunSuite { private[this] val rootReceiver...
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:
import scala.annotation.unchecked.uncheckedVariance import scala.language.implicitConversions sealed trait HList extends Product with Serializable final case class ::[+H, +T <: HList](head: H, tail: T) extends HList sealed trait HNil extends HList case object HNil extends HNil trait HListable[T] { type Out <: HLi...
Explain and rewrite the following Scala code:
/* * Copyright 2001-2013 Artima, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agre...
Explain and rewrite the following Scala code:
/** * Copyright 2011-2017 GatlingCorp (http://gatling.io) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by appli...
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 coffeescript import sbt._ import sbt.Keys._ import sbt.Project.Initialize import scala.collection.JavaConversions._ import java.nio.charset.Charset import java.io.File object Plugin extends sbt.Plugin { import CoffeeKeys._ object CoffeeKeys { val coffee = TaskKey[Seq[File]]("coffee", "Compile coffee ...
Explain and rewrite the following Scala code:
package scala.reflect.internal import org.junit.Assert._ import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.JUnit4 import scala.runtime.ScalaRunTime import scala.tools.nsc.symtab.SymbolTableForUnitTesting @RunWith(classOf[JUnit4]) class TreeGenTest { object symbolTable extends SymbolTab...
Explain and rewrite the following Scala code:
package com.sksamuel.elastic4s /** * An [[ElasticRequest]] models all the required fields for a request to be * sent to Elasticsearch. Request types such as [[com.sksamuel.elastic4s.requests.searches.SearchRequest]], * etc, are ultimately converted into this class by means of a [[Handler]] typeclass instance. ...
Explain and rewrite the following Scala code:
/* * Copyright 2015 Commonwealth Computer Research, 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 applicabl...
Explain and rewrite the following Scala code:
package eu.brosbit.opos.snippet.admin import net.liftweb.http.{FileParamHolder, S, SHtml} import net.liftweb.util.Helpers._ import net.liftweb.common.{Box, Full, Empty} import java.io.ByteArrayOutputStream import java.nio.file.{Paths, Files} /** * Created by ms on 04.01.16. */ class AdminLogoSn { def show() = { ...
Explain and rewrite the following Scala code:
package definiti.native object BooleanExtension { def not(boolean: Boolean): Boolean = !boolean def xor(boolean: Boolean, other: Boolean): Boolean = boolean && !other || !boolean && other }
Explain and rewrite the following Scala code:
package models.auth.form import models.util.Constants import play.api.mvc.{Session, Controller, Request} import play.cache.Cache import scala.concurrent.Future trait AuthHandling extends Controller { def redirectTo[A](page: String, request:Request[A], message:String, clean:Boolean = false) = { val r = Redirect...
Explain and rewrite the following Scala code:
import java.text.{DateFormat, SimpleDateFormat} import java.util.{Calendar, Date, Locale, TimeZone} import MasterControlProgram.{Update, UpdateDisplay} import akka.actor.{Actor, Props} import akka.event.Logging import com.pi4j.io.gpio.{GpioFactory, PinState, RaspiPin} import com.pi4j.io.i2c.I2CBus import scala.concur...
Explain and rewrite the following Scala code:
package spire.math import org.scalatest.FunSuite class PackageTest extends FunSuite { test("pow(Int, Int)") { assert(pow(2, 2) === 4) } test("pow(Long, Long)") { assert(pow(1000000000L, 2) === 1000000000000000000L) assert(pow(1024L, 4) === 1099511627776L) assert(pow(2L, 40) === 1099511627776L) ...
Explain and rewrite the following Scala code:
package blended.jms.sampler.internal trait JmsSamplerMBean { def getEncoding() : String def setEncoding(newEncoding : String) : Unit def getDestinationName() : String def setDestinationName(newName : String) : Unit def isSampling() : Boolean def startSampling() : Unit def stopSampling() : Unit }
Explain and rewrite the following Scala code:
/* * Copyright (c) 2012-2015 Snowplow Analytics Ltd. All rights reserved. * * This program is licensed to you under the Apache License Version 2.0, * and you may not use this file except in compliance with the Apache License Version 2.0. * You may obtain a copy of the Apache License Version 2.0 at http://www.apach...
Explain and rewrite the following Scala code:
/* * PrinterProblem.scala * Book example unit test. * * Created By: Michael Reposa (mreposa@cra.com), Avi Pfeffer (apfeffer@cra.com) * Creation Date: Feb 26, 2016 * * Copyright 2013 Avrom J. Pfeffer and Charles River Analytics, Inc. * See http://www.cra.com or email figaro@cra.com for information. * ...
Explain and rewrite the following Scala code:
package util import controllers.RootController.XSPageHandle import net.liftweb.http.js.{JsCmds, JsCmd} import net.liftweb.util.FatLazy class PropOptV[T](dflt: Option[T], get: () => Option[T], set: Option[T] => Unit) { private var value = get().orElse(dflt) def apply(): Option[T] = value def update(v: Option[...
Explain and rewrite the following Scala code:
package com.stulsoft.chart import com.stulsoft.chart.util.Utils import org.jfree.chart.plot.PlotOrientation import org.jfree.chart.{ChartFactory, ChartPanel, JFreeChart} import org.jfree.data.category.{CategoryDataset, DefaultCategoryDataset} import org.jfree.ui.{ApplicationFrame, RefineryUtilities} import scala.io.S...
Explain and rewrite the following Scala code:
package pl.edu.osp import akka.actor.{Props, ActorRef, Actor} case class Stop() case class Next() case class Result() class PrimeMainActor(many:Int) extends Actor { val max = 15*many val ref:Array[ActorRef] = new Array[ActorRef](15) val primesCont = new Array[Int](15) var cheef:ActorRef = null for(i <- 0 ...
Explain and rewrite the following Scala code:
package org.scalatra import _root_.akka.actor.ActorSystem import org.scalatra.test.specs2.MutableScalatraSpec import scala.concurrent.Future class AkkaSupportAfterFilterFilter extends ScalatraFilter with FutureSupport { val system = ActorSystem() var actionTime: Long = _ var afterTime: Long = _ var afterCoun...
Explain and rewrite the following Scala code:
package argoko import org.apache.logging.log4j.LogManager import org.zeromq.ZMQ; object HwServer { val log = LogManager.getLogger(HwServer.getClass) def main(args : Array[String]) : Unit = { log.info("Open context") val context = ZMQ.context(1); // Socket to talk to clients log.info("Create res...
Explain and rewrite the following Scala code:
package com.herokuapp.ochimikan.records.service import com.typesafe.config.{ ConfigException, ConfigFactory } import org.specs2.Specification /** Specification for [[Settings]]. */ class SettingsSpec extends Specification { def is = s2""" The following Settings, ${valid1.config} Should ${beExpected(valid1)}...
Explain and rewrite the following Scala code:
package mesosphere.marathon package core.health import java.time.Clock import com.wix.accord.validate import mesosphere.UnitTest import mesosphere.marathon.Protos.HealthCheckDefinition.Protocol import mesosphere.marathon.api.JsonTestHelper import mesosphere.marathon.api.v2.ValidationHelper import mesosphere.marathon....
Explain and rewrite the following Scala code:
package com.twitter.finagle.protobuf.rpc.channel /** * Lookup repository that maps method names to 4 bytes. * **/ trait MethodLookup { def encode(methodName: String): Int def lookup(code: Int): String }
Explain and rewrite the following Scala code:
package fpinscala.laziness import org.scalatest.Matchers import org.scalatest.FlatSpec import org.junit.runner.RunWith import org.scalatest.junit.JUnitRunner import fpinscala.laziness.Stream._ @RunWith(classOf[JUnitRunner]) class StreamSpec extends FlatSpec with Matchers { // Exercise 5.1 "toList, ...
Explain and rewrite the following Scala code:
/* * Copyright (C) 2015 Romain Reuillon * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This progra...
Explain and rewrite the following Scala code:
package eu.akkamo /** * Simple factory, providing `LoggingAdapter` instance for specified category (e.g. module name, * selected class). This factory is registered by the [[LogModule]] into the ''Akkamo'' context. * * @author jubu */ trait LoggingAdapterFactory { /** * Returns instance of `LoggingAda...
Explain and rewrite the following Scala code:
/** * Copyright 2014 Thomas Feng * * 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, Ve...
Explain and rewrite the following Scala code:
/******************************************************************************* * Copyright (c) 2013 Guillaume DUBUISSON DUPLESSIS <guillaume.dubuisson_duplessis@insa-rouen.fr>. * All rights reserved. This program and the accompanying materials * are made available under the terms of the GNU Public License v3.0 * ...
Explain and rewrite the following Scala code:
package notebook import play.api.libs.json._ import play.api.libs.functional.syntax._ trait ObservableMessage case class ObservableBrowserToVM(id: String, new_value: JsValue) extends ObservableMessage object ObservableBrowserToVM { implicit val format = Json.format[ObservableBrowserToVM] } case class ObservableVMT...
Explain and rewrite the following Scala code:
package io.youi.spatial sealed trait DimType object DimType { case object Auto extends DimType case object Manual extends DimType }
Explain and rewrite the following Scala code:
/** * Copyright 2014 Andrea Esposito <and1989@gmail.com> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applic...
Explain and rewrite the following Scala code:
/* * Copyright (C) 2011 Julien Letrouit * * 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 com.roundeights.scalon import com.google.gson.{JsonElement, Gson, GsonBuilder} import scala.language.implicitConversions import java.util.UUID /** * The various types of values */ object nType extends Enumeration { type nType = Value val String, Int, Float, Bool, Null, Object, Array = Value } /** ...
Explain and rewrite the following Scala code:
/** * _____ _ _ _____ _ * | __| |_ ___|_|___ ___| __|___| |_ _ ___ ___ * |__ | _| _| | | . |__ | . | | | | -_| _| * |_____|_| |_| |_|_|_|_ |_____|___|_|\_/|___|_| * |___| * File: Printer.scala * Author: Mikaël Mayer * ...
Explain and rewrite the following Scala code:
/* * Copyright (c) 2011, Todd Cook. * 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 ...
Explain and rewrite the following Scala code:
package is.hail.expr.ir import is.hail.ExecStrategy import is.hail.HailSuite import is.hail.TestUtils.assertEvalsTo import is.hail.types.physical.{PCanonicalLocus, PInterval} import is.hail.types.virtual._ import is.hail.utils.{FastIndexedSeq, FastSeq, Interval} import is.hail.variant.{Locus, ReferenceGenome} import o...
Explain and rewrite the following Scala code:
package mesosphere.marathon.core.launchqueue.impl import java.util.concurrent.TimeUnit import mesosphere.marathon.core.base.Clock import mesosphere.marathon.state.{ AppDefinition, PathId, Timestamp } import org.slf4j.LoggerFactory import scala.concurrent.duration._ /** * Manages the task launch delays for every 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:
/* * 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 shapeless.datatype.tensorflow import com.google.protobuf.ByteString import org.tensorflow.example._ import shapeless.datatype.mappable.{BaseMappableType, MappableType} trait BaseTensorFlowMappableType[V] extends MappableType[Features.Builder, V] { def from(value: Feature): V = fromSeq(value).head def to(v...
Explain and rewrite the following Scala code:
package sativum trait Condition { def condition(): Boolean }
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 controllers import javax.inject.Inject import com.mohiva.play.silhouette.api._ import com.mohiva.play.silhouette.api.exceptions.AuthenticationException import com.mohiva.play.silhouette.api.services.AuthInfoService import com.mohiva.play.silhouette.impl.authenticators.BearerTokenAuthenticator import com.mohiv...
Explain and rewrite the following Scala code:
package org.mdoc.sbt.mdoc import org.mdoc.sbt.mdoc.MdocPlugin.autoImport.addCommandsAlias import sbt._ object ExtCommands { lazy val settings = Seq( Keys.commands += mkCommandAlias("mdocValidate", MdocKeys.mdocValidateCommands), MdocKeys.mdocValidateCommands := Seq( "clean", "coverage", "c...
Explain and rewrite the following Scala code:
package fr.renoux.gaston.input import eu.timepit.refined.auto._ import fr.renoux.gaston.model.constraints.TopicsSimultaneous import fr.renoux.gaston.model.preferences.{PersonTopicPreference, TopicsExclusive} import fr.renoux.gaston.model.{Problem, Score} import org.scalatest.flatspec.AnyFlatSpec import org.scalatest.m...
Explain and rewrite the following Scala code:
/* * La Trobe University - Distributed Deep Learning System * Copyright 2016 Matthias Langer (t3l@threelights.de) * * 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.apa...
Explain and rewrite the following Scala code:
// These are meant to be typed into the REPL. You can also run // scala -Xnojline < repl-session.scala to run them all at once. val symbols = Array("<", "-", ">") val counts = Array(2, 10, 2) val pairs = symbols.zip(counts) for ((s, n) <- pairs) Console.print(s * n) symbols.zip(counts).toMap
Explain and rewrite the following Scala code:
package sbtsparkpackage import java.util.Locale import sbt.Package.ManifestAttributes import sbt._ import Keys._ import Path.relativeTo import sbtassembly.AssemblyPlugin import sbtassembly.MappingSet import sbtassembly.AssemblyKeys.{assembledMappings, assembly} import scala.io.Source._ import scala.xml.{Elem, Node, N...
Explain and rewrite the following Scala code:
// Equites, a Scala chess playground // Copyright © 2011-2013 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:
package reaktor.scct import scala.tools.nsc.reporters.ConsoleReporter import java.io.{FileNotFoundException, File, FileOutputStream} import org.specs2.matcher.{Expectable, Matcher} import org.specs2.mutable._ import tools.nsc._ trait InstrumentationSpec extends Specification with InstrumentationSupport { def class...
Explain and rewrite the following Scala code:
package com.softwaremill.react.kafka.commit import com.softwaremill.react.kafka.commit.native.NativeCommitterFactory import kafka.consumer.KafkaConsumer import scala.util.Try class CommitterProvider { def create[T](kafkaConsumer: KafkaConsumer[T]): Try[OffsetCommitter] = { val factoryClass = if (kafkaConsumer...
Explain and rewrite the following Scala code:
/* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved. * * The contents of this file are subject to the terms of either the GNU * General Public License Version 2 only ("GPL") or the Common * Development and Distribution License("CDDL") (...
Explain and rewrite the following Scala code:
/* __ *\\ ** ________ ___ / / ___ Scala API ** ** / __/ __// _ | / / / _ | (c) 2003-2018, LAMP/EPFL ** ** __\\ \\/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\\___/_/...
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:
package filodb.core.store import scala.collection.concurrent.TrieMap import scala.concurrent.{ExecutionContext, Future} import com.typesafe.scalalogging.StrictLogging import filodb.core._ import filodb.core.metadata.Dataset /** * An in-memory MetaStore. Does not aim to keep data distributed, but is just a * sing...
Explain and rewrite the following Scala code:
/* * Copyright 2011 javaBin * 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 agree...
Explain and rewrite the following Scala code:
package controllers import javax.inject.{ Inject, Singleton } import models.Stash import models.services.{ JsonConverter, StashStore } import play.api.libs.json._ import play.api.mvc import play.api.mvc.{ Action, AnyContent, Controller, Result } import utils.Constants import play.api.libs.concurrent.Execution.Implic...
Explain and rewrite the following Scala code:
package com.iamtrask.saddle /** * Description of file content. * * @author atrask * 7/20/13 */ object main { def main(args: Array[String]) { new SocketServer(); println("hello world") } }
Explain and rewrite the following Scala code:
package me.benetis.model import java.util.UUID trait Brands[F[_]] { def findAll: F[List[Brand]] def create(brandName: BrandName): F[BrandId] } case class BrandName(value: String) extends AnyVal case class BrandId(uuid: UUID) extends AnyVal case class Brand(uuid: BrandId, name: BrandName)
Explain and rewrite the following Scala code:
/* * Scala.js (https://www.scala-js.org/) * * Copyright EPFL. * * Licensed under Apache License 2.0 * (https://www.apache.org/licenses/LICENSE-2.0). * * See the NOTICE file distributed with this work for * additional information regarding copyright ownership. */ package org.scalajs.linker.standard /** A ver...
Explain and rewrite the following Scala code:
package org.scalajs.nio class InvalidMarkException() extends RuntimeException { }
Explain and rewrite the following Scala code:
/* * Derived from https://github.com/spray/spray/blob/v1.1-M7/spray-http/src/main/scala/spray/http/HttpHeader.scala * * Copyright (C) 2011-2012 spray.io * Based on code copyright (C) 2010-2011 by the BlueEyes Web Framework Team (http://github.com/jdegoes/blueeyes) * * Licensed under the Apache License, Version 2....
Explain and rewrite the following Scala code:
/* Generated File */ package models.table.film import com.kyleu.projectile.services.database.slick.SlickQueryService.imports._ import java.time.ZonedDateTime import models.film.ActorRow object ActorRowTable { val query = TableQuery[ActorRowTable] def getByPrimaryKey(actorId: Int) = query.filter(_.actorId === act...
Explain and rewrite the following Scala code:
/** * @author ven */ package org.jetbrains.plugins.scala package lang package psi package impl package toplevel package typedef import com.intellij.openapi.progress.ProgressManager import com.intellij.openapi.project.Project import com.intellij.psi.search.GlobalSearchScope import com.intellij.psi.{PsiClass, PsiClassTy...
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 org.libss.util import org.scalatest.{FlatSpec, Matchers} import org.libss.util.helpers.PasswordHasher /** * date: 10.04.2014 21:52 * author: Kaa */ class PasswordHasherTest extends FlatSpec with Matchers with PasswordHasher { val DefaultAdminSalt = "f693f8bf-80ff-448c-8c76-41532fd3847e" "H...
Explain and rewrite the following Scala code:
package us.feliscat.util /** * @author K. Sakamoto * Created on 2017/05/24 */ package object primitive { implicit class FloatUtils(val repr: Float) extends AnyVal { def toHexString: String = { java.lang.Float.toHexString(repr) } } implicit class DoubleUtils(val repr: Double) extends ...
Explain and rewrite the following Scala code:
package vggames.scala.specs import org.junit.runner.RunWith import org.specs2.mutable.Specification import org.specs2.runner.JUnitRunner import vggames.shared.task.status.Ok import vggames.scala.code.RestrictedFunction2 import org.specs2.main.ArgProperty import vggames.scala.code.RestrictedFunction0 @RunWith(classOf[...
Explain and rewrite the following Scala code:
/** * Copyright 2015 Yahoo Inc. Licensed under the Apache License, Version 2.0 * See accompanying LICENSE file. */ package models.form /** * @author hiral */ sealed trait TopicOperation case class TConfig(name: String, value: Option[String], help: Option[String]) case class CreateTopic(topic: String, partitio...
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 { sealed abstract class Foo[T] case object Bar1 extends Foo[Int] case object Bar2 extends Foo[String] case object Bar3 extends Foo[AnyRef] def ex1[T](xs: List[T]) = xs match { case ys: List[_] => "ok" } def ex2[T](xx: (Foo[T], Foo[T])) = xx match { case (Bar1, Bar1) => () case (_...
Explain and rewrite the following Scala code:
package debop4s.core.jodatime import org.joda.time.{Chronology, DateTime, MutableDateTime, ReadableDateTime} class JodaRichReadableDateTime(val self: ReadableDateTime) extends AnyVal with Ordered[ReadableDateTime] { def millis: Long = self.getMillis def second: Int = self.getSecondOfMinute def minute: Int =...
Explain and rewrite the following Scala code:
package io.hydrosphere.mist.api.ml import org.apache.spark.ml.{PipelineModel, Transformer} import scala.collection.mutable import scala.io.Source // TODO: tests // TODO: HDFS support object ModelLoader { private val RandomForestClassifier = "org.apache.spark.ml.classification.RandomForestClassificationModel" pr...
Explain and rewrite the following Scala code:
/** * Copyright (C) 2012 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 program i...
Explain and rewrite the following Scala code:
package ru.finagram.test import uk.co.jemos.podam.api.PodamFactoryImpl import scala.reflect.ClassTag trait Podam { protected val factory = new PodamFactoryImpl() def random[T <: AnyRef](implicit classTag: ClassTag[T]): T = { factory.manufacturePojoWithFullData( classTag.runtimeClass.asInstanceOf[Class...
Explain and rewrite the following Scala code:
package no.mesan.hipchatparse.utils import java.util.regex.Pattern import scala.concurrent.duration.Duration import scala.concurrent.{ExecutionContext, Await, Future} import scala.util.{Failure, Success, Try} import scala.concurrent.ExecutionContext.global /** Lousy name... TODO */ object Tools { private val urlR...
Explain and rewrite the following Scala code:
package com.github.ligangty.scala.jsoup.parser import com.github.ligangty.scala.jsoup.helper.Strings import com.github.ligangty.scala.jsoup.{TextUtil, Jsoup} import com.github.ligangty.scala.jsoup.nodes._ import com.github.ligangty.scala.jsoup.select.Elements import org.scalatest.FunSuite /** * Tests for the Parser ...