instruction
stringclasses
1 value
output
stringlengths
5
1M
Explain and rewrite the following Scala code:
package pew import java.awt._ import java.awt.image.BufferedImage import java.awt.image.BufferedImage.{ TYPE_INT_ARGB => ImageARGB } import java.util.{ ArrayList => Al } import java.util.{ List => L } import scala.IndexedSeq import scala.util.Random import javax.imageio.ImageIO import pew.Pew._ import pew._ import p...
Explain and rewrite the following Scala code:
package websocket4s.core import scala.collection.mutable /** * Created by namnguyen on 5/24/15. */ class WebSocketListeners extends Iterable[WebSocketListener]{ private val hashSet = new mutable.HashSet[WebSocketListener] def subscribe(listener: WebSocketListener):WebSocketSubscriber = { hashSet += listen...
Explain and rewrite the following Scala code:
//Example from https://github.com/spray/spray/blob/master/examples/spray-can/simple-http-client/src/main/scala/spray/examples/Main.scala //2014-06-20 Christoph Knabe package demo import scala.util.{Failure, Success} import akka.actor.ActorSystem import akka.event.Logging object ServerVersionDemoMain extends App wi...
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:
// Databricks notebook source // MAGIC %md // MAGIC ScaDaMaLe Course [site](https://lamastex.github.io/scalable-data-science/sds/3/x/) and [book](https://lamastex.github.io/ScaDaMaLe/index.html) // COMMAND ---------- // MAGIC %md // MAGIC # Structured Streaming using Scala DataFrames API - Exercise // MAGIC // MAGIC...
Explain and rewrite the following Scala code:
package models /** Bloque de tres imágenes para mostrar */ case class ImageBlock( first: String, second: String, third: String, fourth: String ) object ImageBlock { def apply(l: List[String]): ImageBlock = { require(l.size >= 4) ImageBlock( l(0), l(1), l(2), l(3) ) } }
Explain and rewrite the following Scala code:
/* ,i::, :;;;;;;; ;:,,::;. 1ft1;::;1tL t1;::;1, :;::; _____ __ ___ __ fCLff ;:: tfLLC / ___/ / |/ /____ _ _____ / /_ CLft11 :,, i1tffLi \\__ \\ ____ / /|_/ ...
Explain and rewrite the following Scala code:
package com.twitter.scrooge import com.twitter.util.Memoize import org.apache.thrift.protocol.TProtocol import scala.reflect.ClassTag /** * A trait encapsulating the logic for encoding and decoding a specific thrift struct * type. */ trait ThriftStructCodec[T <: ThriftStruct] { @throws(classOf[org.apache.thrift....
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 auth import io.flow.token.v0.interfaces.Client import io.flow.token.v0.models._ import lib.{Constants, FlowAuth, ResolvedToken} import scala.concurrent.{ExecutionContext, Future} /** * Queries token server to check if the specified token is a known * valid token. */ trait TokenAuth extends LoggingHelpe...
Explain and rewrite the following Scala code:
package ru.pravo.qa.gatling.remote import sbt._ import scala.concurrent.duration.Duration object GatlingRemoteKeys { val testOnlyRemote: InputKey[Unit] = inputKey("Assemble code -> Deploy bundle -> Run tests -> Retrieve logs -> Create report") val assembleProject: TaskKey[File] = taskKey("Assemble project") v...
Explain and rewrite the following Scala code:
/* * ____ ____ _____ ____ ___ ____ * | _ \\ | _ \\ | ____| / ___| / _/ / ___| Precog (R) * | |_) | | |_) | | _| | | | | /| | | _ Advanced Analytics Engine for NoSQL Data * | __/ | _ < | |___ | |___ |/ _| | | |_| | Copyright (C) 2010 - 2013 SlamData, In...
Explain and rewrite the following Scala code:
package org.sireum.pilarform.lexer import org.sireum.pilarform.lexer.Tokens._ import org.sireum.pilarform.util.Range /** * A token of Pilar source. * * @param text -- the text associated with the token after unicode escaping * @param rawText -- the text associated with the token before unicode escaping */ case c...
Explain and rewrite the following Scala code:
/* * Copyright (C) 2010 Lalit Pant <pant.lalit@gmail.com> * * The contents of this file are subject to the GNU General Public License * Version 3 (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.gnu.org/copyleft/gpl.html * *...
Explain and rewrite the following Scala code:
/** * Copyright 2012 Jeffrey Cameron * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to...
Explain and rewrite the following Scala code:
/* ___ ____ ___ __ ___ ___ ** / _// __// _ | / / / _ | / _ \\ Scala classfile decoder ** __\\ \\/ /__/ __ |/ /__/ __ |/ ___/ (c) 2003-2010, LAMP/EPFL ** /____/\\___/_/ |_/____/_/ |_/_/ http://scala-lang.org/ ** */ package scala.tools.scalap import java.io._ class JavaWriter(classfile: C...
Explain and rewrite the following Scala code:
package algorithms.GraphAlgorithms /** * problem description: http://rosalind.info/problems/scc/ */ object StronglyConnectedComponents { object SampleData { val sample: List[String] = List( "6 7", "4 1", "1 2", "2 4", "5 6", "3 2", "5 3", ...
Explain and rewrite the following Scala code:
package test.codesniffer.codefunnel import java.io.{File, FileInputStream} import java.lang.reflect.Modifier import codesniffer.codefunnel.utils.DirTravel import net.liftweb.json.{DefaultFormats, JsonAST, Printer} /** * Created by Bowen Cai on 2/24/2016. */ object DirTravelTest { def main(args:...
Explain and rewrite the following Scala code:
package compact_enumeration import compact_enumeration.FieldOps._ /** * @author gadgil * * Elementary functions of type A (e.g. A = Real => Real). * this is not quite correct for multi-variable functions. */ trait ElementaryFunctions[A] { val sin: A val cos: A val log: A val exp: A val sqrt: A ...
Explain and rewrite the following Scala code:
/* * Copyright 2012 Twitter Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agree...
Explain and rewrite the following Scala code:
/* * Copyright 2017 Mediative * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in...
Explain and rewrite the following Scala code:
package com.eigengo.lift.notification import akka.actor.{ActorRef, ActorSystem} import com.eigengo.lift.common.MicroserviceApp.BootedNode case class NotificationBoot(notification: ActorRef) extends BootedNode object NotificationBoot { def boot(implicit system: ActorSystem): NotificationBoot = { val notificati...
Explain and rewrite the following Scala code:
package com.codingkapoor.codingbat import org.scalatest.{FlatSpec, Matchers} class LogicIISpec extends FlatSpec with Matchers { """We want to make a row of bricks that is "goal" inches long. We have a number of small bricks (1 inch each) and big bricks (5 inches each). Method "makeBricks"""" should """return true ...
Explain and rewrite the following Scala code:
package hu.gansperger.neptunapi.requests import com.ning.http.client.Response import dispatch.{as, Http, Future} import hu.gansperger.neptunapi.Session import hu.gansperger.neptunapi.constants.{Message, Payload, URL} import scala.concurrent.ExecutionContext.Implicits.global class MessageRequest(id : Int)( ...
Explain and rewrite the following Scala code:
package im.tox.antox.activities import java.io.{File, FileNotFoundException, FileOutputStream, IOException} import android.app.AlertDialog import android.content.{Context, DialogInterface, Intent, SharedPreferences} import android.graphics.{Bitmap, BitmapFactory} import android.net.Uri import android.os.{Build, Bundl...
Explain and rewrite the following Scala code:
/** * ***************************************************************************** * Copyright (c) 2014 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:
/* * 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 fr.ramiro.scala.growl import java.net.{ InetAddress, Socket } import java.nio.charset.{ Charset, StandardCharsets } import java.util.Scanner import Encryption.EncryptionType import MessageHeader._ import scala.concurrent.{ ExecutionContext, Future } object Message { val SOFTWARE_NAME = "scala-growl" val...
Explain and rewrite the following Scala code:
package monocle.internal.focus.features.index import monocle.function.Index import monocle.internal.focus.FocusBase private[focus] trait IndexGenerator { this: FocusBase => import macroContext.reflect._ def generateIndex(action: FocusAction.KeywordIndex): Term = { import action.{fromType, toType, index, i...
Explain and rewrite the following Scala code:
/*********************************************************************** * Copyright (c) 2013-2018 Commonwealth Computer Research, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Apache License, Version 2.0 * which accompanies this distribution and...
Explain and rewrite the following Scala code:
/** * Copyright 2015, deepsense.io * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed ...
Explain and rewrite the following Scala code:
//package leo.agents // //import leo.datastructures.blackboard.{ActiveTracker, DataType, Event} // ///** // * <p> // * A state driven agent orients itself more on a classical loop, // * than on the filter based mechanism of the [[FifoController]] // * and [[PriorityController]]. The selection is based on an existing //...
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 = "beforeparser" val description = "Declares one plugin that wants to be before the par...
Explain and rewrite the following Scala code:
trait Logger { def log(msg: String) // This method is abstract } trait TimestampLogger extends Logger { abstract override def log(msg: String) { super.log(new java.util.Date() + " " + msg) } } trait ConsoleLogger extends Logger { override def log(msg: String) { println(msg) } } class Account { protecte...
Explain and rewrite the following Scala code:
package com.sksamuel.elastic4s import com.sksamuel.elastic4s.ElasticDsl._ import com.sksamuel.elastic4s.anaylzers.KeywordAnalyzer import com.sksamuel.elastic4s.mappings.FieldType.StringType import org.elasticsearch.search.aggregations.bucket.missing.InternalMissing import org.elasticsearch.search.aggregations.bucket.r...
Explain and rewrite the following Scala code:
package com.typesafe.sbt import packager._ import debian.DebianPlugin.autoImport.genChanges import universal.UniversalPlugin.autoImport.{packageXzTarball, packageZipTarball} import sbt._ import sbt.Keys.{name, normalizedName, packageBin} /** * == SBT Native Packager Plugin == * * This is the top level plugin f...
Explain and rewrite the following Scala code:
package spark.storage import java.io._ import java.util.{HashMap => JHashMap} import scala.collection.mutable.{ArrayBuffer, HashMap, HashSet} import scala.util.Random import akka.actor._ import akka.dispatch._ import akka.pattern.ask import akka.remote._ import akka.util.{Duration, Timeout} import akka.util.duration...
Explain and rewrite the following Scala code:
package dao.sitedata import slick.lifted.TableQuery import scala.concurrent.Future /** * Defines base dao structure every dao should have. */ trait BaseDao2[T <: Any] { def toTable(): TableQuery[_] def findAll(): Future[Seq[T]] def remove(id: String): Future[Int] def insert(o: T): Future[Unit] def update(...
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-2020 by The Monix Project Developers. * See the project homepage at: https://monix.io * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache...
Explain and rewrite the following Scala code:
package lila.coach case class Ecopening( eco: Ecopening.ECO, family: Ecopening.FamilyName, name: String, moves: String, fen: Ecopening.FEN, lastMoveUci: String) { lazy val moveList = moves.split(' ').toList def firstMove = moveList.headOption lazy val size = moveList.size lazy val f...
Explain and rewrite the following Scala code:
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: /** @author John Miller * @version 1.2 * @date Mon Nov 11 19:03:45 EST 2013 * @see LICENSE (MIT style license file). */ package scalation.graphalytics import collection.immutable.{Set => SET} import collection.mutable.{Arra...
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 info.glennengstrand.io import org.slf4j.Logger; import org.slf4j.LoggerFactory; import info.glennengstrand.io._ import java.sql.{SQLException, ResultSet, PreparedStatement, Connection} import scala.collection.mutable /** helper functions for generating postgesql statements */ object PostgreSql { val log =...
Explain and rewrite the following Scala code:
package epic.logo import breeze.math.MutableInnerProductModule case class LossAugmentedMaxMarginDecoder[T, W, OracleS, ArgmaxerS]( oracleInferencer: OracleInferencer[T, W, OracleS], argmaxer: LossAugmentedArgmaxInferencer[T, W, ArgmaxerS])(implicit space: MutableInnerProductModule[W, Double]) extends Deco...
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.gxq.learn.recontool.entity case class ReconToolTSchema(keys: Array[String], schemas: Map[String, String], thresholds: Map[String, String])
Explain and rewrite the following Scala code:
package com.gilt.gfc.kinesis.publisher import com.gilt.gfc.kinesis.common.{SequenceNumber, ShardId} case class PutResult(shardId: ShardId, sequenceNumber: SequenceNumber, attemptCount: Int)
Explain and rewrite the following Scala code:
package artisanal.pickle.maker import models._ import parser._ import org.specs2._ import mutable._ import specification._ import scala.reflect.internal.pickling.ByteCodecs import scala.tools.scalap.scalax.rules.scalasig._ import com.novus.salat.annotations.util._ import scala.reflect.ScalaSignature class StringSt...
Explain and rewrite the following Scala code:
package au.edu.uq.html2docx import org.scalatra._ import scalate.ScalateSupport import org.fusesource.scalate.{ TemplateEngine, Binding } import org.fusesource.scalate.layout.DefaultLayoutStrategy import javax.servlet.http.HttpServletRequest import collection.mutable trait Html2docxDemoStack extends ScalatraServlet w...
Explain and rewrite the following Scala code:
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you ...
Explain and rewrite the following Scala code:
package com.socrata.util.concurrent sealed abstract class FutureException(msg: String = null, cause: Throwable = null) extends RuntimeException(msg, cause) case class ExecutionException(msg: String, cause: Throwable) extends FutureException(msg, cause) case class CancellationException(msg: String) extends FutureExcep...
Explain and rewrite the following Scala code:
package pl.jozwik.demo object Demo { def add(a:Int,b:Int) = a + b }
Explain and rewrite the following Scala code:
package com.enkidu.lignum.parsers.ast.expression.discardable.binary import com.enkidu.lignum.parsers.ast.expression.Expression import com.enkidu.lignum.parsers.ast.expression.discardable.DiscardableExpression import com.enkidu.lignum.parsers.ast.expression.types.templates.TemplateArgument case class MethodInvocation(...
Explain and rewrite the following Scala code:
package net.usersource.vbad.model import net.liftweb.mapper.{MappedString, LongKeyedMetaMapper, LongKeyedMapper, IdPK} object Site extends Site with LongKeyedMetaMapper[Site] class Site extends LongKeyedMapper[Site] with IdPK { def getSingleton = Site object name extends MappedString(this, 32) { override d...
Explain and rewrite the following Scala code:
/* This file is part of Intake24. Copyright 2015, 2016 Newcastle University. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by appl...
Explain and rewrite the following Scala code:
/* * (C) Copyright IBM Corp. 2015 * * 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 services import com.google.inject.Inject import com.mongodb.client.result.UpdateResult import daos.InstitutionalDataDao import models.InstitutionalData import org.mongodb.scala.Completed import scala.concurrent.Future class InstitutionalDataService @Inject()(dao: InstitutionalDataDao){ def all(): Future[S...
Explain and rewrite the following Scala code:
package nounou.elements import java.io.File import java.nio.charset.StandardCharsets import java.nio.file.Files import nounou.elements.layouts.NNDataLayoutHexagonal import nounou.util.LoggingExt /** Base class for all data elements. */ abstract class NNElement extends LoggingExt { //ToDo3: consider add: pt info,...
Explain and rewrite the following Scala code:
package scalapb import com.google.protobuf.field_mask.FieldMask import org.scalatest.flatspec.AnyFlatSpec import org.scalatest.matchers.must.Matchers import protobuf_unittest.unittest.{NestedTestAllTypes, TestAllTypes} class FieldMaskUtilsSpec extends AnyFlatSpec with Matchers { // https://github.com/protocolbuffe...
Explain and rewrite the following Scala code:
package com.datastax.spark.connector.types import java.net.InetAddress import java.nio.ByteBuffer import java.util.{UUID, Date} import com.datastax.driver.core.{TupleType => DriverTupleType, UserType => DriverUserType, ProtocolVersion, DataType} import com.datastax.spark.connector.util.Symbols import scala.collectio...
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 ml.sparkling.graph.operators.partitioning import ml.sparkling.graph.loaders.csv.CSVLoader import ml.sparkling.graph.operators.MeasureTest import ml.sparkling.graph.operators.algorithms.community.pscan.PSCAN import org.apache.spark.SparkContext import org.apache.spark.graphx.Graph import ml.sparkling.graph.oper...
Explain and rewrite the following Scala code:
package fr.unice.polytech.ogl.championships import eu.ace_design.island.dsl.DiSLand import eu.ace_design.island.game._ import eu.ace_design.island.map.IslandMap import eu.ace_design.island.map.resources.Resource import eu.ace_design.island.stdlib.POIGenerators.WithCreeks import eu.ace_design.island.stdlib.Resources.W...
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 net.rrm.ehour.domain import org.scalatest.{Matchers, BeforeAndAfter, FunSuite} import org.junit.runner.RunWith import org.scalatest.junit.JUnitRunner import scala.collection.mutable import java.util @RunWith(classOf[JUnitRunner]) class ProjectAssignmentTest extends FunSuite with Matchers with BeforeAndAfter {...
Explain and rewrite the following Scala code:
object Foo { def isGood(x: Int): Boolean = { x % 2 == 0 } } object ArrayUtils { def filter(xs: Array[Int], pred: Function1[Int,Boolean]): Array[Int] = ??? } trait Function1[T, R] { def apply(x: T): R }
Explain and rewrite the following Scala code:
package com.azavea.opentransit.indicators import com.azavea.gtfs._ import geotrellis.vector._ import geotrellis.slick._ import spray.json._ object OverallIndicatorResult { def apply(indicatorId: String, value: Double): OverallIndicatorResult = new OverallIndicatorResult(indicatorId, value) def createContai...
Explain and rewrite the following Scala code:
package me.eax.examples.plivo.sms import akka.actor._ import akka.stream._ import akka.http.scaladsl._ import akka.http.scaladsl.model._ import org.json4s._ import org.json4s.jackson.JsonMethods._ import scala.concurrent._ import scala.concurrent.duration._ import scala.concurrent.ExecutionContext.Implicits.global o...
Explain and rewrite the following Scala code:
package org.jetbrains.plugins.scala package lang package resolve import com.intellij.openapi.progress.ProgressManager import com.intellij.psi._ import com.intellij.psi.util.PsiTreeUtil import org.jetbrains.plugins.scala.caches.CachesUtil import org.jetbrains.plugins.scala.extensions._ import org.jetbrains.plugins.scal...
Explain and rewrite the following Scala code:
package com.evojam.mongodb.client.model.result import scala.collection.JavaConversions._ import scala.language.implicitConversions import com.mongodb.bulk.{BulkWriteUpsert, BulkWriteResult => MongoBulkWriteResult} case class BulkWriteResult( acknowledged: Boolean, insertedCount: Option[Int], matchedCount: Opti...
Explain and rewrite the following Scala code:
/* Copyright (c) 2016, Elliot Stirling 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 conditions and th...
Explain and rewrite the following Scala code:
/* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distribute...
Explain and rewrite the following Scala code:
package org.hibernate.cache.rediscala.tests.hibernate import org.hibernate.SessionFactory import org.hibernate.cache.rediscala.tests.HibernateRedisConfiguration import org.hibernate.cache.rediscala.tests.domain.{Person, Account, Item} import org.hibernate.cache.rediscala.utils.HibernateRedisUtil import org.hibernate.s...
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 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 ...
Explain and rewrite the following Scala code:
/** * Copyright 2011-2016 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:
package com.bitunified.cd.websocket import javax.websocket._ import javax.websocket.server.ServerEndpoint import com.bitunified.cb.datastoremanager.DSManager import com.google.gson.Gson //@ServerEndpoint("/socketconfig.io") class ConfigurationWebSocketServer { // val dsManager :DSManager =DSManager // @OnOpen // ...
Explain and rewrite the following Scala code:
package com.nabijaczleweli.minecrasmer.render.gui import com.nabijaczleweli.minecrasmer.container.ContainerAdditionalCPU import com.nabijaczleweli.minecrasmer.entity.tile.TileEntityAdditionalCPU import net.minecraft.entity.player.EntityPlayer import net.minecraft.util.BlockPos import net.minecraft.world.World import n...
Explain and rewrite the following Scala code:
package beam.utils.csv.conversion import java.io.{File, PrintWriter} object PhyssimEventsXmlToCSV { def main(args: Array[String]): Unit = { assert(args.length == 3) val pathToXml = args(0) val delimiter = args(1) val csvOutputPath = args(2) println(s"pathToXml: $pathToXml") println(s"delim...
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 ghpages import org.scalajs.dom import scala.scalajs.js.JSApp import scala.scalajs.js.annotation.JSExport import japgolly.scalajs.react._, vdom.prefix_<^._, ScalazReact._ import japgolly.scalajs.react.extra._ import japgolly.scalajs.react.extra.router2._ import pages._ object GhPages extends JSApp { sealed ...
Explain and rewrite the following Scala code:
package net.liftmodules.staticsitemap.path import net.liftweb.sitemap.{NormalLocPath, LocPath, *} import net.liftmodules.staticsitemap.path.PathUtils._ case class PathParts(parts: NormalPathPart*) { def / (part: String): PathParts = PathParts(parts :+ NormalPathPart(part): _*) def / (partOpt: Option[String]): Pat...
Explain and rewrite the following Scala code:
package acme class AcmeRefTest { def baz = "3" }
Explain and rewrite the following Scala code:
/* * Copyright (C) 2015 DANS - Data Archiving and Networked Services (info@dans.knaw.nl) * * 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 scalax.collection.generator.parameters import scala.util.Random abstract class RandomRange(min: Int, max: Int, uniform: Boolean) { require(min <= max) val span = max - min + 1 val halfSpan = span.toFloat / 2 def mean = min + (span - 1).toFloat / 2 private val r, sign = n...
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 util /** * Created by diego on 11/24/14. * * Each csv file must have a header; the names in the schema match the column names listed in the header */ import org.apache.spark.sql._ object Files { /* * an example of a formatter function; it takes a string from the csv file, and it returns the corespo...
Explain and rewrite the following Scala code:
package fpinscala.datastructures sealed trait List[+A] // `List` data type, parameterized on a type, `A` case object Nil extends List[Nothing] // A `List` data constructor representing the empty list case class Cons[+A](head: A, tail: List[A]) extends List[A] // Another data constructor, representing nonempty lists. N...
Explain and rewrite the following Scala code:
package org.jetbrains.plugins.scala package lang package parser import org.jetbrains.plugins.scala.lang.parser.parsing.builder.ScalaPsiBuilder /** * Manages the indentation in a block. * * Even a block has an indentation width, which is important * if indentation style is used inside of a block. * * object Test...
Explain and rewrite the following Scala code:
package com.cterm2.miniflags // World renderer import cpw.mods.fml.common.eventhandler._ import net.minecraftforge.client.event._ import net.minecraftforge.event.world._ import net.minecraft.world.WorldServer import net.minecraft.client.multiplayer.WorldClient import net.minecraft.client.Minecraft import net.minecraft...
Explain and rewrite the following Scala code:
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may ...
Explain and rewrite the following Scala code:
/* * Copyright 2017 Datamountaineer. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to...
Explain and rewrite the following Scala code:
/* * Copyright 2015 2lemetry, 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...
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.iohk.ethereum import akka.actor.ActorSystem import akka.testkit.TestKit import org.scalatest.{BeforeAndAfterAll, Suite} trait WithActorSystemShutDown extends BeforeAndAfterAll { this: Suite => implicit val system: ActorSystem override def afterAll: Unit = { TestKit.shutdownActorSystem(system, veri...
Explain and rewrite the following Scala code:
package model.ifthen import model.sensor._ import mqtt.listener.SensorMeasurementsListener /** * Class responsible for execution of if-thens based on mqtt messages */ class SensorMeasurementsIfThenExecutor(ifThens: Seq[IfThen]) extends SensorMeasurementsListener { override def messageReceived( ...
Explain and rewrite the following Scala code:
package org.genivi.sota.resolver.test.generators import eu.timepit.refined.api.Refined import org.genivi.sota.data.{InvalidIdentGenerators, Namespaces, SemanticVin} import org.genivi.sota.resolver.components.Component import org.genivi.sota.resolver.db.Package import org.genivi.sota.resolver.filters.FilterAST._ import...
Explain and rewrite the following Scala code:
package benchmark_generic import scala.annotation.tailrec import scala.reflect.ClassTag import scala.util.Random import Random._ import com.google.caliper.Runner import com.google.caliper.SimpleBenchmark import com.google.caliper.Param import macroG._ //ARRAY ORDER BENCHMARK GENERIC object ArrayOrderBenchmarks ...
Explain and rewrite the following Scala code:
package torture import scala.collection.mutable.ArrayBuffer import Rand._ class SeqVOnly(xregs: HWRegPool, fregs_s: HWRegPool, fregs_d: HWRegPool) extends VFInstSeq { override val seqname = "vonly" def seq_xdest(op: Opcode) = () => { val dest = reg_write_visible(xregs) // Verifiy visible is appropriate for ...