instruction
stringclasses
1 value
output
stringlengths
5
1M
Explain and rewrite the following Scala code:
package com.cerner.beadledom.lifecycle.legacy import org.mockito.Mockito import org.scalatest.mockito.MockitoSugar import org.scalatest.{FunSpec, MustMatchers} import scala.collection.JavaConverters._ /** * Unit tests for [[LifecycleShutdownManagerImpl]]. * * @author John Leacox */ class LifecycleShutdownMana...
Explain and rewrite the following Scala code:
/* * Copyright (c) 2014 Dufresne Management Consulting LLC. */ package com.nickelsoftware.bettercare4me.hedis.hedis2014 import scala.util.Random import org.joda.time.DateTime import org.joda.time.Interval import com.nickelsoftware.bettercare4me.hedis.HEDISRule import com.nickelsoftware.bettercare4me.hedis.Scorecar...
Explain and rewrite the following Scala code:
package im.tox.antox.activities import java.util.regex.Pattern import android.content.pm.PackageManager import android.os.Bundle import android.support.v7.app.ActionBarActivity import android.text.util.Linkify import android.view.MenuItem import android.widget.TextView import im.tox.antox.R class About extends Actio...
Explain and rewrite the following Scala code:
package gmodlab object Tools { def stringToBytes(s:String):Seq[Byte] = s.getBytes("ISO8859-1") def getQueueBytes(buf:java.util.concurrent.ConcurrentLinkedQueue[Byte]):Array[Byte] = { val n = buf.size val a = new Array[Byte](n) for (i <- 0 until n) a(i) = buf.poll.toByte a ...
Explain and rewrite the following Scala code:
/** * Copyright 2014-2015 Red Hat, Inc. and/or its affiliates * and other contributors as indicated by the @author tags. * * 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 2022 HM Revenue & Customs * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or a...
Explain and rewrite the following Scala code:
package com.thetestpeople.trt.importer.jenkins import org.joda.time.Duration import org.joda.time.DateTime import scala.xml.Elem import scala.xml.Node import java.net.URI class JenkinsBuildXmlParser { @throws[ParseException] def parseBuild(elem: Elem): JenkinsBuildSummary = { val url = getFieldOpt(elem, "url...
Explain and rewrite the following Scala code:
package mesosphere.marathon.upgrade import java.net.URL import mesosphere.marathon.event.{ DeploymentStatus, DeploymentStepSuccess, DeploymentStepFailure } import scala.concurrent.{ Future, Promise } import scala.util.{ Failure, Success } import akka.actor._ import akka.event.EventStream import org.apache.mesos.Sche...
Explain and rewrite the following Scala code:
/** * This file is part of mycollab-scheduler. * * mycollab-scheduler 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. * * mycol...
Explain and rewrite the following Scala code:
package com.monovore.decline.time import java.time._ import java.time.format.DateTimeFormatter import cats.{Eq, Show} import com.monovore.decline.Argument private[time] trait JavaTimeInstances { implicit val eqInstant: Eq[Instant] = Eq.fromUniversalEquals implicit val showInstant: Show[Instant] = Show.fromToStri...
Explain and rewrite the following Scala code:
package db import org.scalatest.{FunSpec, Matchers} import org.junit.Assert._ import java.util.UUID class PasswordResetRequestsDaoSpec extends FunSpec with Matchers with util.TestApplication { it("create") { val user = Util.createRandomUser() val pr = passwordResetRequestsDao.create(Some(Util.createdBy), u...
Explain and rewrite the following Scala code:
package model import play.api.libs.json._ /** * Represents the Swagger definition for Link. * @param additionalProperties Any additional properties this model may have. */ @javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2022-02-13T02:38:35...
Explain and rewrite the following Scala code:
package util import com.typesafe.config.{Config, ConfigFactory} import akka.actor.{ExtendedActorSystem, ExtensionIdProvider, ExtensionId, Extension} import scala.util.Properties class ConfExtensionImpl(config: Config) extends Extension { config.checkValid(ConfigFactory.defaultReference) val appHostName = config....
Explain and rewrite the following Scala code:
import java.time.Instant sealed abstract class Transfer { val time: Instant val location: Location } case class Pickup(time: Instant, location: Location) extends Transfer case class Dropoff(time: Instant, location: Location) extends Transfer case class Trip(pickup: Pickup, dropoff: Dropoff, passengers: Int, dist...
Explain and rewrite the following Scala code:
package io.swagger.client.model import io.swagger.client.core.ApiModel import org.joda.time.DateTime case class VariableNew ( /* User-defined variable display name. */ name: String, /* Variable category like Mood, Sleep, Physical Activity, Treatment, Symptom, etc. */ category: String, /* Abbreviated name o...
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 java.util.concurrent abstract class T...
Explain and rewrite the following Scala code:
// Copyright (C) 2011-2012 the original author or authors. // See the LICENCE.txt file distributed with this work for additional // information regarding copyright ownership. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You ...
Explain and rewrite the following Scala code:
package com.siemens.icvro.dhm import com.siemens.icvro.dhm.geometry.Polygon import org.scalatest.FunSuite class PnPolyTest extends FunSuite{ test("Point in square") { assert(Polygon(Seq(Tuple2(0,0), Tuple2(2,0), Tuple2(2,2), Tuple2(0,2))) hasPoint Tuple2(1,1)) assert(Polygon(Seq(Tuple2(0,2), Tuple2(2,2), Tu...
Explain and rewrite the following Scala code:
package com.gilt.gfc.logging /** * Opens up protected log functions in Loggable so they are accessible e.g. through a companion object, * reducing the number of logger instances: * * object Foo extends OpenLoggable * * class Foo { * import Foo._ * info("bar") * } */ trait OpenLoggable extends Loggable { ...
Explain and rewrite the following Scala code:
package org.jetbrains.plugins.scala package lang.refactoring.util import com.intellij.openapi.diagnostic.Logger import com.intellij.psi.{PsiDirectory, PsiBundle, PsiElement, PsiClass} import com.intellij.ide.fileTemplates.{FileTemplateUtil, FileTemplateManager, FileTemplate} import java.util.Properties import com.inte...
Explain and rewrite the following Scala code:
package reopp.dreams.connectors import reopp.common.guardedcommands.{Formula, GCSolution, GCConnector} import reopp.common._ import reopp.dreams.Actor import reopp.common.{Solution, CBuilder, Constraints, Connector} /** * Created with IntelliJ IDEA. * User: jose * Date: 12/11/12 * Time: 16:24 * To change this te...
Explain and rewrite the following Scala code:
package com.github.bomgar.sqs import com.github.bomgar.sqs.domain.{Message, QueueReference} import scala.concurrent.{ExecutionContext, Future} /** * maxNumberOfMessages * * The maximum number of messages to return. Amazon SQS never returns * more messages than this value but may return fewer. Values can be from ...
Explain and rewrite the following Scala code:
/* Scala.js compiler * Copyright 2013 LAMP/EPFL * @author Sébastien Doeraene */ package org.scalajs.core.compiler import scala.tools.nsc._ import org.scalajs.core.ir import ir.{Definitions, Types} /** Glue representation of types as seen from the IR but still with a * reference to the Symbols. * * @author ...
Explain and rewrite the following Scala code:
package water.sparkling.itest.standalone import org.apache.spark.h2o._ import org.apache.spark.{SparkConf, SparkContext} import org.junit.runner.RunWith import org.scalatest.FunSuite import org.scalatest.junit.JUnitRunner import water.sparkling.itest.SparkITest /** * Test for Jira Hex-Dev 64 : Import airlines data ...
Explain and rewrite the following Scala code:
import org.scalacheck._ import org.scalacheck.Prop._ import org.scalacheck.Gen._ object Tai64Properties extends Properties("Tai64") { import Tai64._ val genTai64 = for(secs <- posNum[Long]) yield Tai64(secs) val genTai64N = for(secs <- posNum[Long]; nanos <- posNum[Long]) yie...
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:
/* * Copyright (C) 2016 University of Basel, Graphics and Vision Research Group * * 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) an...
Explain and rewrite the following Scala code:
package com.wavesplatform.api.http import akka.http.scaladsl.server.Route import com.wavesplatform.common.utils.Base58 import com.wavesplatform.settings.RestAPISettings import com.wavesplatform.wallet.Wallet import play.api.libs.json.Json case class WalletApiRoute(settings: RestAPISettings, wallet: Wallet) extends Ap...
Explain and rewrite the following Scala code:
package scala.scalanative package nir package serialization import java.nio.ByteBuffer import scala.collection.mutable import nir.{Tags => T} final class BinaryDeserializer(_buffer: => ByteBuffer) { private lazy val buffer = _buffer import buffer._ private lazy val header: Map[Global, Int] = { buffer.posit...
Explain and rewrite the following Scala code:
/* * Copyright 2021 ABSA Group 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 agr...
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 2016 The BigDL Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agr...
Explain and rewrite the following Scala code:
package com.realizationtime.btdogg import akka.Done import akka.actor.{ActorRef, ActorSystem, Props, Status} import akka.event.Logging import akka.stream._ import akka.stream.scaladsl.{Flow, GraphDSL, Keep, MergePreferred, Sink, Source} import akka.util.Timeout import com.realizationtime.btdogg.BtDoggConfiguration.Mo...
Explain and rewrite the following Scala code:
object ch11_14 { ??? } import ch11_14._ /* from repl you can test typing: :load src/main/scala/fpinscala/ch11/Monad.scala :load src/main/scala/fpinscala/ch11/Exercise14.scala */
Explain and rewrite the following Scala code:
/** * Copyright 2014 Andrew Conway. All rights reserved */ package avoid1324 import java.util.HashMap import gnu.trove.map.hash.TLongLongHashMap import mod.ModularLongArithmetic /** * Count the number of permutations that can come from a given signature */ object ThreadedSignatureCounter { val maxenum = 8 ...
Explain and rewrite the following Scala code:
/* * Copyright 2016 Miroslav Janíček * * 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 com.twitter.finagle.memcached.util import collection.mutable.ArrayBuffer import com.google.common.base.Strings import com.twitter.io.Charsets import org.jboss.netty.buffer.{ChannelBuffer, ChannelBuffers, ChannelBufferIndexFinder} import scala.language.implicitConversions private[finagle] object ChannelBufferU...
Explain and rewrite the following Scala code:
package com.artclod.mathml import org.junit.runner.RunWith import org.specs2.runner.JUnitRunner import scala.xml._ import play.api.test._ import play.api.test.Helpers._ import org.specs2.mutable._ import com.artclod.mathml.scalar._ import com.artclod.mathml.scalar.apply._ import com.artclod.mathml.scalar.apply.{ Apply...
Explain and rewrite the following Scala code:
package com.github.tarao.nonempty package collection import eu.timepit.refined import scala.collection.immutable /** A value class for non-empty collections. * * It is intended to be used as a parameter type to restrict a * collection value to be non-empty. This restriction is guaranteed * statically, i.e., ...
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 com.cds.learnscala.test.tryTest import java.io.{FileNotFoundException, InputStream} import java.net.{MalformedURLException, URL} import scala.io.{Source, StdIn} import scala.util.{Failure, Success, Try} /** * http://udn.yyuap.com/doc/guides-to-scala-book/chp6-error-handling-with-try.html */ object TestTr...
Explain and rewrite the following Scala code:
package algebra object Instances { def t2HasSemigroup[A, B](implicit eva: Semigroup[A], evb: Semigroup[B]) = new Semigroup[(A, B)] { def combine(x: (A, B), y: (A, B)): (A, B) = (eva.combine(x._1, y._1), evb.combine(x._2, y._2)) } val stringHasMonoid = new Monoid[String] { def empt...
Explain and rewrite the following Scala code:
package controller import javafx.application.Platform import javafx.fxml.FXMLLoader import javafx.scene.control.Label import javafx.scene.layout.StackPane import javafx.scene.{Parent, Scene} import javafx.stage.Stage import scalafx.animation.AnimationTimer import me.mtrupkin.core.StateMachine /** * C...
Explain and rewrite the following Scala code:
package dk.umonitor.runtime.connector import dk.umonitor.runtime.Event import org.scalatest.FunSuite import org.scalatest.concurrent.Timeouts import org.scalatest.time.SpanSugar._ class TestPingConnector extends FunSuite with Timeouts { test("Ping IP") { val event = IcmpConnector.connect("name", "127.0.0.1") ...
Explain and rewrite the following Scala code:
package ch.epfl.yinyang package transformers import ch.epfl.yinyang._ import ch.epfl.yinyang.transformers._ import scala.reflect.macros.blackbox.Context import language.experimental.macros import scala.collection.mutable import scala.collection.mutable.ArrayBuffer /** * Converts captured variables to holes, which wi...
Explain and rewrite the following Scala code:
package auction_system.auction_search import akka.actor.{ActorRef, FSM} import auction_system.auction.Auction.AuctionEnded import scala.concurrent.duration._ sealed trait AuctionSearchState case object Active extends AuctionSearchState case object WithoutAuctions extends AuctionSearchState sealed trait AuctionSearch...
Explain and rewrite the following Scala code:
package chrome.sockets.tcp import chrome.events.EventSource import chrome.sockets.tcp.bindings._ import scala.concurrent.Future import scala.scalajs.concurrent.JSExecutionContext.Implicits.queue import scala.scalajs.js import scala.scalajs.js.typedarray.ArrayBuffer class Socket(val socketId: SocketId) { val onRec...
Explain and rewrite the following Scala code:
package com.shocktrade.models.contest import java.util.Date import com.shocktrade.util.DateUtil import org.joda.time.DateTime import play.api.libs.json.{Format, JsString, JsSuccess, JsValue} import reactivemongo.bson.{BSONHandler, BSONString} /** * Represents an enumeration of Order Terms * @author lawrence.daniel...
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 io.github.suzp1984.sort object SortUtils { implicit class ArrayUtils[A] (val array: Array[A]) { def printSelf(): Unit = { array.foreach { it => print(it + " ")} } } def arrayOf[T: Manifest](size: Int, op: => T): Array[T] = { val array = new Array[T](size) array.indices.foreach { ...
Explain and rewrite the following Scala code:
package com.cloudwick.generator.utils import java.text.SimpleDateFormat import java.util.Calendar import org.slf4j.LoggerFactory import scala.util.Random /** * Set of utilities used in generating data * @author ashrith */ class Utils { private val logger = LoggerFactory.getLogger(getClass) private val format...
Explain and rewrite the following Scala code:
package scala.test object ScalaLibResources { def getGreetings() = scala.io.Source.fromInputStream(getClass.getResourceAsStream("hellos")).getLines.toList }
Explain and rewrite the following Scala code:
package a06 object Runner { class Test1 { override def toString: String = "Test1" } class Test2 { override def toString: String = "Test2" } class Test3 { override def toString: String = "Test3" } class Test4 { override def toString: String = "Test4" } class Test5 { override def t...
Explain and rewrite the following Scala code:
package nicol.util object Base64 { private val encodeTable = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" def encode(fromBytes: Seq[Byte]): String = { val encoded = group6Bits(fromBytes) .map(x => encodeChar(binaryToDecimal(x))) .mkString encoded + "=" * ((4 - ...
Explain and rewrite the following Scala code:
/* * Copyright 2013 Akiyoshi Sugiki, University of Tsukuba * * 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 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:
/* * Copyright (c) 2014-2016 * nonblocking.at gmbh [http://www.nonblocking.at] * * This file is part of Cliwix. * * Cliwix 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...
Explain and rewrite the following Scala code:
package rescala.api import rescala.core.{CreationTicket, Engine, Struct} import rescala.meta._ import rescala.reactives.Signals import scala.language.higherKinds trait Api { type Signal[+A] type Event[+A] type Var[A] <: Signal[A] type Evt[A] <: Event[A] def Evt[A](): Evt[A] def Var[A](v: A): Var[A] ...
Explain and rewrite the following Scala code:
package sampler.empirical import sampler._ trait Empirical[A] { val observationCount: Int val probabilityTable: Map[A, Double] /** The proportion (0-1 range) of items in the Empirical which are greater than or equal to supplied value (inclusive) * * @param itemInclusive The value of interest, return...
Explain and rewrite the following Scala code:
/* * Copyright 2012-2016 Netflix, 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.dafttech.jasper.gl import org.lwjgl.opengl.GL11._ abstract class Pointer { def setup(stride: Int, offset: Int): Unit def stride(pointers: Seq[Pointer]): Int } object Pointer { def setup(pointers: Seq[Pointer], stride: Int): Unit = { pointers.foldLeft(0) { (last, e) => e.setup(stride, las...
Explain and rewrite the following Scala code:
package org.littlewings.javaee7.beanvalidation import javax.validation.constraints.{NotNull, Size} class Isono { @NotNull @Size(min = 1, max = 3) @Select(Array("カツオ", "ワカメ", "波平", "フネ")) var name: String = _ }
Explain and rewrite the following Scala code:
package org.geoscript.geocss package filter import org.opengis.filter.Filter import org.geotools.filter.text.ecql.ECQL import scala.collection.JavaConversions._ import org.scalatest.{ FunSuite, OptionValues } import org.scalatest.matchers.ShouldMatchers class FilterTest extends FunSuite with ShouldMatchers with Opti...
Explain and rewrite the following Scala code:
/** * The MIT License (MIT) * <p/> * Copyright (c) 2016 ScalateKids * <p/> * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the ...
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.criteo.dev.cluster.s3 import com.criteo.dev.cluster.Node import com.criteo.dev.cluster.copy.{CopyUtilities, CreateMetadataAction, TableInfo} import org.slf4j.LoggerFactory /** * Saves 'metadata' in S3. * * Effectively, its just a file that is written to S3 with a list of Hive DDL's * that any dev ...
Explain and rewrite the following Scala code:
package marg.lang.data trait SType { def name: String def get: Any def set(o: Any): Unit }
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 blended.mgmt.rest.internal import blended.akka.ActorSystemWatching import blended.akka.http.{HttpContext, SimpleHttpContext} import blended.mgmt.repo.WritableArtifactRepo import blended.persistence.PersistenceService import blended.security.BlendedPermissionManager import blended.util.logging.Logger import dom...
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 // // Unless required by ap...
Explain and rewrite the following Scala code:
package pl.edu.osp.lib import java.io.File import scala.io.Source object ConfigLoader { var sqlPassw = "" var sqlDB = "" var mongoDB = "" var emailAddr= "" var emailPassw = "" var emailPort = "" var emailSMTP = "" val f = new File("/etc/osp/config.cfg") val lines = Source.fromFile(f).getLines().toLi...
Explain and rewrite the following Scala code:
package com.mmakowski.maven.plugins.specs2 import java.io.File import java.net.{URL, URLClassLoader} import org.apache.maven.plugin.logging.Log import org.apache.maven.project.MavenProject import org.scalatools.testing.Result._ import org.scalatools.testing.{Event, EventHandler, Logger, Result} import scala.collecti...
Explain and rewrite the following Scala code:
package org.bitcoins.core.number import org.bitcoins.core.protocol.NetworkElement import org.bitcoins.core.util.{ BitcoinSUtil, Factory, NumberUtil } import scala.util.{ Failure, Success, Try } /** * Created by chris on 6/4/16. */ /** * This abstract class is meant to represent a signed and unsigned number in C ...
Explain and rewrite the following Scala code:
/* * * * Copyright 2014 websudos 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 * * * * Unless required...
Explain and rewrite the following Scala code:
package de.fosd.typechef.crefactor import gnu.getopt.{LongOpt, Getopt} import java.util import de.fosd.typechef.options.Options.OptionGroup import de.fosd.typechef.options.{FrontendOptionsWithConfigFiles, RefactorType, Options, FrontendOptions} class MorpheusOptions extends FrontendOptionsWithConfigFiles { privat...
Explain and rewrite the following Scala code:
package cli.printer import java.io.{ OutputStreamWriter, OutputStream } import core._ /** * Created by OpenDataFlow on 31/12/15. */ class PlainTextPrinter extends Printer { override def renderPipeline(p: Pipeline, o: OutputStream): Unit = { val w = new OutputStreamWriter(o) w.write(s"Pipeline: ${p.name}\...
Explain and rewrite the following Scala code:
package arx.core /** * Created by IntelliJ IDEA. * User: nvt * Date: 3/4/13 * Time: 4:23 PM * Created by nonvirtualthunk */ import graphics.data.Image object ResourceManager { def getImage ( str : String ) = Image.withDimensions(100,100) def image ( str : String ) = getImage(str) }
Explain and rewrite the following Scala code:
package se.citerus.dddsample.domain.model.handling import se.citerus.dddsample.domain.model.cargo.TrackingId; case class UnknownCargoException(val trackingId:TrackingId) extends Exception() { override def getMessage = "No cargo with tracking id " + trackingId.idString + " exists in the system" }
Explain and rewrite the following Scala code:
/* * Copyright 2013-2015 Websudos, Limited. * * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * - Redistributions of source code must retain the above copyright notice, * this list of c...
Explain and rewrite the following Scala code:
package services import java.util.Date import javax.inject.{Inject, Singleton} import db.{AccountDto, OrderDto} import models.frontend.FrontendOrder import models.{CruitedProduct, Edition, Order} import play.api.Logger import play.api.libs.json.JsNull import scala.concurrent.ExecutionContext.Implicits.global import ...
Explain and rewrite the following Scala code:
package arx.core.vec; import arx.core.Moddable import arx.core.SelfModdable @SerialVersionUID(9223372036854770000L) class ReadVec4f extends InternVec4f with SelfModdable[ReadVec4f]{ def this(ra : Float,ga : Float,ba : Float,aa : Float){ this() ri = ra gi = ga bi = ba ai = aa } def +(m : Moddable[ReadVec4f...
Explain and rewrite the following Scala code:
package is.hail.types import is.hail.asm4s._ import is.hail.expr.ir.streams.StreamArgType import is.hail.types.physical.stypes.{SCode, SValue} import scala.language.implicitConversions package object physical { def typeToTypeInfo(t: PType): TypeInfo[_] = t match { case _: PInt32 => typeInfo[Int] case _: PI...
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 fpinscala.state trait RNG { def nextInt: (Int, RNG) // Should generate a random `Int`. We will later define other functions in terms of `nextInt`. } object RNG { def simple(seed: Long): RNG = new RNG { def nextInt = { val seed2 = (seed*0x5DEECE66DL + 0xBL) & // `&` is bitwise AND ...
Explain and rewrite the following Scala code:
package com.heroku.sbt import sbt.Keys._ import sbt._ import scala.collection.JavaConversions object HerokuPlugin extends AutoPlugin { object autoImport { val deployHeroku = taskKey[Unit]("Deploy to Heroku.") val deployHerokuSlug = taskKey[Unit]("Deploy to Heroku.") val herokuJdkVersion = settingKey[...
Explain and rewrite the following Scala code:
package org.scalatra.sbt import java.util.regex.Pattern import _root_.sbt._ import Def.Initialize import Keys._ import Defaults._ import com.earldouglas.xwp.WebappPlugin.autoImport.webappPrepare object DistPlugin extends AutoPlugin { object DistKeys { val dist = taskKey[File]("Build a distribution, assemble t...
Explain and rewrite the following Scala code:
package modules import scaldi.Module import backend._ import logging.CorrelatedWS class BackendModule extends Module { binding to new CorrelatedWS binding to new ServiceFailover binding to new ConsulLookup binding to new CustomerBackend binding to new ProductBackend binding to new CartBackend binding to...
Explain and rewrite the following Scala code:
package es.upm.oeg.epnoi.matching.metrics.similarity import es.upm.oeg.epnoi.matching.metrics.corpus._ import es.upm.oeg.epnoi.matching.metrics.domain.entity.{TopicalResource, ConceptualResource} import es.upm.oeg.epnoi.matching.metrics.domain.space.{ConceptsSpace, TopicsSpace} import es.upm.oeg.epnoi.matching.metrics...
Explain and rewrite the following Scala code:
package model.db import com.outworkers.phantom.dsl._ import model.domain.{Attributes, Categories, Category, StoreProduct} import scala.concurrent.Future abstract class ProductsByCategory extends CassandraTable[ProductsByCategory, StoreProduct] with RootConnector { object category extends StringColumn(this) with P...
Explain and rewrite the following Scala code:
package connectorFamily.connector /** * Second attempt to create a connector class, * where the derivation tree for typed connectors is built. */ /** Connector definition */ sealed abstract class Conn { def &(other:Conn) = Seq(this,other) def *(other:Conn) = Par(this,other) } case class Seq(c1:Conn,c2:Conn) ex...
Explain and rewrite the following Scala code:
package com.softwaremill.mqperf import com.amazonaws.services.dynamodbv2.model.{AttributeValue, PutItemRequest} import scala.util.Random import java.text.SimpleDateFormat import java.util.Date import com.softwaremill.mqperf.util.Retry._ class ReportResults(testConfigName: String) extends DynamoResultsTable { def r...
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:
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may ...
Explain and rewrite the following Scala code:
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may ...
Explain and rewrite the following Scala code:
/** * Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com> */ package akka.event.japi import akka.util.Subclassification import akka.actor.ActorRef /** * Java API: See documentation for [[akka.event.EventBus]] * E is the Event type * S is the Subscriber type * C is the Classifier type */ trait Event...
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:
import scala.reflect.runtime.universe._ import scala.tools.reflect.Eval object Test extends App { reify { object C { object D { val x = 2 } } val outer = C val inner = outer.D println(inner.x) }.eval }
Explain and rewrite the following Scala code:
import java.io.File import de.sparrowlabs.CoffeeReactCompiler import org.scalatest.FunSpec import play.PlayExceptions.AssetCompilationException /** * Created by Jovo on 16/05/15. */ class CoffeeReactCompilerSpec extends FunSpec { describe("CoffeeReactCompiler") { it("should compile correct cjsx") { val ...
Explain and rewrite the following Scala code:
package pl.szymonmatejczyk.keccak trait Environment[V] { def get(v : V) : Boolean } class PublicAndSecretVariablesEnvironment(public : Array[Boolean], secret : Array[Boolean]) extends Environment[Either[Int, Int]] { override def get(v: Either[Int, Int]): Boolean = v match { case Left(i) => public(i) cas...