instruction stringclasses 1
value | output stringlengths 5 1M |
|---|---|
Explain and rewrite the following Scala code: | package ch.fhnw.ima.saav
package model
import ch.fhnw.ima.saav.model.color._
import ch.fhnw.ima.saav.model.config.Config
import ch.fhnw.ima.saav.model.domain._
import ch.fhnw.ima.saav.model.layout.{ProfileChartLayout, QualityChartLayout}
import ch.fhnw.ima.saav.model.weight._
/**
* Application model classes compleme... |
Explain and rewrite the following Scala code: | package org.scaladebugger.api.profiles.swappable.requests.events
import org.scalamock.scalatest.MockFactory
import org.scalatest.{FunSpec, Matchers, ParallelTestExecution}
import org.scaladebugger.api.lowlevel.JDIArgument
import org.scaladebugger.api.lowlevel.events.EventType.EventType
import org.scaladebugger.api.pro... |
Explain and rewrite the following Scala code: | /**
* Copyright (c) 2012 Alexey Aksenov ezh@ezh.msk.ru
*
* 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 dpla.ingestion3.enrichments
import dpla.ingestion3.enrichments.normalizations.FilterRegex._
import org.scalatest._
import scala.util.matching
class FilterRegexTest extends FlatSpec with BeforeAndAfter with Matchers {
// Test terms
val singleWordBlockTerm = "jpeg"
val multiWordBlockTerm = "jpeg 2000"
... |
Explain and rewrite the following Scala code: | /***********************************************************************
* Copyright (c) 2013-2018 Commonwealth Computer Research, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Apache License, Version 2.0
* which accompanies this distribution and... |
Explain and rewrite the following Scala code: | package com.softwaremill.session
import java.util.{Base64, UUID}
import org.json4s._
import org.json4s.jackson.JsonMethods._
import scala.util.Try
class JwtSessionEncoder[T](implicit serializer: SessionSerializer[T, JValue], formats: Formats = DefaultFormats)
extends SessionEncoder[T] {
override def encode(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 ... |
Explain and rewrite the following Scala code: | /*
* Copyright 2015 Nicolas Rinaudo
*
* 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: | /**
* User: denisbarahtanov
* Date: 19.10.13
* Time: 19:56
* Runner
*/
import java.io._
import rt.service.Parsers.LifeRealtyParser
object rtService extends App {
override def main(args: Array[String]): Unit = {
System.out.println("Starting service ...")
if ( args.size < 3 ) {
System.err.println("N... |
Explain and rewrite the following Scala code: | package converter.client.modules
import autowire._
import converter.client.services.AjaxClient
import converter.shared.Api
import japgolly.scalajs.react._
import japgolly.scalajs.react.vdom.html_<^._
import scala.scalajs.concurrent.JSExecutionContext.Implicits.queue
object JSON2CC {
class Backend(t: BackendScope[U... |
Explain and rewrite the following Scala code: | package org.insightcentre.unlp.naisc.extraction
import java.io.File
import java.io.{PrintWriter, File}
import org.apache.jena.rdf.model.{Seq => _, _}
import org.apache.jena.vocabulary.{OWL, RDF, RDFS, SKOS}
import scala.collection.JavaConversions._
import scala.xml._
import spray.json._
import spray.json.DefaultJsonP... |
Explain and rewrite the following Scala code: | /*
* Part of NDLA article-api.
* Copyright (C) 2021 NDLA
*
* See LICENSE
*
*/
package no.ndla.articleapi.model.domain
case class RelatedContentLink(title: String, url: String)
|
Explain and rewrite the following Scala code: | package com.wix.fax.concordfax
case class Credentials(username: String, password: String) |
Explain and rewrite the following Scala code: | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you ... |
Explain and rewrite the following Scala code: | /*******************************************************************************
Copyright (c) 2012-2014, KAIST, S-Core.
All rights reserved.
Use is subject to license terms.
This distribution may include materials developed by third parties.
**********************************************************... |
Explain and rewrite the following Scala code: | /*
* ******************************************************************************
* * Copyright (C) 2013 Christopher Harris (Itszuvalex)
* * Itszuvalex@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 p... |
Explain and rewrite the following Scala code: | package org.jetbrains.plugins.scala
package lang.refactoring.rename
import java.util
import javax.swing.Icon
import com.intellij.codeInsight.navigation.NavigationUtil
import com.intellij.ide.util.PsiClassListCellRenderer
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.editor.Edi... |
Explain and rewrite the following Scala code: | package services
import javax.inject.{Inject, Singleton}
import controllers.conversion._
import play.api.Configuration
import play.api.libs.json.JsValue
@Singleton
class JsonConversionMapsService @Inject()(configuration: Configuration, jarLoaderService: JarLoaderService) {
private val jsonConversionMaps: Map[Stri... |
Explain and rewrite the following Scala code: | package smartupedit
import org.clapper.markwrap._
sealed trait Markup
object Markup {
case object Markdown extends Markup
case object Textile extends Markup
}
|
Explain and rewrite the following Scala code: | package ch.acmesoftware.orientDbScalaDsl
class GraphDslSpec extends Spec {
"GraphDsl" should "find existing vertices by label" in {
tx(g => {
g.dsl addVertex "City"
})
tx(g => {
val res1 = g.dsl findVertices "City" single ()
res1.isDefined should equal(true)
val res2 = g.dsl fi... |
Explain and rewrite the following Scala code: | /*
* Copyright 2017 HM Revenue & Customs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or a... |
Explain and rewrite the following Scala code: | package org.tensorframes
import org.scalatest.FunSuite
import org.tensorframes.impl.DenseTensor
class DenseTensorSuite extends FunSuite {
test("Serialization of doubles and endianness") {
val d = DenseTensor(1.0)
val p = DenseTensor.toTensorProto(d)
assert(p.getDoubleVal(0) === 1.0)
}
test("Serial... |
Explain and rewrite the following Scala code: | package example
import utest._
import org.scalajs.dom
import scala.scalajs.js
import js.JSConverters._
object BarChartTest extends TestSuite {
def tests = TestSuite {
'BarChart {
val barChart = new BarChart
val barMap = Map("barWidth" -> "450")
// the data is in the form of a generic sequenc... |
Explain and rewrite the following Scala code: | package reactive.socket
import akka.actor.ActorRef
import java.net.InetSocketAddress
import org.java_websocket.WebSocket
import org.java_websocket.framing.CloseFrame
import org.java_websocket.server.WebSocketServer
import org.java_websocket.handshake.ClientHandshake
import scala.collection.mutable.Map
objec... |
Explain and rewrite the following Scala code: | /*
* Copyright 2013 Marek Radonsky
*
* 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: | /*
* 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 modules
import be.objectify.deadbolt.scala.DeadboltHandler
import be.objectify.deadbolt.scala.cache.HandlerCache
import security.{AuthSupport, MyDeadboltHandler, MyHandlerCache}
import play.api.inject.{Binding, Module}
import play.api.{Configuration, Environment}
/**
* @author Steve Chaloner (steve@objectif... |
Explain and rewrite the following Scala code: | package lila.game
import play.api.libs.json.JsObject
import reactivemongo.bson.{ BSONDocument, BSONInteger }
import reactivemongo.core.commands._
import lila.common.PimpedJson._
import lila.db.Types._
import lila.user.UserRepo
final class CrosstableApi(coll: Coll) {
import Crosstable.Result
private val maxGame... |
Explain and rewrite the following Scala code: | package com.twitter.scrooge.backend
import com.twitter.finagle
import com.twitter.finagle.SourcedException
import com.twitter.finagle.thrift.ThriftClientRequest
import com.twitter.scrooge.ThriftException
import com.twitter.scrooge.testutil.{EvalHelper, JMockSpec}
import com.twitter.util.{Await, Future}
import org.apac... |
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 scjson.converter
import scjson.converter.{
AltSeqConverters as ASC
}
trait EitherJsonReaders {
given EitherReader[T1:JsonReader,T2:JsonReader]:JsonReader[Either[T1,T2]] =
ASC.altReader("left", "right")
}
|
Explain and rewrite the following Scala code: | /*
* Scala (https://www.scala-lang.org)
*
* Copyright EPFL and Lightbend, Inc.
*
* Licensed under Apache License 2.0
* (http://www.apache.org/licenses/LICENSE-2.0).
*
* See the NOTICE file distributed with this work for
* additional information regarding copyright ownership.
*/
package scala.jdk
import java... |
Explain and rewrite the following Scala code: | package io.vamp.pulse.notification
import io.vamp.common.akka.RequestError
import io.vamp.common.notification.{ ErrorNotification, Notification }
case class UnsupportedPulseDriverError(name: String) extends Notification
case class UnsupportedPulseRequest(request: Any) extends Notification with RequestError
case cla... |
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: | //import java.util.List
import ie.nuig.entitylinking.core.{AnnotatedMention, ELDocument}
import ie.nuig.entitylinking.main.nel.EntityLinkingMain
import org.apache.spark.rdd.RDD
import org.json4s.NoTypeHints
import org.json4s.jackson.Serialization
import org.json4s.jackson.Serialization._
import scala.util.parsing.jso... |
Explain and rewrite the following Scala code: | /*
Copyright 2012 Georgia Tech Research Institute
Author: lance.gatlin@gtri.gatech.edu
This file is part of org.gtri.util.iteratee library.
org.gtri.util.iteratee library is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
... |
Explain and rewrite the following Scala code: | package cromwell.backend.impl.jes.statuspolling
import akka.actor.{ActorRef, Props}
import akka.testkit.{TestActorRef, TestProbe, _}
import cats.data.NonEmptyList
import com.google.api.client.googleapis.batch.BatchRequest
import com.google.api.client.googleapis.batch.json.JsonBatchCallback
import com.google.api.client... |
Explain and rewrite the following Scala code: | /*
*
* /\\\\\\\\\\
* /\\\\\\///\\\\\\
* /\\\\\\/ \\///\\\\\\ /\\\\\\\\\\\\\\\\\\ /\\\\\\ /\\\\\\
* /\\\\\\ \\//\\\\\\ /\\\\\\/////\\\\\\ /\\\\\\\\\\\\\\\\\\\\\\ \\/// /\\\\\\\\\\ /\\\\\\\\\\ /\\\\\\ /\\\\\\ /\\\\\\\\\\\\\\\\\\\\
* \\/\\\\\\ \\/\\\\\\ \\/\\\\\\\\\\\\\\\\\\\... |
Explain and rewrite the following Scala code: | /*
* Copyright 2001-2013 Artima, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agre... |
Explain and rewrite the following Scala code: | /*
* 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
* distrib... |
Explain and rewrite the following Scala code: | package com.twitter.finagle.mysql
case class ClientError(msg: String) extends Exception(msg)
case class ServerError(msg: String) extends Exception(msg)
case class IncompatibleServer(msg: String) extends Exception(msg)
|
Explain and rewrite the following Scala code: | /***********************************************************************
* Copyright (c) 2013-2022 Commonwealth Computer Research, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Apache License, Version 2.0
* which accompanies this distribution and... |
Explain and rewrite the following Scala code: | package test
import java.io.File
import api.{WebsiteApiConfig, WebsiteApi}
import models.{WebsiteDb, WebserverConfig, Website}
import org.specs2.mutable.Specification
import org.zeroturnaround.zip.ZipUtil
import play.api.libs.json.{Json, JsValue}
import play.api.libs.ws.WSResponse
import play.api.test.{WithApplicatio... |
Explain and rewrite the following Scala code: | /*
* Copyright 2015 Geeoz Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed ... |
Explain and rewrite the following Scala code: | package net.scalaleafs
import scala.collection.mutable
import scala.xml.NodeSeq
object Match {
def apply[A](bindable : Val[A])(f : A => RenderNode) = {
var cache = mutable.HashMap[A, RenderNode]()
Binding.bind(bindable) { placeholder =>
new RenderNodeDelegate(cache.getOrElseUpdate(placeholder.get, f(p... |
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 2015 Yahoo Inc. Licensed under the Apache License, Version 2.0
* See accompanying LICENSE file.
*/
package kafka.manager
import java.util.Properties
import akka.actor.{ActorRef, ActorSystem, Kill, Props}
import akka.pattern._
import akka.util.Timeout
import akka.util.Timeout._
import com.typesafe.c... |
Explain and rewrite the following Scala code: | package com.jesperancinha.imagecontour.filters.chartizate
class ImageChartizateGraphics(val bgColor: Int = 0, val densityPercentage: Int = 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 edu.berkeley.cs.amplab.carat
import spark._
import spark.SparkContext._
import spark.timeseries._
import edu.berkeley.cs.amplab.carat.plot.PlotUtil
import edu.berkeley.cs.amplab.carat.dynamodb.DynamoAnalysisUtil
import scala.collection.immutable.TreeMap
import scala.collection.mutable.HashMap
import scala.coll... |
Explain and rewrite the following Scala code: | package bylt.core
sealed abstract class Expr
case class Var (name : Name) extends Expr
sealed trait Const extends Expr
case class Ref (qname : QName) extends Const
case class Literal (value : Value) extends Const
case class Apply (fun : Expr, args : Vector [Expr]) extends Expr
case clas... |
Explain and rewrite the following Scala code: | package com.github.wakfudecrypt.types.data
import com.github.wakfudecrypt._
@BinaryDecoder
case class Bags(
id: Int,
capacity: Short,
bagType: Int,
validItemCategories: Array[Int]
)
object Bags extends BinaryDataCompanion[Bags] {
override val dataId = 121
}
|
Explain and rewrite the following Scala code: | /*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright 2015-2021 Andre White.
*
* 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
*
* https://www.apache.org/licenses/LICENSE-2.0
*
... |
Explain and rewrite the following Scala code: | import org.specs2.mutable._
import org.specs2.runner._
import org.junit.runner._
import play.api._
import play.api.i18n._
import play.api.test._
import play.api.test.Helpers._
@RunWith(classOf[JUnitRunner])
class FormSpec extends Specification {
import controllers.Application
// -- i18n
val conf = Config... |
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 akka.dispatch.verification
import akka.actor.Cell
import akka.actor.ActorSystem
import akka.actor.ActorRef
import akka.actor.Actor
import akka.actor.PoisonPill
import akka.actor.Props;
import akka.dispatch.Envelope
import akka.dispatch.MessageQueue
import akka.dispatch.MessageDispatcher
import scala.collecti... |
Explain and rewrite the following Scala code: | /**
* Copyright (C) 2010 Orbeon, Inc.
*
* This program is free software; you can redistribute it and/or modify it under the terms of the
* GNU Lesser General Public License as published by the Free Software Foundation; either version
* 2.1 of the License, or (at your option) any later version.
*
* This program i... |
Explain and rewrite the following Scala code: | package de.htwg.zeta.codeGenerator
import java.util.UUID
import scala.annotation.tailrec
import scala.collection.immutable.Seq
import scala.collection.mutable
import scala.collection.mutable.ListBuffer
import de.htwg.zeta.codeGenerator
import de.htwg.zeta.codeGenerator.generation.KlimaCodeGenerator
import de.htwg.z... |
Explain and rewrite the following Scala code: | package com.michalplachta.shoesorter
import com.michalplachta.shoesorter.Domain.{ Container, Junction }
import kamon.Kamon
object Decisions {
val firstJunctionId = 1
val lastJunctionId = 5
def whereShouldContainerGo(junction: Junction, container: Container): String = {
Thread.sleep(5) // just to simulate re... |
Explain and rewrite the following Scala code: | /***********************************************************************
* Copyright (c) 2013-2019 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 org.jmotor.sbt.exception
/**
* Component:
* Description:
* Date: 2018/3/1
*
* @author AI
*/
case class MultiException(exceptions: Throwable*) extends RuntimeException {
def getMessages: Seq[String] = exceptions.map { e ⇒
if (Option(e.getLocalizedMessage).isDefined) e.getLocalizedMessage else e.get... |
Explain and rewrite the following Scala code: | package com.productfoundry.akka.cqrs
/**
* Exception indicating an unknown command is send to an aggregate.
*/
case class AggregateCommandUnknownException(command: Any)
extends RuntimeException(command.toString) |
Explain and rewrite the following Scala code: | package com.dzegel.DynamockServer.service
import com.dzegel.DynamockServer.types.ExpectationId
import com.google.inject.{ImplementedBy, Singleton}
import scala.collection.mutable
@ImplementedBy(classOf[DefaultHitCountService])
trait HitCountService {
def register(expectationIds: Seq[ExpectationId]): Unit
def ge... |
Explain and rewrite the following Scala code: | class ScalaConstructorC[T: Manifest]()
new ScalaConstructorC[Int]()(/*caret*/)
// implicit ev1: Manifest[Int] |
Explain and rewrite the following Scala code: | package tshrdlu.twitter
/**
* Copyright 2013 Jason Baldridge
*
* 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 require... |
Explain and rewrite the following Scala code: | package com.cloudlabhk.faceanalysis
class FaceCollectionTools extends RekognitionTools {
import java.io.File
import com.amazonaws.services.rekognition.model._
def createCollection(collectionId: String) = {
val request = new CreateCollectionRequest().withCollectionId(collectionId)
amazonRekognition.cr... |
Explain and rewrite the following Scala code: | package com.codahale.jerkson.deser
import com.fasterxml.jackson.core.JsonParser
import com.fasterxml.jackson.databind.node.TreeTraversingParser
import com.fasterxml.jackson.databind._
class EitherDeserializer(config: DeserializationConfig,
javaType: JavaType) extends JsonDeserializer[Object] {
def deserialize(j... |
Explain and rewrite the following Scala code: | /*
* Copyright (C) Lightbend Inc. <https://www.lightbend.com>
*/
package play.api.libs.crypto
import java.nio.charset.StandardCharsets
import javax.crypto.Mac
import javax.crypto.spec.SecretKeySpec
import javax.inject.Inject
import javax.inject.Provider
import javax.inject.Singleton
import play.api.http.SecretConf... |
Explain and rewrite the following Scala code: | /*
* Copyright (C) 2015 Stratio (http://stratio.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by app... |
Explain and rewrite the following Scala code: | package org.jetbrains.plugins.scala
package lang
package structureView
package elements
package impl
import com.intellij.ide.util.treeView.smartTree.TreeElement
import com.intellij.navigation.ItemPresentation
import org.jetbrains.plugins.scala.lang.psi.api.statements.ScTypeAlias
import org.jetbrains.plugins.scala.lang... |
Explain and rewrite the following Scala code: | package knot.testKit
class TestGenericClass[T1](v: T1) extends Serializable {
var genMember: T1 = null.asInstanceOf[T1]
}
class NonSerializable
class TestTraitImpl extends TestTrait
trait TestTrait extends Serializable {
var traitVarField: Int = 0
def setup(): this.type = {
traitVarField = 123
this
... |
Explain and rewrite the following Scala code: | // Copyright 2017,2018,2019,2020 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 a... |
Explain and rewrite the following Scala code: | package de.endrullis.sta.exmaples
import java.awt.Color
import de.endrullis.sta._
/**
* Animation of flying letters.
*
* @author Stefan Endrullis <stefan@endrullis.de>
*/
object HappyBirthdayRena extends ScalaTikzAni {
conf.boundingBox = Pos(-2,-1.5) -> Pos(3,2)
def splitIntoLetters(s: String) = {
s.... |
Explain and rewrite the following Scala code: | /* NEST (New Scala Test)
* Copyright 2007-2013 LAMP/EPFL
*/
package scala.tools
import java.util.concurrent.{ Callable, ExecutorService }
import scala.concurrent.duration.Duration
import scala.tools.nsc.util.Exceptional
package object partest {
type File = java.io.File
type SFile = scala.reflect... |
Explain and rewrite the following Scala code: | package org.dohrm.storyline.users.models
import org.dohrm.toolkit.context.JdbcContext
import org.dohrm.toolkit.security.models.SecurityUser
import org.joda.time.DateTime
import spray.json.RootJsonFormat
case class User(id: String,
displayName: String,
picture: String,
... |
Explain and rewrite the following Scala code: | package java.util.concurrent
import java.lang.{reflect => jlr}
import java.io.Serializable
import java.util._
import scala.collection.JavaConverters._
class ConcurrentHashMap[K >: Null, V >: Null]
extends AbstractMap[K, V] with ConcurrentMap[K, V] with Serializable { self =>
def this(initialCapacity: Int) =
... |
Explain and rewrite the following Scala code: | package net.fluffy8x.thsch.entity
import net.fluffy8x.thsch.base.{ Point2D, Vector2D, Point3D, BoundsRect, Color }
import net.fluffy8x.thsch.resource._
trait Shot extends Movable with Renderable {
def _register(m: EntityManager): Unit = {
super._register(m)
m.enemyShots += this
}
}
trait PlayerShot exten... |
Explain and rewrite the following Scala code: |
class InsertionSort {
def insertionSort(listToBeSorted: List[Int]): List[Int] = {
listToBeSorted match {
case List() => List()
case x :: xs1 => insertNum(x, insertionSort(xs1))
}
}
def insertNum(x: Int, xs: List[Int]): List[Int] = {
xs match {
case List() => List(x)
case y... |
Explain and rewrite the following Scala code: | /*
Copyright 2016-17, Hasso-Plattner-Institut fuer Softwaresystemtechnik GmbH
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 applicab... |
Explain and rewrite the following Scala code: | package scala.meta
package internal
package quasiquotes
import scala.language.experimental.macros
import scala.reflect.macros.whitebox.Context
import org.scalameta.ast.{Reflection => AstReflection}
import org.scalameta.invariants._
import org.scalameta.unreachable
// NOTE: we don't have the signature as [O, I] to kee... |
Explain and rewrite the following Scala code: | package ch.uzh.dyndco.problems
import scala.collection.mutable.MutableList
import scala.util.Random
import collection.mutable.Set
import collection.mutable.Map
object MeetingSchedulingFactory {
/**
* Configuration
*/
val MAX_PARTICIPATIONS : Int = 5
/**
* Top-level build function
*/
var TIMES... |
Explain and rewrite the following Scala code: | /*§
===========================================================================
KnapScal - Core
===========================================================================
Copyright (C) 2015-2016 Gianluca Costa
===========================================================================
Licensed under the Ap... |
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: | package edu.gemini.phase2.template.factory.impl.gmos
import edu.gemini.pot.sp.{ISPObservation, ISPGroup}
import edu.gemini.spModel.gemini.gmos.blueprint.SpGmosSBlueprintMos
import edu.gemini.phase2.template.factory.impl.TemplateDb
import edu.gemini.spModel.gemini.gmos.GmosSouthType.FPUnitSouth._
import edu.gemini.spMo... |
Explain and rewrite the following Scala code: | package im.mange.jetpac
import scala.xml.{NodeSeq, Text}
object R {
//TIP: http://spray.io/blog/2012-12-13-the-magnet-pattern/
sealed trait RenderableMagnet { def apply(): Renderable }
implicit def fromString(s: String) = new RenderableMagnet { def apply() = R(Text(s)) }
implicit def fromStrings(ss: Seq[Strin... |
Explain and rewrite the following Scala code: | import sbt._
import sbt.librarymanagement.DependencyBuilders.OrganizationArtifactName
// format: off
object Dependencies {
object Versions {
val akka = "2.6.18"
val akkaHttpV = "10.2.7"
val iep = "3.0.13"
val guice = "5.1.0"
val jackson = "2.13.1"
val log4j = "2.17... |
Explain and rewrite the following Scala code: | package scutil.lang
import minitest._
@SuppressWarnings(Array("org.wartremover.warts.ImplicitParameter"))
object SourceLocationTest extends SimpleTestSuite {
final case class Check(x:Int)
implicit val check:Check = Check(1)
//------------------------------------------------------------------------------
test("i... |
Explain and rewrite the following Scala code: | /*
* Copyright 2015 ligaDATA
*
* 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: | import org.scalatest.FunSuite
class SBT543 extends FunSuite {
class MyCustomException(message: String) extends RuntimeException(message)
test("throws a custom excpetion") {
throw new MyCustomException("this is a custom exception")
}
}
|
Explain and rewrite the following Scala code: | package controllers.tabs
import play.api.mvc.Controller
import play.api.mvc.Action
import de.fuberlin.wiwiss.silk.workspace.User
import de.fuberlin.wiwiss.silk.util.Identifier._
import models.EvalLink
import models.EvalLink.{Unknown, Incorrect, Generated, Correct}
import controllers.util.{Stream, Widgets}
import model... |
Explain and rewrite the following Scala code: | package de.unihamburg.vsis.sddf.similarity.measures
import com.rockymadden.stringmetric.StringMetric
final case class MeasureWrapperToLower(metric: StringMetric[Double]) extends StringMetric[Double] {
/*
* TODO this is very inefficient Array[Char] -> String
*/
override def compare(a: Array[Char], b: Arra... |
Explain and rewrite the following Scala code: | package smtlib
package theories
import Reals._
import org.scalatest.funsuite.AnyFunSuite
class RealsTests extends AnyFunSuite {
override def suiteName = "Reals theory test suite"
test("Real sort") {
RealSort() match {
case RealSort() => assert(true)
case _ => assert(false)
}
RealSort()... |
Explain and rewrite the following Scala code: | package com.whisk.docker
import scala.concurrent.duration._
trait DockerElasticsearchService extends DockerKit {
val DefaultElasticsearchHttpPort = 9200
val DefaultElasticsearchClientPort = 9300
val elasticsearchContainer = DockerContainer("elasticsearch:1.7.1")
.withPorts(DefaultElasticsearchHttpPort -> ... |
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 PayPal
*
* 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: | // Copyright: 2010 - 2016 https://github.com/ensime/ensime-server/graphs
// Licence: http://www.gnu.org/licenses/gpl-3.0.en.html
package org.ensime.core.javac
import akka.actor.ActorRef
import akka.event.slf4j.SLF4JLogging
import com.sun.source.tree.Scope
import com.sun.source.tree.{ IdentifierTree, MemberSelectTree }... |
Explain and rewrite the following Scala code: | /*
* Copyright (c) 2012-2016 Snowplow Analytics Ltd. All rights reserved.
*
* This program is licensed to you under the Apache License Version 2.0,
* and you may not use this file except in compliance with the Apache License Version 2.0.
* You may obtain a copy of the Apache License Version 2.0 at http://www.apach... |
Explain and rewrite the following Scala code: | /**
* Copyright (C) 2012 LShift 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 by applicable law or a... |
Explain and rewrite the following Scala code: | package com.atomist.rug.spi
import com.atomist.graph.GraphNode
import com.atomist.rug.kind.dynamic.ChildResolver
/**
* Support for a new Rug "kind" or "type" that can be used in path expressions
* and resolved in a context.
*/
abstract class Type
extends ChildResolver
with Typed {
/**
* Describe th... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.