instruction stringclasses 1
value | output stringlengths 5 1M |
|---|---|
Explain and rewrite the following Scala code: | /*
* Copyright (c) 2009-2010 European Molecular Biology Laboratory
*
* 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 versio... |
Explain and rewrite the following Scala code: | package org.brijest.storm.engine
class Client(engine: Engine, ui: UI) {
def awaitTermination() = engine.awaitTermination()
}
|
Explain and rewrite the following Scala code: | package com.rumblesan.scalaexperiments.scalaztypes.rwsmonad
import scalaz._, Scalaz._
case class Config(number: Int)
object ReaderWriterStateExample {
type MyState = List[Int]
type MyLog = List[String]
def getConfigNumber(value: Int): ReaderWriterState[Config, MyLog, MyState, Int] =
ReaderWriterState {
... |
Explain and rewrite the following Scala code: | /* sbt -- Simple Build Tool
* Copyright 2009 Mark Harrah
*/
package xsbt.datatype
sealed trait Definition extends NotNull {
val name: String
}
final class ClassDef(val name: String, val parent: Option[ClassDef], val members: Seq[MemberDef], val isAbstract: Boolean) extends Definition {
def allMembers = members ... |
Explain and rewrite the following Scala code: | package teststate.core
import japgolly.microlibs.name_fn._
import teststate.core.NamedOps.ToOps._
import teststate.data._
import teststate.typeclass.Conditional.Implicits._
import teststate.typeclass.Display.ToOps._
import teststate.typeclass.Profunctor.ToOps._
import teststate.typeclass._
import teststate.{core => ^}... |
Explain and rewrite the following Scala code: | /**
* Licensed to Gravity.com under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. Gravity.com licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this fil... |
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 one.niu.outcome.dag
import java.nio.ByteBuffer
import scala.collection.mutable
/**
* Created by ericfalk on 16/01/2017.
*/
class Node(val isRoot: Boolean = true, val isLeaf:Boolean = false, val level: Int, val symbol: ByteBuffer){
val parents : mutable.HashMap[ByteBuffer,Node] = mutable.HashMap.empty[B... |
Explain and rewrite the following Scala code: | package jp.co.cyberagent.aeromock.server.http.error
import java.io.{PrintWriter, StringWriter}
import java.util.Locale
import io.netty.handler.codec.http.HttpResponseStatus
import jp.co.cyberagent.aeromock._
import jp.co.cyberagent.aeromock.config.MessageManager
import org.yaml.snakeyaml.error.YAMLException
import jp... |
Explain and rewrite the following Scala code: | package com.htc.studio.example.wordcount
import scala.util.Random
import com.twitter.scalding.Args
import com.twitter.summingbird.storm.Storm
import com.htc.studio.summingbird.storm.HTCStormJob
/**
* The demo word count job. The source is a generator that emits random words
* every second.
*
* @author Zhongyang... |
Explain and rewrite the following Scala code: | package com.github.j5ik2o.forseti.adaptor.validator
import java.net.URI
import java.time.ZonedDateTime
import java.util.UUID
import com.github.j5ik2o.forseti.adaptor.handler.flow.code.AuthorizationCodeRequest
import com.github.j5ik2o.forseti.domain._
import com.github.j5ik2o.forseti.domain.client._
import com.github.... |
Explain and rewrite the following Scala code: | package org.jetbrains.plugins.scala.lang.psi
import com.intellij.openapi.application.{ApplicationManager, ApplicationAdapter}
import com.intellij.psi._
import com.intellij.psi.util.PsiTreeUtil
import org.jetbrains.plugins.scala.annotator.intention.ScalaImportTypeFix
import org.jetbrains.plugins.scala.extensions._
impo... |
Explain and rewrite the following Scala code: | package geometry.areas
import org.salgo.geometry.areas.Shoelace
import org.salgo.geometry.structures.Point2D
import org.scalatest.{FunSuite, Matchers}
class ShoelaceSpec extends FunSuite with Matchers {
test("Empty points") { Shoelace.calculateArea(Seq.empty[Point2D]) shouldEqual 0.0}
test("Single point") { Shoel... |
Explain and rewrite the following Scala code: | package nn
import java.nio.file.Files.exists
import java.nio.file.Paths.get
/**
* Created by nm on 08/02/17.
*/
package object conv {
/* Types and data structures */
case class Tile(kernels_per_group: Int = 0,
els_per_thread: Int = 0,
inputTileSize: Int = 0,
... |
Explain and rewrite the following Scala code: | package models.user
import play.api.libs.json.Json
case class LoginResult(successful: Boolean, customerId: Option[Long])
object LoginResult {
implicit val jsonReads = Json.reads[LoginResult]
}
|
Explain and rewrite the following Scala code: | package di
class HelloWorldMessageProvider extends MessageProvider {
override def getMessage: String = {
"Hello World!"
}
} |
Explain and rewrite the following Scala code: | package com.enkidu.lignum.parsers.ast.expression.types.templates
import com.enkidu.lignum.parsers.ast.expression.types.annotations.Annotation
import com.enkidu.lignum.parsers.ast.expression.types.references.ReferenceType
case class AnyBaseClassTemplate(annotations: Seq[Annotation], bound: ReferenceType) extends Bound... |
Explain and rewrite the following Scala code: | package querious
import fastparse.core.Parsed
import fastparse.core.Parsed.Success
import hedgehog._
import hedgehog.runner._
/**
* @author Kevin Lee
* @since 2017-07-22
*/
object BooleanPredicateParserSpec extends Properties {
override def tests: List[Test] = List(
property(
"""Parsers.booleanPred... |
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: | /*
* PriorityQueue.scala
* (FScape)
*
* Copyright (c) 2001-2022 Hanns Holger Rutz. All rights reserved.
*
* This software is published under the GNU Affero General Public License v3+
*
*
* For further information, please contact Hanns Holger Rutz at
* contact@sciss.de
*/
package de.sciss.fscape
packag... |
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: | package org.monalang.monac.common.util
object OptionUtils {
/**
* Perform an action that may throw an exception and wrap the result in an Option
*
* @param action An action that returns a result
* @return None if the action threw an exception, Some(resultOfAction) otherwise
*/
def fromAction[A](act... |
Explain and rewrite the following Scala code: | package io.finch
import cats.Id
import com.twitter.finagle.http.Status
import com.twitter.io.Buf
import java.nio.charset.{Charset, StandardCharsets}
import scala.util.{Failure, Success, Try}
class OutputSpec extends FinchSpec {
behavior of "Output"
it should "propagate status to response" in {
check { o: Ou... |
Explain and rewrite the following Scala code: | package frmr.scyig.db
import java.util.UUID
import net.liftweb.common._
import slick.jdbc.MySQLProfile.api._
trait Scheduleable {
def round: Int
}
case class Match(
id: Option[Int],
competitionId: Int,
prosecutionTeamId: Int,
defenseTeamId: Int,
presidingJudgeId: Int,
scoringJudgeId: Int,
round: Int,... |
Explain and rewrite the following Scala code: | package io.github.katrix.katlib.serializer
import java.lang.{Byte => JByte, Double => JDouble, Float => JFloat, Integer => JInt, Long => JLong, Short => JShort}
import java.util
import scala.collection.JavaConverters._
import scala.util.{Failure, Success, Try}
import org.apache.commons.lang3.math.NumberUtils
import... |
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 geotrellis.config
case class Attributes(tileType: TileType, ingestType: IngestType)
|
Explain and rewrite the following Scala code: | /*
* @author Philip Stutz
*
* Copyright 2011 University of Zurich
*
* 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
*
* U... |
Explain and rewrite the following Scala code: | package is.hail.io.plink
import is.hail.annotations.{Region, RegionValueBuilder}
import is.hail.expr.JSONAnnotationImpex
import is.hail.expr.ir._
import is.hail.expr.ir.lowering.TableStage
import is.hail.types._
import is.hail.types.physical.{PBoolean, PCanonicalArray, PCanonicalCall, PCanonicalLocus, PCanonicalString... |
Explain and rewrite the following Scala code: | package com.seanshubin.concurrency.samples.statemachine
import java.io._
import java.nio.charset.Charset
import scala.annotation.tailrec
object IoUtil {
@tailrec
def feedInputStreamToOutputStream(inputStream: InputStream, outputStream: OutputStream): Unit = {
val byte = inputStream.read()
if (byte != -1)... |
Explain and rewrite the following Scala code: | package se.blea.flexiconf
/** Base trait for argument types */
sealed trait ArgumentKind[T] {
/** Returns true if the value meets the criteria for this type */
def accepts(value: String): Boolean
/** Returns the native value for the provided value */
def valueOf(value: String): ArgumentValue
/** Returns a... |
Explain and rewrite the following Scala code: | package actors
import scala.language.{ postfixOps }
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.{ Await, Future }
import scala.concurrent.duration._
import services.scala.{ Item, ItemService }
import akka.actor._
import akka.pattern.ask
import akka.util.Timeout
import actors.ItemS... |
Explain and rewrite the following Scala code: | /***********************************************************************
* Copyright (c) 2013-2020 Commonwealth Computer Research, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Apache License, Version 2.0
* which accompanies this distribution and... |
Explain and rewrite the following Scala code: | import scala.quoted.*
def qqq(s: String)(using Quotes): Expr[Unit] = '{()}
inline val InlineVal = "i"
inline def InlineDef = "i"
inline def withInlineVal = ${ qqq(InlineVal) }
inline def withInlineDef = ${ qqq(InlineDef) } // error
inline def withString = ${ qqq("i") }
|
Explain and rewrite the following Scala code: | package com.ubirch.util.neo4j.utils
import com.typesafe.scalalogging.slf4j.StrictLogging
import org.joda.time.DateTime
import org.neo4j.driver.v1.Value
/**
* author: cvandrei
* since: 2018-08-08
*/
object Neo4jParseUtil extends StrictLogging {
def asType[T](value: Value, field: String): T = {
val value... |
Explain and rewrite the following Scala code: | object Test {
val f = 0;
({ toString; (x: Any) => x})("$f ")
}
|
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 sbt
package appmacro
import scala.reflect._
import macros._
import scala.tools.nsc.Global
import ContextUtil.{ DynamicDependencyError, DynamicReferenceError }
object ContextUtil {
final val DynamicDependencyError = "Illegal dynamic dependency"
final val DynamicReferenceError = "Illegal dynamic reference"
... |
Explain and rewrite the following Scala code: | package core
object Keys {
private[this] val maxPlayerCount = 4
// zone keys
val deck = 0
val hand = deck + maxPlayerCount
val played = hand + maxPlayerCount
val discard = played + maxPlayerCount
val trash = discard + 1
// stat keys
val playerCount = 0
val activePlayerIndex = playerCount + 1
v... |
Explain and rewrite the following Scala code: | package org.jetbrains.plugins.scala
package lang
package psi
package impl
package base
package patterns
import org.jetbrains.plugins.scala.lang.psi.api.base.patterns._
import org.jetbrains.plugins.scala.lang.psi.ScalaPsiElementImpl
import com.intellij.lang.ASTNode
/**
* @author ilyas
*/
class ScSeqWildcardImpl (... |
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: | /*
* Copyright (C) 2015 Jason Mar
*
* 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 t... |
Explain and rewrite the following Scala code: | /*
* Copyright 2014-2022 Netflix, 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... |
End of preview. Expand in Data Studio
README.md exists but content is empty.
- Downloads last month
- 7