instruction stringclasses 1
value | output stringlengths 5 1M |
|---|---|
Explain and rewrite the following Scala code: | /*
* Copyright (c) 2014 Robert Conrad - All Rights Reserved.
* Unauthorized copying of this file, via any medium is strictly prohibited.
* This file is proprietary and confidential.
* Last modified by rconrad, 12/25/14 10:13 AM
*/
package base.rest.route
import base.common.service.Services
import base.entity.api... |
Explain and rewrite the following Scala code: | package jdub.async
import com.github.mauricio.async.db.RowData
class Row(val rowData: RowData) {
def asOpt[T](s: String) = Option(rowData(s)).map(_.asInstanceOf[T])
def as[T](s: String) = Option(rowData(s)) match {
case None => throw new IllegalArgumentException(s"Column [$s] is null.")
case Some(x) => x... |
Explain and rewrite the following Scala code: | /*
* Copyright 2014 Commonwealth Computer Research, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applica... |
Explain and rewrite the following Scala code: | /**
* Copyright 2015 ICT.
*
* 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
... |
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 ... |
Explain and rewrite the following Scala code: | package com.twitter.finagle.service
import com.twitter.conversions.time._
import com.twitter.finagle.MockTimer
import com.twitter.finagle.stats.{Counter, StatsReceiver, NullStatsReceiver}
import com.twitter.finagle.{Service, Status}
import com.twitter.util.{Future, Time, Promise, Return, Duration, Timer}
import org.ju... |
Explain and rewrite the following Scala code: | // See the LICENCE.txt file distributed with this work for additional
// information regarding copyright ownership.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache... |
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.javac
import akka.event.slf4j.SLF4JLogging
import com.sun.source.tree.Tree
import javax.lang.model.element.Element
import com.sun.tools.javac.tree.JCTree
import com.... |
Explain and rewrite the following Scala code: | package com.sksamuel.elastic4s.json4s
import com.sksamuel.elastic4s.{AggReader, Hit, HitReader, Indexable}
import org.json4s._
import scala.reflect.Manifest
import scala.util.Try
object ElasticJson4s {
object Implicits {
implicit def Json4sHitReader[T](implicit json4s: Serialization, formats: Formats, mf: Man... |
Explain and rewrite the following Scala code: | package dataStructures.trie
/**
* Created by yujieshui on 2016/7/27.
*/
object Contacts {
trait Contact
type Tree = Map[Char, Contact]
object End
case class Next(tree: Tree)
def solution(tree: Tree,findPartial:Seq[Char]) = {
findPartial match {
case head :: other =>
tree.get(head)
... |
Explain and rewrite the following Scala code: | package net.shift
package common
import net.shift.io.{BinProducer, IO}
import scala.io.Source
import scala.util.Try
object StringUtils {
def toInt(s: String): Option[Int] = try {
Some(s.toInt)
} catch {
case e: NumberFormatException => None
}
def toInt(s: String, d: Int): Int = try {
s.toInt
... |
Explain and rewrite the following Scala code: | package org.sisioh.aws4s.s3.model
import com.amazonaws.services.s3.model.{
AccessControlList,
CannedAccessControlList,
InitiateMultipartUploadRequest,
ObjectMetadata
}
import org.sisioh.aws4s.PimpedType
object InitiateMultipartUploadRequestFactory {
def create(bucketName: String, key: String): InitiateMult... |
Explain and rewrite the following Scala code: | /**
* Licensed to Big Data Genomics (BDG) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The BDG licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use ... |
Explain and rewrite the following Scala code: |
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
/** @author John Miller
* @version 1.2
* @date Sun Sep 16 14:09:25 EDT 2012
* @see LICENSE (MIT style license file).
*/
package scalation.linalgebra
import collection.Traversable
import util.Sorting.quickSort
import math... |
Explain and rewrite the following Scala code: | package dnd5_dm_db.html_gen
import dnd5_dm_db._
import dnd5_dm_db.lang._
import dnd5_dm_db.model.{Spell, DnDTime}
object SpellHtmlGen extends ToHtml[Spell]{
type Concentration = Boolean
def optionHL (shl: Option[String])(implicit lang : Lang): String =
shl match {
case Some(str) =>
s"<div><b>... |
Explain and rewrite the following Scala code: | /*
* Copyright 2016 The BigDL Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agr... |
Explain and rewrite the following Scala code: | // goseumdochi: experiments with incarnation
// Copyright 2016 John V. Sichi
//
// 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 skutek.std_effects
import skutek.mwords._ //{Semigroup, SingletonCons}
import skutek.abstraction.{!!, Return}
import skutek.abstraction.effect.Effect
trait Validation[E] extends Effect {
case class Invalid(value: E) extends Operation[Nothing]
def Invalid[X](x: X)(implicit ev: SingletonCons[X, E]): Nothing... |
Explain and rewrite the following Scala code: | /*
* Copyright 2015 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.sksamuel.elastic4s.requests.analyzers
import org.scalatest.matchers.should.Matchers
import org.scalatest.wordspec.AnyWordSpec
class SnowballTokenFilterTest extends AnyWordSpec with TokenFilterApi with Matchers {
"SnowballTokenFilter builder" should {
"set language" in {
snowballTokenFilter("t... |
Explain and rewrite the following Scala code: | package org.apache.spark.ml
import org.apache.spark.ml.classification.{ClassificationModelBuilder, DecisionTreeClassificationModel, LinearSVCModel, LogisticRegressionModel, NaiveBayesModel}
import org.apache.spark.ml.linalg.{Matrix, Vector}
import org.apache.spark.ml.regression.{DecisionTreeRegressionModel, Generalize... |
Explain and rewrite the following Scala code: | package at.ac.tuwien.math
import java.io.Reader
import org.apache.lucene.analysis.Analyzer.TokenStreamComponents
import org.apache.lucene.analysis.core.{LowerCaseFilter, StopAnalyzer, StopFilter}
import org.apache.lucene.analysis.en.EnglishMinimalStemFilter
import org.apache.lucene.analysis.standard.StandardTokenizer... |
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: | /*
* 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.example
import akka.actor.{ActorSystem, Props}
import akka.io.IO
import spray.can.Http
object WebApp extends App {
implicit val system = ActorSystem()
val handler = system.actorOf(Props[ExampleServiceActor], name = "example-service")
IO(Http) ! Http.Bind(handler, interface = "0.0.0.0", port = 8080... |
Explain and rewrite the following Scala code: | package alpha_rename
import exceptions.ICE
import generators.VariableGenerator
import scala.collection.mutable.HashMap
import tir._
import tpass.TTypeEnvUnitPass
/* Note that this walk does not mandate reaching the definition before the
* use of a variable. This is achieved with two walks of the tree.
*
* The ass... |
Explain and rewrite the following Scala code: | package com.arcusys.valamis.persistence.common
import java.sql.{Connection, SQLException}
import javax.sql.DataSource
import slick.driver.{JdbcDriver, JdbcProfile}
class SlickDBInfoLiferayImpl(dataSource: DataSource) extends SlickDBInfo {
lazy val slickDriver = getSlickDriver(dataSource)
lazy val slickProfile: ... |
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: | package dotty.tools
package dotc
package core
import Types._, Contexts._, Symbols._, Decorators._
import util.Property
/** A utility module to produce match type reduction traces in error messages.
*/
object MatchTypeTrace:
private enum TraceEntry:
case TryReduce(scrut: Type)
case NoMatches(scrut: Type, c... |
Explain and rewrite the following Scala code: | /*
* Copyright 2014–2018 SlamData Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agr... |
Explain and rewrite the following Scala code: | package aecor.schedule
import java.time.LocalDateTime
import java.util.UUID
import aecor.data._
import aecor.runtime.akkapersistence.readside.{ CommittableEventJournalQuery, JournalEntry }
import aecor.util.Clock
import akka.NotUsed
import akka.stream.scaladsl.Source
import cats.effect.Effect
import cats.implicits._
... |
Explain and rewrite the following Scala code: | package org.jetbrains.sbt
package project
import java.io.File
import com.intellij.openapi.externalSystem.model.project.{ProjectData => ESProjectData, _}
import com.intellij.openapi.externalSystem.model.task.{ExternalSystemTaskId, ExternalSystemTaskNotificationListener}
import com.intellij.openapi.externalSystem.model... |
Explain and rewrite the following Scala code: | package com.janrain.akka.zk.example
import concurrent._, duration._
import akka.actor.{Props, ActorSystem, ActorLogging, Actor}
import com.janrain.akka.zk.{ZkConfigExtension, DefaultDataUnmarshallers}
object ZkConfigExample extends App {
case object Poke
class ZkConfigExampleActor extends Actor with ActorLogging... |
Explain and rewrite the following Scala code: | package uk.co.bitcat.streaming.flink.watermark
import org.apache.flink.streaming.api.functions.timestamps.BoundedOutOfOrdernessTimestampExtractor
import org.apache.flink.streaming.api.windowing.time.Time
import uk.co.bitcat.streaming.flink.domain.Measurement
class TwoSecondDelayWatermark extends BoundedOutOfOrderness... |
Explain and rewrite the following Scala code: | /*
* Copyright 2016 The BigDL Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agr... |
Explain and rewrite the following Scala code: | package effectful.examples
import cats._
import cats.data._
import cats.std._
import cats.std.list._
import effectful._
import effectful.examples.adapter.akka._
import effectful.examples.adapter.jdbc.JdbcSqlDriver
import effectful.examples.adapter.cats.writer._
import effectful.examples.pure.uuid.impl.JavaUUIDs
import... |
Explain and rewrite the following Scala code: | package net.shiroka.tools.ofx.conversions
import java.io._
import scala.io.Source
import scala.util.control.Exception.allCatch
import org.joda.time._
import org.joda.time.format._
import com.github.tototoshi.csv._
import com.typesafe.config.Config
import net.shiroka.tools.ofx._
import implicits.Tapper
import Transacti... |
Explain and rewrite the following Scala code: | package ml.sparkling.graph.loaders.csv.providers
import ml.sparkling.graph.loaders.csv.types.Types
import ml.sparkling.graph.loaders.csv.types.Types.ToVertexId
import ml.sparkling.graph.loaders.csv.utils.DefaultTransformers
import org.apache.spark.graphx.VertexId
import org.apache.spark.sql.Row
/**
* Created by Roma... |
Explain and rewrite the following Scala code: | package clasp.core.sdktools
import akka.actor.ActorSystem
import scala.language.postfixOps
import scala.sys.process.Process
import scala.sys.process.stringToProcess
import scala.sys.process.ProcessLogger
import sdk_config.log.info
import java.nio.file.Files
import java.nio.file.Paths
import clasp.core.EmulatorActor
im... |
Explain and rewrite the following Scala code: | package se.lu.nateko.cp.meta.services.sparql.magic.fusion
import se.lu.nateko.cp.meta.services.sparql.index.DobjUri
import org.eclipse.rdf4j.query.algebra.SingletonSet
import org.eclipse.rdf4j.query.algebra.BinaryTupleOperator
import org.eclipse.rdf4j.query.algebra.TupleExpr
import org.eclipse.rdf4j.query.algebra.Slic... |
Explain and rewrite the following Scala code: | package vonsim.simulator
sealed class UnaryOperand
sealed trait WordOperand extends UnaryOperand
sealed trait DWordOperand extends UnaryOperand
class UnaryOperandUpdatable extends UnaryOperand
class MemoryOperand extends UnaryOperandUpdatable
trait DirectMemoryAddressOperand extends MemoryOperand{
def asDWord... |
Explain and rewrite the following Scala code: | package com.greencatsoft.angularjs.core
import scala.scalajs.js
import com.greencatsoft.angularjs.injectable
@js.native
@injectable("$animate")
trait Animate extends js.Object {
def enter(element: js.Object, parent: js.Object, after: js.Object, done: js.Function = null): Unit = js.native
def leave(element: js.... |
Explain and rewrite the following Scala code: | package controllers
import play.api.mvc._
import model._
import play.api.libs.json._
object js_formats{
implicit val clickFormat = Json.format[Click]
implicit val userFormat = Json.format[User]
implicit val folderFormat = Json.format[Folder]
implicit val linkFormat = Json.format[Link]
}
object Applicati... |
Explain and rewrite the following Scala code: | package specification
import _root_.java.util.Date
class Itinerary(val id: String, val departureDate: Date, val duration: Int, val origin: Airport, val destination: Airport, val segments: Seq[Segment], val price: Int) {
/*
An itinerary is a series of segments of flights. It is the final entity passen... |
Explain and rewrite the following Scala code: | package net.ruippeixotog.scalafbp.component.ppl.stat
import akka.actor.Props
import spray.json.JsNumber
import net.ruippeixotog.scalafbp.component._
import net.ruippeixotog.scalafbp.thinkbayes.Implicits._
import net.ruippeixotog.scalafbp.thinkbayes.PVar
case object Mean extends Component {
val name = "ppl/stat/Mea... |
Explain and rewrite the following Scala code: | /**
* Copyright 2011-2016 GatlingCorp (http://gatling.io)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by appli... |
Explain and rewrite the following Scala code: | package model
import java.net.ConnectException
import java.util.Date
import com.amazonaws.services.ec2.model.{DescribeInstancesRequest, Instance => AwsEc2Instance}
import lib._
import play.api.Logger
import play.api.cache.SyncCacheApi
import play.api.libs.json.Json
import play.api.libs.ws.{WSClient, WSResponse}
impo... |
Explain and rewrite the following Scala code: | package org.jetbrains.plugins.scala
package debugger
package evaluation
package evaluator
import java.{lang => jl}
import com.intellij.debugger.engine.evaluation.{EvaluationContextImpl, expression}
import com.sun.jdi.Value
import org.jetbrains.plugins.scala.lang.psi.api.base.ScLiteral
import org.jetbrains.plugins.sca... |
Explain and rewrite the following Scala code: | package test.templates {
object `package` {
/** @template */
type String = java.lang.String
val String = new StringCompanion
class StringCompanion { def boo = ??? }
}
/** @contentDiagram */
trait Base {
/** @documentable */
type String = test.templates.String
/** @template
* @i... |
Explain and rewrite the following Scala code: | package com.criteo.dev.cluster
import com.criteo.dev.cluster.command.{SshHiveAction, SshMultiAction}
import com.criteo.dev.cluster.docker._
import com.criteo.dev.cluster.utils.test.LoadConfig
import org.scalatest.{BeforeAndAfter, FunSuite}
/**
* This class spawns some local dev cluster and runs all the operations o... |
Explain and rewrite the following Scala code: | package com.mentatlabs.nsa
package scalac
package options
/* -Yrangepos
* ==========
* 2.8.0 - 2.12.0: Use range positions for syntax trees.
*/
case object ScalacYRangepos
extends ScalacOptionBoolean("-Yrangepos", ScalacVersions.`2.8.0`)
|
Explain and rewrite the following Scala code: | package com.twitter.finagle.tracing
/**
* This is a tracing system similar to Dapper:
*
* “Dapper, a Large-Scale Distributed Systems Tracing Infrastructure”,
* Benjamin H. Sigelman, Luiz André Barroso, Mike Burrows, Pat
* Stephenson, Manoj Plakal, Donald Beaver, Saul Jaspan, Chandan
* Shanbhag, 2010.
*
... |
Explain and rewrite the following Scala code: | package com.twitter.scrooge.benchmark
import com.twitter.scrooge.ThriftStructCodec
import java.io.ByteArrayOutputStream
import java.util.concurrent.TimeUnit
import java.util.Random
import org.apache.thrift.protocol.{ TProtocol, TBinaryProtocol }
import org.apache.thrift.transport.TTransport
import org.openjdk.jmh.anno... |
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: | /**
* 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"); yo... |
Explain and rewrite the following Scala code: | package nmcb.chronos
import org.scalatest.{Matchers, FlatSpec}
class CalculatorTest extends FlatSpec with Matchers {
"the calculator" should "parse operators" in {
Calculator.parse("1*2") should be(BiOp("*", Val(1), Val(2)))
Calculator.parse("1/2") should be(BiOp("/", Val(1), Val(2)))
Calculator.pars... |
Explain and rewrite the following Scala code: | package com.codiply.barrio.neighbors
import scala.concurrent.duration._
import scala.concurrent.Future
import akka.actor.Actor
import akka.actor.ActorLogging
import akka.actor.ActorRef
import akka.actor.Actor.Receive
import akka.actor.Props
import akka.pattern.ask
import akka.util.Timeout
import com.github.blemale.sca... |
Explain and rewrite the following Scala code: | package com.arcusys.valamis.web.servlet.content
import com.arcusys.learn.liferay.util.PortletName
import com.arcusys.valamis.web.portlet.base.{Permission, ModifyPermission, ViewPermission}
import com.arcusys.valamis.web.servlet.base.PermissionUtil
import org.scalatra.ScalatraBase
/**
* Created by mminin on 14.10.15.... |
Explain and rewrite the following Scala code: | package com.twitter.finagle.memcached.unit.protocol.text.server
import com.twitter.conversions.time._
import com.twitter.io.Charsets
import com.twitter.finagle.memcached.protocol.text.server.DecodingToCommand
import com.twitter.finagle.memcached.protocol.text.{Tokens, TokensWithData}
import com.twitter.finagle.memcach... |
Explain and rewrite the following Scala code: | package mesosphere.marathon.core.appinfo
import mesosphere.marathon.core.task.Task
import mesosphere.marathon.test.Mockito
import mesosphere.marathon.{ MarathonTestHelper, MarathonSpec, Protos }
import mesosphere.marathon.core.base.ConstantClock
import mesosphere.marathon.state.Timestamp
import org.scalatest.{ GivenWh... |
Explain and rewrite the following Scala code: | package enumeratum
/** An Enum that has a lot of the Play-related implicits built-in so you can avoid boilerplate.
*
* Note, the binders created here transform to upper case.
*
* Things included are:
*
* - implicit JSON format
* - implicit PathBindable (for binding from request path)
* - implicit... |
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) 2016 eBay Software Foundation.
*
* 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... |
Explain and rewrite the following Scala code: | package effectful.examples.adapter.writer
import java.time.Instant
import effectful.examples.effects.logging.Logger
class WriterLogger(name: String) extends Logger[LogWriter] {
override def trace(message: =>String): LogWriter[Unit] =
LogWriter(LogEntry(name,LogLevel.Trace,message,None,Instant.now()) :: Nil,())
... |
Explain and rewrite the following Scala code: | package org.jetbrains.plugins.scala
package lang
package psi
package api
package statements
import com.intellij.psi.PsiElement
import com.intellij.psi.tree.IElementType
import javax.swing.Icon
import org.jetbrains.plugins.scala.icons.Icons
import org.jetbrains.plugins.scala.lang.lexer.ScalaTokenTypes.kVAL
import org.j... |
Explain and rewrite the following Scala code: | package com.arcusys.learn.models.request
import java.util.UUID
import com.arcusys.learn.models.request.GradebookActionType._
import com.arcusys.learn.service.AntiSamyHelper
import com.arcusys.valamis.gradebook.model.GradebookUserSortBy
import com.arcusys.valamis.web.servlet.base.PermissionUtil
import com.arcusys.vala... |
Explain and rewrite the following Scala code: | package org.jetbrains.plugins.scala.testingSupport.test.ui
import java.awt.Component
import com.intellij.uiDesigner.core.{GridConstraints, GridLayoutManager}
import com.intellij.util.ui.JBUI
import javax.swing.{JComponent, JPanel}
private class GridUiBuilder(panel: JPanel, val columns: Int) {
private var _rowIdx =... |
Explain and rewrite the following Scala code: | package org.moe.runtime
/**
* TODO:
* Need to hook up these classes with
* their runtime counterparts, when
* we actually have them that is.
* - SL
*/
object MoeErrors {
class MoeException (msg: String) extends Exception(msg)
class MoeMoney (msg: String) extends MoeException(msg)
// ... |
Explain and rewrite the following Scala code: | /***
* Copyright 2016 Rackspace US, 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 applica... |
Explain and rewrite the following Scala code: | /*
* AutoView.scala
* (GUIFlitz)
*
* Copyright (c) 2013-2021 Hanns Holger Rutz. All rights reserved.
*
* This software is published under the GNU Lesser General Public License v2.1+
*
* For further information, please contact Hanns Holger Rutz at
* contact@sciss.de
*/
package de.sciss.guiflitz
import ... |
Explain and rewrite the following Scala code: | package execution.engine.it
import engine.api.EngineContext
/**
* Integration Test for End to End test
*/
class JobExecutionIT {
// This Integration Test, reads 2 distinct file, having them as Inputs for the Job, and applies a MapReduce Implementation, writing to an output
// define output
val context =... |
Explain and rewrite the following Scala code: | package io.github.ptitjes.scott.decoders
import io.github.ptitjes.scott.api.HiddenMarkovModel._
import io.github.ptitjes.scott.api._
import io.github.ptitjes.scott.decoders.arrays._
import io.github.ptitjes.scott.utils.Utils._
import io.github.ptitjes.scott.utils.{DepthCounter, States}
import scala.annotation.tailrec... |
Explain and rewrite the following Scala code: | package hclu.hreg.service.user
import java.util.UUID
import hclu.hreg.common.{Clock, Utils}
import hclu.hreg.dao.UserDao
import hclu.hreg.domain.User
import hclu.hreg.service.model.UserJson
import hclu.hreg.service.email.EmailService
import hclu.hreg.service.templates.EmailTemplatingEngine
import scala.concurrent.{E... |
Explain and rewrite the following Scala code: | import scala.quoted.*
class C(using q: Quotes)(i: Int = 1, f: q.reflect.Flags = q.reflect.Flags.EmptyFlags)
def test1a(using q: Quotes) = new C() // error
def test2a(using q: Quotes) = new C(1) // error
def test3a(using q: Quotes) = new C(1, q.reflect.Flags.Lazy) ... |
Explain and rewrite the following Scala code: | /*
* Copyright 2016 The BigDL Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agr... |
Explain and rewrite the following Scala code: | package breeze.numerics
import breeze.generic.UFunc
/*
Copyright 2012 David Hall
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 dotty.tools.dotc
package core
import Symbols._, Types._, Contexts._, Constants._
import dotty.tools.dotc.ast.tpd, tpd.*
import util.Spans.Span
import printing.{Showable, Printer}
import printing.Texts.Text
import annotation.internal.sharable
object Annotations {
def annotClass(tree: Tree)(using Context) =
... |
Explain and rewrite the following Scala code: | package com.scalableQuality.quick.core.fileComponentDescriptions
import com.scalableQuality.quick.mantle.parsing.{LiteralDelimiter, RawRow}
import org.scalatest.prop.GeneratorDrivenPropertyChecks
import org.scalatest.{FlatSpec, Matchers}
class OrderedRowDescriptionTest
extends FlatSpec
with Matchers
with ... |
Explain and rewrite the following Scala code: | /*
* DigiSSHD - DigiControl component for Android Platform
* Copyright (c) 2012, Alexey Aksenov ezh@ezh.msk.ru. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public ... |
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: | package controllers.circs.report_changes
import org.specs2.mutable._
import play.api.test.FakeRequest
import models.domain.MockForm
import utils.pageobjects.circumstances.report_changes.GEmploymentPensionExpensesPage
import utils.pageobjects.circumstances.start_of_process.GCircsYourDetailsPage
import utils.{WithApplic... |
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: 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.event.slf4j.SLF4JLogging
import com.sun.source.util.TreePath
import java.io.File
import javax.lang.model.element.Element
import org.ensime.api._
imp... |
Explain and rewrite the following Scala code: | package com.twitter.finagle.memcached.protocol.text
import com.twitter.io.Buf
import scala.collection.mutable
private[memcached] trait FrameDecoder[Result] {
/**
* Return the number of raw bytes needed, or -1 if a text line is needed.
* @note If a text line is needed, it is expected both a complete line and
... |
Explain and rewrite the following Scala code: | package org.pinky.representation
import _root_.javax.servlet.ServletContext
import java.io.{File, OutputStream}
import org.mockito.Mockito._
import org.scalatest.Spec
import org.scalatest.matchers.ShouldMatchers
/**
* Created by IntelliJ IDEA.
* User: phausel
* Date: Jan 21, 2009
* Time: 2:04:33 PM
* To change ... |
Explain and rewrite the following Scala code: | package com.twitter.finagle.serverset2
import com.twitter.app.GlobalFlag
import com.twitter.conversions.time._
import com.twitter.finagle.{Addr, InetResolver, Resolver}
import com.twitter.finagle.stats.{DefaultStatsReceiver, StatsReceiver}
import com.twitter.finagle.util.DefaultTimer
import com.twitter.util.{Activity,... |
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 org.scalaide.debug.internal.model
import java.util.concurrent.CountDownLatch
import java.util.concurrent.TimeUnit
import scala.collection.JavaConverters.seqAsJavaListConverter
import org.junit.After
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
impo... |
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: | package com.github.pedrovgs.kuronometer.free.interpreter
import cats.{Id, ~>}
import com.github.pedrovgs.kuronometer.app.KuronometerProgram
import com.github.pedrovgs.kuronometer.free.algebra.{ReporterOp, ViewOp}
class Interpreters(implicit reporterInterpreter: (ReporterOp ~> Id),
viewInterpreter: ... |
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 n... |
Explain and rewrite the following Scala code: | package im.actor.server.api.rpc.service.groups
object PushTexts {
val TitleChanged = "Group title changed"
}
|
Explain and rewrite the following Scala code: | /*
* Copyright 2016 agido 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 applicable law or agreed to i... |
Explain and rewrite the following Scala code: | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... |
Explain and rewrite the following Scala code: | package util
import java.io.File
import com.typesafe.config.{Config => TConfig, ConfigFactory}
import net.ceedubs.ficus.Ficus._
/**
* Created by nakayama.
* @author Nakayama
*/
object SentenceUnitReconstructorConfig {
final private[this] var config: TConfig = ConfigFactory.load()
def set(configFile: File)... |
Explain and rewrite the following Scala code: | package net.ruippeixotog.scalascraper.dsl
import net.ruippeixotog.scalascraper.model._
import net.ruippeixotog.scalascraper.scraper.ContentExtractors._
import net.ruippeixotog.scalascraper.scraper.{HtmlExtractor, PolyHtmlExtractor}
trait ImplicitConversions {
implicit def cssQueryAsExtractor[E <: Element](cssQuery... |
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.