instruction
stringclasses
1 value
output
stringlengths
5
1M
Explain and rewrite the following Scala code:
/* * Copyright 2011-2021 GatlingCorp (https://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:
/* * ____ ____ _____ ____ ___ ____ * | _ \\ | _ \\ | ____| / ___| / _/ / ___| Precog (R) * | |_) | | |_) | | _| | | | | /| | | _ Advanced Analytics Engine for NoSQL Data * | __/ | _ < | |___ | |___ |/ _| | | |_| | Copyright (C) 2010 - 2013 SlamData, In...
Explain and rewrite the following Scala code:
package at.fh.swengb.resifoAndroid.activities.meldezettelEdit import android.content.{DialogInterface, Intent} import android.graphics.{Color, PorterDuff} import android.os.Bundle import android.support.v7.app.{AlertDialog, AppCompatActivity} import android.view.View import android.view.View.OnClickListener import and...
Explain and rewrite the following Scala code:
/* * Copyright 2013 Julian Peeters * * 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:
package new_file import scala.util.Random object Headers { def randomString(length: Int) = { val r = new scala.util.Random val sb = new StringBuilder for (i <- 1 to length) { sb.append(r.nextPrintableChar) } sb.toString } def getRandomAlphaNumeric(length: Int) = { val sb = new String...
Explain and rewrite the following Scala code:
package org.jetbrains.plugins.scala package annotator import com.intellij.codeInsight.intention.IntentionAction import com.intellij.codeInspection.ProblemHighlightType import com.intellij.lang.annotation.{Annotation, AnnotationHolder} import com.intellij.openapi.util.TextRange import com.intellij.psi.PsiElement import...
Explain and rewrite the following Scala code:
package modules import com.google.inject.AbstractModule import models._ import net.codingwell.scalaguice._ /** * Created by skypage on 6/16/16. */ class MainModule extends AbstractModule with ScalaModule { def configure() = { } }
Explain and rewrite the following Scala code:
package models.plan import models._ import utils._ case class Knitted private(mainBed: KnittedBed, doubleBed: KnittedBed) { def height = mainBed.height def width = mainBed.width def +(mainBedRow: Needle => Stitch, doubleBedRow: Needle => Stitch) = new Knitted(mainBed + mainBedRow, doubleBed + doubleBedRow)...
Explain and rewrite the following Scala code:
/* * Copyright 2014 Cisco Systems, 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:
/* * 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) 2016, Rice University Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2....
Explain and rewrite the following Scala code:
/* * Copyright (C) 2011 Mathias Doenitz * 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.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of ...
Explain and rewrite the following Scala code:
package com.sfxcode.sapphire.extension.filter import javafx.scene.Node import javafx.scene.layout.Pane import com.sfxcode.sapphire.core.value.FXBean import com.sfxcode.sapphire.extension.filter.FilterType._ import com.typesafe.config.{ Config, ConfigFactory } import com.typesafe.scalalogging.LazyLogging import org.con...
Explain and rewrite the following Scala code:
package epfl trait RichIterator extends AbsIterator { def foreach(f: T => Unit): Unit = while (hasNext) f(next) }
Explain and rewrite the following Scala code:
package mqfiletransferagent.actors import akka.actor.Actor import akka.camel.CamelExtension import scala.collection.mutable.Map import mqfiletransferagent.messages.AddProducer import mqfiletransferagent.messages.RemoveProducer import mqfiletransferagent.messages.CommandMessage import akka.event.LoggingReceive import a...
Explain and rewrite the following Scala code:
/* * Copyright (C) 2005, The OpenURP Software. * * 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 3 of the License, or * (at your option) any later version. * * This...
Explain and rewrite the following Scala code:
package com.twitter.finagle.netty4.channel import com.twitter.finagle.Stack.Params import com.twitter.finagle.param.Stats import com.twitter.finagle.stats.InMemoryStatsReceiver import com.twitter.finagle.transport.Transport import com.twitter.util.Duration import io.netty.buffer.Unpooled import io.netty.channel._ impo...
Explain and rewrite the following Scala code:
package mesosphere.marathon.core.task.tracker.impl import mesosphere.marathon.core.task.tracker.TaskTracker import mesosphere.marathon.state.TaskRepository import org.slf4j.LoggerFactory import scala.concurrent.Future /** * Loads all task data into an [[TaskTracker.TasksByApp]] from a [[TaskRepository]]. */ priv...
Explain and rewrite the following Scala code:
package io.github.suitougreentea.VariousMinos.editor import io.github.suitougreentea.VariousMinos.stagefile.StageFileBombContest import io.github.suitougreentea.VariousMinos.stagefile.BombContestStage import org.newdawn.slick.Input import org.newdawn.slick.Graphics import org.newdawn.slick.Color import io.github.suito...
Explain and rewrite the following Scala code:
package com.ponkotuy.data import org.json4s._ import com.ponkotuy.tool.Pretty import scala.util.Try /** * * @param id : ユーザ毎にUniqueなID? nullable * @param slotitemId : 装備MasterのID? nullable * @author ponkotuy * Date; 14/03/05. */ case class CreateItem( id: Option[Int], slotitemId: Option[Int], fuel: Int,...
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. ...
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-2017 Lightbend Inc. <https://www.lightbend.com> */ package play.api import play.core.{ DefaultWebCommands, SourceMapper, WebCommands } import play.utils.Reflect import play.api.inject.{ DefaultApplicationLifecycle, Injector, NewInstanceInjector, SimpleInjector } import play.api.mvc.{ Controll...
Explain and rewrite the following Scala code:
object Test1 { val day: Day = ??? day match { case Day.MONDAY => true case Day.TUESDAY => true case Day.WEDNESDAY => true } } object Test2 { import Day._ val day: Day = ??? day match { case MONDAY => true case TUESDAY => true case WEDNESDAY => true case SUNDAY => true } }
Explain and rewrite the following Scala code:
package helper import play.Configuration /** * Created by pdeboer on 20/11/15. */ class QuestionHTMLFormatter(val html: String, val assetPrefix: String = Configuration.root().getString("url.prefix")) { def format = html.replaceAll("asset://", assetPrefix + "/assetsBallot/") }
Explain and rewrite the following Scala code:
/* * Copyright 2013 David Savage * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to...
Explain and rewrite the following Scala code:
package com.github.j5ik2o.spetstore.domain.purchase import java.util.UUID import com.github.j5ik2o.spetstore.infrastructure.domainsupport.EntityId /** * [[Order]]のための識別子。 * * @param value 識別子の値 */ case class OrderId(value: UUID = UUID.randomUUID()) extends EntityId
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 sp.erica import sp.domain._ import sp.domain.Logic._ import scala.util._ import scala.util.Try import com.github.nscala_time.time.Imports._ // Internally object API_Data { case class ElvisPatient(CareContactId: Int, CareContactRegistrationTime: String, De...
Explain and rewrite the following Scala code:
package com.automatatutor.model import net.liftweb.common.Box import net.liftweb.common.Empty import net.liftweb.common.Failure import net.liftweb.common.Full import net.liftweb.mapper._ import net.liftweb.util.SecurityHelpers class Course extends LongKeyedMapper[Course] with IdPK { def getSingleton = Course prote...
Explain and rewrite the following Scala code:
package views.html import play.twirl.api._ import play.twirl.api.TemplateMagic._ import play.api.templates.PlayMagic._ import models._ import controllers._ import play.api.i18n._ import play.api.mvc._ import play.api.data._ import views.html._ /**/ object main extends BaseScalaTemplate[play.twirl.api.HtmlFormat.App...
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 simulations import org.scalatest.FunSuite import org.junit.runner.RunWith import org.scalatest.junit.JUnitRunner @RunWith(classOf[JUnitRunner]) class CircuitSuite extends CircuitSimulator with FunSuite { val InverterDelay = 1 val AndGateDelay = 3 val OrGateDelay = 5 test("andGate example") { v...
Explain and rewrite the following Scala code:
package org.apache.solr.handler.tesserae.metrics import com.codahale.metrics.{MetricFilter, JmxReporter, MetricRegistry} import com.codahale.metrics.graphite.{GraphiteReporter, Graphite} import MetricRegistry.name import java.net.InetSocketAddress import java.util.concurrent.TimeUnit object CommonMetrics { lazy val...
Explain and rewrite the following Scala code:
package controllers import javax.inject._ import play.api._ import play.api.mvc._ import org.apache.commons.lang.StringUtils @Singleton class Application @Inject() extends InjectedController { def index = Action { Ok(views.html.index(StringUtils.trim(" Your new application is ready. "))) } }
Explain and rewrite the following Scala code:
/** * Copyright 2015 Mohiva Organisation (license at mohiva dot 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 req...
Explain and rewrite the following Scala code:
/* * Copyright 2015 The SIRIS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applica...
Explain and rewrite the following Scala code:
// // Copyright 2013, Martin Pokorny <martin@truffulatree.org> // // This Source Code Form is subject to the terms of the Mozilla Public License, // v. 2.0. If a copy of the MPL was not distributed with this file, You can // obtain one at http://mozilla.org/MPL/2.0/. // package org.truffulatree.scampi2 class Ch7Spec e...
Explain and rewrite the following Scala code:
package com.p44.db.whales import com.mongodb.MongoURI import com.mongodb.casbah.Imports._ /** * Created by markwilson on 8/19/14. * * This is for comparison load testing. * Originally intended to hit the separate load testing databases for load test comparisons */ object CasbahDb { val HOSTS_CONNECTION = Mong...
Explain and rewrite the following Scala code:
package org.scalatra package validation import org.scalatra.commands.FieldValidation import scala.util.matching.Regex object Validation { def nonEmptyString(fieldName: String, value: ⇒ String, messageFormat: String = "%s is required."): FieldValidation[String] = Validators.nonEmptyString(fieldName, messageFor...
Explain and rewrite the following Scala code:
/* sbt -- Simple Build Tool * Copyright 2008, 2009, 2010, 2011 Mark Harrah, Indrajit Raychaudhuri */ package sbt import java.io.{ File, PrintWriter } import compiler.{ AnalyzingCompiler, JavaCompiler } import Predef.{ conforms => _, _ } import sbt.internal.util.Types.:+: import sbt.io.Path._ import sbt.io.IO impo...
Explain and rewrite the following Scala code:
package com.hadooparchitecturebook.taxi360.setup.hbase import java.io.File import org.apache.commons.lang.StringUtils import org.apache.hadoop.hbase.{HBaseConfiguration, HColumnDescriptor, HTableDescriptor, TableName} import org.apache.hadoop.hbase.client.ConnectionFactory import org.apache.hadoop.hbase.io.compress.C...
Explain and rewrite the following Scala code:
package Tutorial import Chisel._ import Node._ import Literal._ import scala.collection.mutable.HashMap import scala.collection.mutable.ArrayBuffer class cache (extCompName:String) extends gComponentLeaf (() => new mem_req_t)(() => new mem_rep_t) (ArrayBuffer(("cacheMissPipe", () => UFix(width = 32) , () => UFix(wi...
Explain and rewrite the following Scala code:
package breeze.linalg.support import breeze.linalg.{QuasiTensor, argsort} /** * TODO * * @author dlwh **/ private[linalg] trait LowPriorityArgSort { implicit def argsortQuasiTensorWithOrdering[Q,I,V](implicit ord: Ordering[V], qt: Q<:<QuasiTensor[I, V]) :argsort.Impl[Q, IndexedSeq[I]] = { new argsort.Impl[Q...
Explain and rewrite the following Scala code:
// GENERATED CAP'N PROTO FILE, DO NOT EDIT package org.katis.capnproto.compiler import org.katis.capnproto.runtime.implicits._ object contents { // START Contents implicits implicit val Contents$$HasTypeId = new org.katis.capnproto.runtime.HasTypeId[Contents] { def typeId: Long = -3160189064124843233L } i...
Explain and rewrite the following Scala code:
/* Copyright 2012 - 2015 pac4j organization 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:
// scalac: -Werror -Xlint:byname-implicit import language._ class C { implicit def `ints are strs`(n: => Int): String = n.toString implicit def `bools are strs`[A](b: => A)(implicit ev: A => Boolean): String = if (b) "yup" else "nah" def show(s: String) = println(s"[$s]") def f(): Unit = show { pr...
Explain and rewrite the following Scala code:
package com.twitter.scrooge.backend /** * Copyright 2011 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 requ...
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:
class Outer extends App { val y: Int = 1 abstract class C { val x: Int } val foo = new C { class I { val z = y } val x = (new I).z } } object Test extends App { val o = new Outer println(o.foo.x) }
Explain and rewrite the following Scala code:
// Copyright 2012 Twitter, Inc. // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // Unless required by applicable law or agreed to in writing,...
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 edu.osu.cse.groenkeb.logic.proof.engine.learn import edu.osu.cse.groenkeb.logic._ import scala.collection.Seq sealed abstract class GraphNode final case class QuantifierNode(sentence: QuantifiedSentence) extends GraphNode { override def toString = sentence.toString() } final case class BinaryNode(sentence: ...
Explain and rewrite the following Scala code:
package com.ponkotuy.restype import com.ponkotuy.http.MFGHttp import com.ponkotuy.parser.Query import com.ponkotuy.restype.ShipSWF.allRead import scala.util.Try import scala.util.matching.Regex /** * @author ponkotuy * DAte: 15/04/12. */ case object SoundMP3 extends ResType { override def regexp: Regex = """\A/...
Explain and rewrite the following Scala code:
/* * Copyright (C) 2012 The Regents of The University California. * All rights reserved. * * 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/LICENS...
Explain and rewrite the following Scala code:
package dump import java.io.FileWriter import dispatch._ import scala.language.postfixOps import scala.xml._ import scala.concurrent.ExecutionContext.Implicits.global object XMLDumpCreator { val emptyDumpXml = <mediawiki xml:lang="en" version="0.10" xsi:schemaLocation="http://www.mediawiki.org/xml/export-0.10...
Explain and rewrite the following Scala code:
/* * Copyright 2021 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:
/*********************************************************************** * 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:
/* Copyright (C) 2008-2014 University of Massachusetts Amherst. This file is part of "FACTORIE" (Factor graphs, Imperative, Extensible) http://factorie.cs.umass.edu, http://github.com/factorie Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with...
Explain and rewrite the following Scala code:
package poker.core.handanalyzer import org.scalatest.FunSuite import poker.TestHelpers._ import poker.core.HandStatus import poker.core.HandType.StraightFlush final class StraightFlushAnalyzerTest extends FunSuite { test("analyze") { val analyzer = new StraightFlushAnalyzer assert(analyzer.analyze(royalFlu...
Explain and rewrite the following Scala code:
package is.hail.utils import java.net.URL import java.io.OutputStream import java.io.InputStream import java.net.HttpURLConnection import is.hail.utils._ import java.nio.charset.StandardCharsets import org.apache.commons.io.output.ByteArrayOutputStream object HTTPClient { def post[T]( url: String, contentL...
Explain and rewrite the following Scala code:
package com.twitter.finagle.benchmark import com.google.caliper.SimpleBenchmark import com.twitter.finagle.tracing.SpanId import scala.util.Random import com.twitter.util.RichU64Long // Run thus: bin/caliper finagle/finagle-benchmark com.twitter.finagle.benchmark.SpanIdBenchmark class SpanIdBenchmark extends SimpleB...
Explain and rewrite the following Scala code:
import java.util.Properties import com.bgfurfeature.kafka.KafkaSink import com.dyuproject.protostuff.StringSerializer import org.apache.spark.SparkConf import org.apache.spark.broadcast.Broadcast import org.apache.spark.rdd.RDD import org.apache.spark.streaming.{Duration, StreamingContext} import scala.collection.muta...
Explain and rewrite the following Scala code:
package kafka.console package service.content import argonaut._ import Argonaut._ import kafka.console.model.monitoring.{KafkaMetric, MetricAttribute} import kafka.console.model.topics.{PartitionReplica, Topic, TopicDetails} object codecs { implicit val topicCodec = casecodec3(Topic.apply, Topic.unapply)("name", ...
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 import scala.annotation.tai...
Explain and rewrite the following Scala code:
/** * Copyright 2015 Thomson Reuters * * 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:
package rats.extractors object AnInt { def unapply(intAsString: String): Option[Int] = try { Some(intAsString.toInt) } catch { case e: NumberFormatException => None } }
Explain and rewrite the following Scala code:
import scala.scalajs.js.Dynamic.global object ElementCreator { val jQ = global.jQuery def create() = jQ("body").append(jQ("<h1>Test</h1>")) }
Explain and rewrite the following Scala code:
object Prob41 { private def toList(n: Int): List[Int] = { def f(n: Int): List[Int] = n match { case 0 => Nil case _ => (n % 10) :: f(n / 10) } f(n).reverse } def isPandigital(n: Int): Boolean = { val xs = toList(n) xs.toSet == (1 to xs.length).toSet } def main(args: Array[St...
Explain and rewrite the following Scala code:
package org.usagram.clarify import org.scalatest._ class UnknownSpec extends FunSpec { import Matchers._ private val unknown = Unknown("a value", Tags.empty) describe("#isValid") { it("returns always false") { unknown.isValid should be(false) } } describe("#isInvalid") { it("returns alw...
Explain and rewrite the following Scala code:
/* * tuProlog - Copyright (C) 2001-2002 aliCE team at deis.unibo.it * * This library 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 l...
Explain and rewrite the following Scala code:
package avrohugger package format package specific import format.abstractions.JavaTreehugger import stores.ClassStore import treehugger.forest._ import definitions._ import treehuggerDSL._ import java.io.{BufferedWriter, File, FileNotFoundException, FileWriter, IOException} import org.apache.avro.{Protocol, Schema} i...
Explain and rewrite the following Scala code:
package de.twentyone.sbt.extractors object Path { def unapply(value: String): Option[String] = { value match { case `value` if value.startsWith("/") => Some(value) case _ => None } } }
Explain and rewrite the following Scala code:
package ch.epfl.lamp.odds package macros import internal.OddsBase /** * Virtualization of control structures. * * This object provides macro definitions for the virtualized control * structures (as provided by Scala virtualize) that lift the * corresponding method calls into the probability monad `Rand[_]`. * ...
Explain and rewrite the following Scala code:
package org.jetbrains.plugins.scala package lang package psi package impl package expr import com.intellij.lang.ASTNode import com.intellij.psi._ import com.intellij.psi.util.PsiTreeUtil import org.jetbrains.plugins.scala.lang.lexer.ScalaTokenTypes import org.jetbrains.plugins.scala.lang.psi.api.expr._ /** * @autho...
Explain and rewrite the following Scala code:
package com.enkidu.lignum.parsers.ast.expression.discardable.instantiation import com.enkidu.lignum.parsers.ast.expression.discardable.dimension.Dimension import com.enkidu.lignum.parsers.ast.expression.types.Type case class EmptyArrayInstantiation(`type`: Type, dimensions: Seq[Dimension]) extends ArrayInstantiation ...
Explain and rewrite the following Scala code:
package delta.testing.mysql import delta.testing._ import scala.concurrent._ import org.junit._ import com.mysql.cj.log.Slf4JLogger import com.mysql.cj.jdbc.MysqlDataSource import delta.jdbc._ import delta.jdbc.mysql._ import scuff.SysProps import scuff.jdbc._ import java.sql._ import scuff.EmailAddress object...
Explain and rewrite the following Scala code:
package ticket_1000412.model import scala.reflect.BeanProperty trait TraitA { @BeanProperty var x: String = _ } class ClassA extends TraitA { }
Explain and rewrite the following Scala code:
// P21 Insert an element at a given position into a list. // Using "splitAt" def f1[T](list: List[T], n: Int, x: T): List[T] = { val (a, b) = list.splitAt(n - 1) (a ::: x :: b) } // By index (inefficient) def f2[T](list: List[T], n: Int, x: T): List[T] = list.take(n - 1) ::: x :: list.drop(n - 1) // Recursion ...
Explain and rewrite the following Scala code:
package info.mukel.codeforces4s.json import org.json4s.JsonAST.JValue import org.json4s.NoTypeHints import org.json4s.native.JsonMethods._ import org.json4s.native.Serialization import org.json4s.native.Serialization._ /** * JsonUtils * * Provides JSON conversion methods */ object JsonUtils { def jsonify[T <: ...
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:
import sbt._ object Resolvers { val sunRepo = "Sun Maven2 Repo" at "http://download.java.net/maven/2" val oracleRepo = "Oracle Maven2 Repo" at "http://download.oracle.com/maven" val sonatypeGithubRepo = "Sonatype Github Repo" at "http://oss.sonatype.org/content/repositories/...
Explain and rewrite the following Scala code:
package org.bfn.ninetynineprobs import org.scalatest._ class P39Spec extends UnitSpec { // TODO }
Explain and rewrite the following Scala code:
/** * * Copyright (c) 2015-present, Total Location Test Paragraph. * All rights reserved. * * This file is part of Where@. Where@ is free software: * you can redistribute it and/or modify it under the terms of * the GNU General Public License (GPL), either version 3 * of the License, or (at your option) any lat...
Explain and rewrite the following Scala code:
package com.recursivity.specs2 import org.specs2.Specification import org.specs2.specification.script.StandardDelimitedStepParsers import org.specs2.specification.script.GWT class GivenWhenThenSpecification extends Specification with GWT with StandardDelimitedStepParsers { def is = s2""" Let's add numbers! Given...
Explain and rewrite the following Scala code:
package drt.client.components import diode.data.Pot import diode.react.ModelProxy import drt.client.services._ import drt.shared.{FixedPointAssignments, PortState, ShiftAssignments, StaffMovements} import japgolly.scalajs.react.component.Scala.Component import japgolly.scalajs.react.vdom.html_<^._ import japgolly.scal...
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) 2013-2017 Commonwealth Computer Research, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Apache License, Version 2.0 * which accompanies this distribution and...
Explain and rewrite the following Scala code:
package scintuit.contrib.play.data package object raw { object all extends AllFormats trait AllFormats extends account.AccountFormats with categorization.CategorizationFormats with error.ErrorFormats with institution.InstitutionFormats with login.LoginFormats with position.PositionFormats with security.Secur...
Explain and rewrite the following Scala code:
/* * Copyright 2018 http4s.org * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
Explain and rewrite the following Scala code:
object Test extends App { def testList = { val list = new java.util.ArrayList[Int] list.add(1) list.add(2) list.add(3) import scala.collection.JavaConverters.* val next = list.asScala ++ List(4,5,6) assert(next != list.asScala) val raw = list.asScala val cloned = raw.clone lis...
Explain and rewrite the following Scala code:
/* * This file is part of Evo2DSim. * * Evo2DSim is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Evo2DSim is distrib...
Explain and rewrite the following Scala code:
/* * Copyright 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 controllers import play.api.mvc._ /** * Main application controller. */ object Application extends Controller { /** * Redirect to the product list. */ def index = Action { implicit request => Redirect(routes.Products.list()) } }
Explain and rewrite the following Scala code:
/* * Original implementation (C) 2010-2015 Nathan Hamblen and contributors * Adapted and extended in 2016 by foundweekends project * * 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 * * ...
Explain and rewrite the following Scala code:
/*********************************************************************** * Copyright (c) 2013-2017 Commonwealth Computer Research, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Apache License, Version 2.0 * which accompanies this distribution and...
Explain and rewrite the following Scala code:
// Copyright © 2013, Esko Luontola <www.orfjackal.net> // This software is released under the Apache License 2.0. // The license text is at http://www.apache.org/licenses/LICENSE-2.0 import sbt._ object SbtJumiBuild extends Build { lazy val root = Project(id = "sbt-jumi", base = file(".")) }
Explain and rewrite the following Scala code:
package jp.cappuccino.tools.markdown import java.io.File import util.FileUtils import jp.cappuccino.tools.wkhtml2pdf.WKHTML2PDF object Main extends App { final val Version = "0.2.0" final val Copyright = "NISHIMOTO Keisuke" final val WkHtml2Pdf = "wkhtmltopdf" final val OptionHelp = "-help" final val O...
Explain and rewrite the following Scala code:
package me.sgrouples.rogue.cc import java.util.concurrent.{ConcurrentHashMap, ConcurrentLinkedQueue, TimeUnit} import java.util.concurrent.atomic.{AtomicBoolean, AtomicInteger} import me.sgrouples.rogue._ import me.sgrouples.rogue.cc.debug.Debug import org.bson.types.ObjectId import shapeless.tag import shapeless.tag...
Explain and rewrite the following Scala code:
package org.senkbeil.debugger.akka import akka.actor.Actor import org.senkbeil.debugger.Debugger import org.senkbeil.debugger.akka.messages.structures.JDIReferenceType class ScalaDebuggerActor private (private val debugger: Debugger) extends Actor { override def receive: Receive = { case _ => } }