instruction stringclasses 1
value | output stringlengths 5 1M |
|---|---|
Explain and rewrite the following Scala code: | package com.github.mgoeminne.iban
import java.util.Locale
import org.scalatest.{Inspectors, Matchers, FlatSpec}
import scala.io.Source
class IbanTest extends FlatSpec with Matchers with Inspectors {
val lampiris = Iban(new Locale("fr", "BE"), 38, "001509424272")
val greekBank = Iban(new Locale("gr", "GR"), 3... |
Explain and rewrite the following Scala code: | package com.github.notyy.service
import com.github.notyy.domain
import com.github.notyy.domain.Product
import com.github.notyy.repo.{ProductDBImMem, ProductRepo}
case class TempProduct(name: String)
trait ProductService {
this: ProductRepo =>
def create(tempProduct: TempProduct): Option[domain.Product] = {
... |
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 to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... |
Explain and rewrite the following Scala code: | package org.jetbrains.plugins.scala.lang.resolve2
/**
* Pavel.Fatin, 02.02.2010
*/
class InheritanceTraitTest extends ResolveTestBase {
override def folderPath: String = {
super.folderPath + "inheritance/trait/"
}
//TODO abstractoverride
// def testAbstractOverrideExtendsClass = doTest
def testAbstra... |
Explain and rewrite the following Scala code: | package org.aja.tej.examples.sparksql
import org.aja.tej.utils.TejUtils
import org.apache.spark.sql.SQLContext
/**
* Created by mdhandapani on 29/7/15.
*/
// Two methods of creating the DataFrame
// 1. Allowing the Spark to manage itself by using SQL Context
// 2. Creating schema using case class and registering... |
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: | /* Copyright 2009-2016 EPFL, Lausanne */
import leon.lang._
import leon.collection._
import leon._
object ShortCircuit {
def negate(a: Boolean) = {
var b = true
a && { b = false; true }
b
} ensuring { res => res != a }
def negateOr(a: Boolean) = {
var b = false
a || { b = true; true }
... |
Explain and rewrite the following Scala code: | /*******************************************************************************
Copyright (c) 2012-2014, S-Core, KAIST.
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-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 mesosphere.marathon.health
import java.util.concurrent.locks.{ Lock, ReentrantReadWriteLock }
import java.util.concurrent.locks.ReentrantReadWriteLock.{ ReadLock, WriteLock }
import javax.inject.{ Inject, Named }
import scala.concurrent.Future
import scala.concurrent.duration._
import akka.actor.{ ActorRef, A... |
Explain and rewrite the following Scala code: | /*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this f... |
Explain and rewrite the following Scala code: | /*
* Copyright (c) 2014-2018 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 cz.jenda.pidifrky.logic
import java.io._
import java.net.{InetAddress, UnknownHostException}
import java.util.concurrent.{Executors, ScheduledExecutorService, TimeUnit}
import java.util.zip.{GZIPInputStream, GZIPOutputStream}
import android.app.{Activity, AlarmManager, PendingIntent}
import android.content.pm... |
Explain and rewrite the following Scala code: | package com.sksamuel.elastic4s.mappings
import com.sksamuel.exts.OptionImplicits._
case class KeywordFieldDefinition(name: String,
analyzer: Option[String] = None,
boost: Option[Double] = None,
copyTo: Seq[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 may ... |
Explain and rewrite the following Scala code: | package org.firesocks.net.ws.server
import akka.io.Tcp.ConfirmedClose
import org.java_websocket.WebSocket
import akka.actor._
import akka.io.Tcp
import akka.util.ByteString
import org.firesocks.util.Logger
import org.firesocks.codec.{Encoded, Plain, Codec}
import org.firesocks.net.tcp.{Ack, TCPRelay}
import org.fire... |
Explain and rewrite the following Scala code: | /*
* Copyright 2014–2018 SlamData Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agr... |
Explain and rewrite the following Scala code: | /**
* Copyright 2017 Peter Nerg
*
* 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 la... |
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.monovore.coast
package samza
import com.monovore.coast.core._
import com.twitter.algebird.Monoid
import org.apache.samza.config.{Config, JobConfig, MapConfig, TaskConfig}
import org.apache.samza.storage.kv.KeyValueStorageEngine
import org.apache.samza.storage.kv.inmemory.InMemoryKeyValueStorageEngineFactor... |
Explain and rewrite the following Scala code: | /*
* Copyright 2012 Eike Kettner
*
* 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 org.jetbrains.plugins.scala.conversion.copy
import org.jetbrains.plugins.scala.conversion.copy.plainText.TextJavaCopyPastePostProcessor
import org.jetbrains.plugins.scala.settings.ScalaProjectSettings
class CopyPasteTextToScala extends CopyPasteTestBase {
override val fromLangExtension: String = ".txt"
o... |
Explain and rewrite the following Scala code: | /*
* Copyright (C) 2015 morinb
* https://github.com/morinb
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option)... |
Explain and rewrite the following Scala code: | package dotty.tools
package dotc
package parsing
import collection.immutable.BitSet
import core.Decorators._
import core.StdNames.nme
abstract class TokensCommon {
def maxToken: Int
type Token = Int
type TokenSet = BitSet
def tokenRange(lo: Int, hi: Int): TokenSet = BitSet(lo to hi: _*)
def showTokenDeta... |
Explain and rewrite the following Scala code: | // Copyright (C) 2011 Dmitri Nikulin
//
// This file is part of Vijil.
//
// Vijil is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later ve... |
Explain and rewrite the following Scala code: | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... |
Explain and rewrite the following Scala code: | package org.scaladebugger.api.lowlevel.exceptions
import org.scalamock.scalatest.MockFactory
import org.scalatest.{FunSpec, Matchers, ParallelTestExecution}
import org.scaladebugger.api.lowlevel.requests.JDIRequestArgument
import org.scaladebugger.api.utils.{ActionInfo, PendingActionManager}
import org.scaladebugger.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: | package oocamp
import org.scalatest.{FlatSpec, Matchers}
/**
* Created by twer on 14/11/22.
*/
class ParkingBoySpec extends FlatSpec with Matchers {
it should "can park car then return a ticket" in {
new ParkingBoy(Array(new ParkingLot(1))).park(Car()) shouldNot be(None)
}
it should "can take car by the ... |
Explain and rewrite the following Scala code: | package stores
import java.util.concurrent.atomic.AtomicInteger
import javax.inject.Singleton
import org.coursera.example.Instructor
import org.coursera.example.Partner
import org.coursera.naptime.model.Keyed
@Singleton
class PartnerStore {
@volatile
var partnerStore = Map.empty[String, Partner]
val nextId = n... |
Explain and rewrite the following Scala code: | import scala.reflect.runtime.universe._
import scala.reflect.runtime.{universe => ru}
import scala.reflect.runtime.{currentMirror => cm}
import scala.tools.reflect.ToolBox
import scala.tools.reflect.Eval
object Test extends dotty.runtime.LegacyApp {
val code = reify {
case class C(foo: Int, bar: Int)
val c =... |
Explain and rewrite the following Scala code: | package io.getquill.quotation
import io.getquill.Spec
import io.getquill.ast.IdentName
import io.getquill.testContext.implicitOrd
import io.getquill.testContext.qr1
import io.getquill.testContext.qr2
import io.getquill.testContext.quote
import io.getquill.testContext.unquote
class FreeVariablesSpec extends Spec {
... |
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 io.latent.resilience
import com.netflix.hystrix.strategy.eventnotifier.HystrixEventNotifier
import com.netflix.hystrix.strategy.concurrency.HystrixConcurrencyStrategy
import com.netflix.hystrix.strategy.metrics.HystrixMetricsPublisher
import com.netflix.hystrix.strategy.properties.HystrixPropertiesStrategy
imp... |
Explain and rewrite the following Scala code: | /**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you... |
Explain and rewrite the following Scala code: | package controllers
import play.api.mvc.{Action, Controller}
object MainController extends Controller {
def index = Action {
Ok(views.html.index.render())
}
def story = Action {
Ok(views.html.story.render())
}
def cityhall = Action {
Ok(views.html.cityhall.render())
}
def church = Act... |
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
* distributed ... |
Explain and rewrite the following Scala code: | package com.criteo.dev.cluster.copy
import com.criteo.dev.cluster.Node
import com.criteo.dev.cluster.command.{SshHiveAction, SshMultiAction}
import com.criteo.dev.cluster.config.GlobalConfig
import com.criteo.dev.cluster.source.{GetSourceMetadataAction, HDFSFileInfo, FullTableInfo}
import org.slf4j.LoggerFactory
impo... |
Explain and rewrite the following Scala code: | package org.opentreeoflife.smasher
import scala.collection.JavaConversions._
import org.semanticweb.owlapi.apibinding.OWLManager
import org.semanticweb.owlapi.model.IRI
import java.io.File
object TranslateTaxonomy extends App {
val inputDirectory = args(0)
val outFile = args(1)
val manager = OWLManager.createO... |
Explain and rewrite the following Scala code: | package zeroformatter
package scalaz
import _root_.scalaz.std.anyVal._
import scalaprops._
import dog.props._
object LawsTest extends Base {
val `Formatter laws` = Properties.list(
scalazlaws.invariantFunctor.all[Formatter]
).lift()
}
|
Explain and rewrite the following Scala code: | package dk.gp.sgpr
import breeze.linalg.DenseMatrix
import breeze.linalg.DenseVector
import breeze.linalg._
import breeze.numerics._
import dk.bayes.math.gaussian.Gaussian
object sgprPredict {
def apply(s: DenseMatrix[Double], model: SgprModel, computeVariance: Boolean = true): DenseVector[Gaussian] = {
val l... |
Explain and rewrite the following Scala code: | package daos
import models.User
import models.User.MainProfile
import java.lang.Long
import org.hibernate.Session
import org.hibernate.criterion.Restrictions.{eq => equal, _}
import models.UserProfile
import models.UserProfile._
import javax.inject._
@Singleton
class UserDAO extends DAO[User, Long] {
def findByUser... |
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.sksamuel.elastic4s.requests.cat
case class CatAliases(pattern: Option[String])
|
Explain and rewrite the following Scala code: | /*
* Copyright 2014 JHC Systems Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or ag... |
Explain and rewrite the following Scala code: | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... |
Explain and rewrite the following Scala code: | package org.jetbrains.plugins.scala.debugger.renderers
import com.intellij.debugger.settings.NodeRendererSettings
import com.intellij.debugger.ui.tree.render._
import org.jetbrains.plugins.scala.debugger._
import org.jetbrains.plugins.scala.debugger.ui.ScalaCollectionRenderer
import org.jetbrains.plugins.scala.{Debugg... |
Explain and rewrite the following Scala code: | package colonlc.mpm.tasks
import colonlc.mpm.{Task, Tasks}
/**
* Help Task
*/
private[mpm] object help extends Task{
override def exec(args: Array[String]): Unit = {
println(
s"""
|
|Usage: mcl <command> [options] arguments
|
|universal options:
| -v --verbose: verbose output
| ... |
Explain and rewrite the following Scala code: | /*
* Copyright 2016 Guy Van den Broeck and Wannes Meert (UCLA and KU Leuven)
*
* 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
*
* Un... |
Explain and rewrite the following Scala code: | package com.ajjpj.cassdriver.connection
import java.net.InetSocketAddress
import java.nio.ByteBuffer
import java.nio.channels.{AsynchronousSocketChannel, CompletionHandler}
import java.util.concurrent.TimeUnit
import akka.actor.Status.Failure
import akka.actor.{Actor, ActorRef}
import com.ajjpj.cassdriver.connection.... |
Explain and rewrite the following Scala code: | package models.generator.javaAwsLambdaPojos
import lib.Constants
class ApidocComments(version: String, userAgent: Option[String]) {
private val elements = Seq(
Some(s"Generated by API Builder - ${Constants.ApibuilderUrl}"),
Some(s"Service version: $version"),
userAgent
).flatten
val forClassFile: ... |
Explain and rewrite the following Scala code: | /*
* Copyright (c) 2017
* All rights reserved.
*
* 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 foll... |
Explain and rewrite the following Scala code: | /* Copyright (C) 2015 University of Massachusetts Amherst.
This file is part of “author_coref”
http://github.com/iesl/author_coref
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
h... |
Explain and rewrite the following Scala code: | // Solution-3.scala
// Solution to Exercise 3 in "Methods Inside Classes"
class Flare {
def light():String = { "Flare used!"}
}
class Sailboat2 {
def raise():String = { "Sails raised" }
def lower():String = { "Sails lowered" }
def signal():String = {
new Flare().light()
}
}
class Motorboat2 {
def sta... |
Explain and rewrite the following Scala code: | /*
* -╥⌐⌐⌐⌐ -⌐⌐⌐⌐-
* ≡╢░░░░⌐\\░░░φ ╓╝░░░░⌐░░░░╪╕
* ╣╬░░` `░░░╢┘ φ▒╣╬╝╜ ░░╢╣Q
* ║╣╬░⌐ ` ╤▒▒▒Å` ║╢╬╣
* ╚╣╬░⌐ ╔▒▒▒▒`«╕ ╢╢╣▒
* ╫╬░░╖ .░ ╙╨╨ ╣╣╬░φ ╓φ░╢╢Å
* ╙╢░░░░⌐"░░░╜ ╙Å░░░░⌐░░░░╝`
* ``˚¬ ⌐ ˚˚⌐´
*
* ... |
Explain and rewrite the following Scala code: | package com.ybrikman.ping
import com.ybrikman.ping.TimingHelper._
import com.ybrikman.ping.CustomRoutes._
import com.ybrikman.ping.javaapi.bigpipe.PageletRenderOptions
import com.ybrikman.ping.scalaapi.bigpipe.HtmlStreamImplicits._
import com.ybrikman.ping.scalaapi.bigpipe._
import data.FutureUtil
import play.api.libs... |
Explain and rewrite the following Scala code: | /* Copyright 2014 UniCredit S.p.A.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or ag... |
Explain and rewrite the following Scala code: | /*
* Copyright 2015 IBM Corporation
*
* 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.campudus.tableaux.database.model.structure
import java.util.NoSuchElementException
import java.util.concurrent.TimeUnit
import com.campudus.tableaux._
import com.campudus.tableaux.database._
import com.campudus.tableaux.database.domain._
import com.campudus.tableaux.database.model.TableauxModel._
import c... |
Explain and rewrite the following Scala code: | package org.scalaide.debug.internal.async
import scala.collection.JavaConverters.asScalaBufferConverter
import org.scalaide.debug.internal.model.JdiRequestFactory
import org.scalaide.debug.internal.model.ScalaDebugTarget
import org.scalaide.logging.HasLogger
import org.scalaide.util.internal.Suppress
import com.sun.... |
Explain and rewrite the following Scala code: | /*
* Copyright 2022 HM Revenue & Customs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or a... |
Explain and rewrite the following Scala code: | package com.xantoria.flippy.condition
import scala.util.matching.{Regex => SRegex}
object StringConditions {
abstract class SCondition extends Condition {
def appliesTo(s: String): Boolean
override def appliesTo(a: Any) = a.isInstanceOf[String] && appliesTo(a.asInstanceOf[String])
}
class Range(val low... |
Explain and rewrite the following Scala code: | /*
Deduction Tactics
Copyright (C) 2012-2015 Raymond Dodge
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This progra... |
Explain and rewrite the following Scala code: | package io.scalac.rabbit
import io.scalac.amqp.{Direct, Exchange, Queue}
object RabbitRegistry {
val inboundExchange = Exchange("censorship.inbound.exchange", Direct, true)
val inboundQueue = Queue("censorship.inbound.queue")
val outboundExchange = Exchange("censorship.outbound.exchange", Direct, true)
... |
Explain and rewrite the following Scala code: | package algorithms.strings
import org.scalatest.{FunSuite, WordSpec}
import BuildPalindrome._
class BuildPalindromeTest extends WordSpec {
"bac bac" in {
println(buildPalindrome("bac", "bac"))
}
"abc def" in {
println(buildPalindrome("abc", "def"))
}
"jdfh fds" in {
println(buildPalindrome("jd... |
Explain and rewrite the following Scala code: | /*
* Copyright (c) 2018. Fengguo Wei and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Apache License v2.0
* which accompanies this distribution, and is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* Detailed contributors ar... |
Explain and rewrite the following Scala code: | package tests.rescala.errors
import tests.rescala.testtools.RETests
class EmptySignalTestSuite extends RETests {
multiEngined { engine =>
import engine._
test("basic Empty Signal Test") {
val v = Var.empty[Int]
intercept[NoSuchElementException](v.readValueOnce)
var res = -100
v.... |
Explain and rewrite the following Scala code: | /*
* Copyright (C) 2014 - 2019 Dennis Vriend <https://github.com/dnvriend>
* Copyright (C) 2019 - 2021 Lightbend Inc. <https://www.lightbend.com>
*/
package akka.persistence.jdbc.configuration
import akka.persistence.jdbc.SimpleSpec
import akka.persistence.jdbc.util.ConfigOps
import ConfigOps._
import com.typesafe... |
Explain and rewrite the following Scala code: | package scalaz.stream
import org.scalacheck._
import Prop._
import scalaz.std.list._
import scalaz.std.string._
import scalaz.syntax.equal._
import scodec.bits.ByteVector
import Process._
import text._
class Utf8DecodeSpec extends Properties("text.utf8Decode") {
def utf8Bytes(a: Array[Int]): ByteVector = ByteVect... |
Explain and rewrite the following Scala code: | package skinny.controller.feature
import skinny.filter.SkinnySessionFilter
import twitter4j.auth.{ AccessToken, RequestToken }
/**
* SkinnySession wired TwitterLoginFeature.
*/
trait SkinnySessionTwitterLoginFeature extends TwitterLoginFeature { self: SkinnySessionFilter =>
// -----------------------------------... |
Explain and rewrite the following Scala code: | package spark.timeseries
import com.coconut_palm_software.xscalawt.XScalaWT._
import com.coconut_palm_software.xscalawt.XScalaWT.Assignments._
import org.eclipse.swt.layout.GridData
import org.eclipse.swt.SWT
import org.eclipse.swt.layout.GridLayout
import org.eclipse.swt.widgets.Composite
import org.eclipse.swt.widge... |
Explain and rewrite the following Scala code: | package gameover.fwk.libgdx.collection
import gameover.fwk.libgdx.utils.LibGDXHelper
import org.scalatest.FlatSpec
class LibGDXHelperTest extends FlatSpec with LibGDXHelper {
"An empty GDXArray" should "have size 0" in {
val array = new GdxArray[Int]()
assert(array.size == 0)
assert(array.isEmpty)
}
... |
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.automatak.render.dnp3.objects
import com.automatak.render.Indentation
import com.automatak.render.cpp._
import com.automatak.render.dnp3.objects.generators._
object GroupVariation {
case class Id(group: Byte, variation: Byte)
}
/**
* Base trait for DNP3 objects
*/
trait GroupVariation {
import Gr... |
Explain and rewrite the following Scala code: | package com.bala.scala.activoids
class Rectangle extends Shape{
def draw(): Unit = {
println( this.point_x + " "+ this.point_y );
}
}
|
Explain and rewrite the following Scala code: | package org.jetbrains.plugins.dotty.lang.parser.parsing.params
/**
* @author adkozlov
*/
object Params extends org.jetbrains.plugins.scala.lang.parser.parsing.params.Params {
override protected def param = Param
}
|
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.combust.mleap.runtime.transformer.feature
import ml.combust.mleap.core.feature.WordToVectorModel
import ml.combust.mleap.core.types._
import org.scalatest.FunSpec
class WordToVectorSpec extends FunSpec {
describe("input/output schema") {
it("has the correct inputs and outputs") {
val transform... |
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 swe.lifter.microcontroller
import scala.collection.JavaConversions._
import java.net._
import java.io._
import java.util.Date
import org.apache.http.client._
import org.apache.http.client.methods._
import org.apache.http.impl.client._
import scala.actors._
import org.apache.co... |
Explain and rewrite the following Scala code: | /*
* This file is part of the regex 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 applicable law or agreed to ... |
Explain and rewrite the following Scala code: | package io.tabmo.aerospike.data
import scala.util.Try
import com.aerospike.client.{AerospikeException, Record}
case class AerospikeRecord(bins: Map[String, AnyRef], generation: Int, expiration: Int) {
private def get[T](column: String) = bins(column).asInstanceOf[T]
def size = bins.size
def exists(column: S... |
Explain and rewrite the following Scala code: | /*
* LazyValuesTest.scala
* Lazy range computation tests.
*
* Created By: Avi Pfeffer (apfeffer@cra.com)
* Creation Date: Dec 27, 2013
*
* Copyright 2013 Avrom J. Pfeffer and Charles River Analytics, Inc.
* See http://www.cra.com or email figaro@cra.com for information.
*
* See http://www.github.com... |
Explain and rewrite the following Scala code: | package dbtarzan.gui
import dbtarzan.gui.config.connections.ConnectionEditor
import dbtarzan.messages.{ResponseSchemaExtraction, ResponseTestConnection}
class Global extends TGlobal {
private var connectionEditor: Option[ConnectionEditor] = None
def setConnectionEditor(connectionEditor: ConnectionEditor) : Unit =... |
Explain and rewrite the following Scala code: | /*
* Copyright (c) 2013-2014, ARM Limited
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, p... |
Explain and rewrite the following Scala code: | package scribe.message
import scribe.Loggable
import scribe.output.LogOutput
case class StaticMessage[M](value: M)
(implicit loggable: Loggable[M]) extends Message[M] {
override lazy val logOutput: LogOutput = loggable(value)
} |
Explain and rewrite the following Scala code: | /*
* Copyright (C) Lightbend Inc. <https://www.lightbend.com>
*/
package com.lightbend.lagom.javadsl.persistence
import java.util.concurrent.CompletionStage
import java.util.function.BiConsumer
import akka.actor.ActorRef
package object testkit {
implicit class pipe[T](val stage: CompletionStage[T]) extends AnyV... |
Explain and rewrite the following Scala code: | /*
* Copyright 2014–2018 SlamData Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agr... |
Explain and rewrite the following Scala code: | /*
* This file is part of CubeLoader.
* Copyright (c) 2016 - 2017, KitsuneAlex, All rights reserved.
*
* CubeLoader 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 Li... |
Explain and rewrite the following Scala code: | package lila.study
import chess.format.UciCharPair
case class Path(ids: Vector[UciCharPair]) extends AnyVal {
def head: Option[UciCharPair] = ids.headOption
// def tail: Path = Path(ids drop 1)
def parent: Path = Path(ids dropRight 1)
def split: Option[(UciCharPair, Path)] = head.map(_ -> Path(ids.drop(1)... |
Explain and rewrite the following Scala code: | package io.buoyant.grpc.interop
import java.net.InetSocketAddress
import com.twitter.conversions.StorageUnitOps._
import com.twitter.finagle.buoyant.{H2, h2}
import com.twitter.util.Future
import grpc.{testing => pb}
import io.buoyant.test.{BudgetedRetries, FunSuite}
class NetworkedInteropTest extends FunSuite with I... |
Explain and rewrite the following Scala code: | // Copyright: 2010 - 2017 https://github.com/ensime/ensime-server/graphs
// License: http://www.gnu.org/licenses/gpl-3.0.en.html
package org.ensime.core
import scala.tools.nsc.interactive.Global
import org.ensime.indexer._
import org.slf4j.Logger
/**
* Resolves scalac `scala.reflect.internal.Symbols.Symbol` to Java... |
Explain and rewrite the following Scala code: | package controllers
import api.ApiError
import controllers.Stream._
import play.api.data.Form
import play.api.data.Forms._
import play.api.data.validation.ValidationError
import play.api.libs.functional.syntax._
import play.api.libs.json._
import play.api.mvc._
import play.i18n.Messages
import scala.concurrent.Executi... |
Explain and rewrite the following Scala code: | package org.cubefriendly
import java.io.File
import org.cubefriendly.data.Cube
import org.cubefriendly.processors.{DataProcessorProviderImpl, DataProcessorProvider}
import org.cubefriendly.transformers.DimensionToMetricTransformer
import org.specs2.mutable.Specification
import scala.concurrent.Await
import scala.con... |
Explain and rewrite the following Scala code: | package pl.com.bms.fileSynchronizer.fileUploader.ssh
import com.decodified.scalassh.SshClient
import scala.language.implicitConversions
/**
* @author bandrzejczak
* @since 23.03.15
*/
class RichSshClient(val client:SshClient) {
def recursivelyCreatePathIfNotExists(path: String) = client.exec("mkdir -p "+getParen... |
Explain and rewrite the following Scala code: | /*
* Copyright 2016 Baltnet Communications LLC
*
* 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 la... |
Explain and rewrite the following Scala code: | package com.enkidu.lignum.parsers.ast.statement.conditional
import com.enkidu.lignum.parsers.ast.expression.Expression
import com.enkidu.lignum.parsers.ast.statement.Statement
case class If(condition: Expression, ifTrue: Statement) extends ConditionalStatement {
override def dispatch(visitor: Visitor): Unit = {
... |
Explain and rewrite the following Scala code: | /* ---------------------------------------------------------------------
%%
%% Copyright (c) 2007-2014 Basho Technologies, Inc. All Rights Reserved.
%%
%% This file is provided to you under the Apache License,
%% Version 2.0 (the "License"); you may not use this file
%% except in compliance with the License. You may ... |
Explain and rewrite the following Scala code: | package org.antipathy.mvn_scalafmt.io
import java.net.URL
import org.antipathy.mvn_scalafmt.model.RemoteConfig
import org.apache.maven.plugin.logging.Log
import scala.util.{Failure, Success, Try}
/** Class for retrieving a config from a remote location
*
* @param log The maven logger
*/
class RemoteConfigReade... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.