instruction stringclasses 1
value | output stringlengths 5 1M |
|---|---|
Explain and rewrite the following Scala code: | package cache.models
import git.{PullRequestPair, PairwiseList}
import scala.concurrent.Future
class EmptyPairwiseList extends PairwiseList {
override def get: List[Future[PullRequestPair]] = List()
}
|
Explain and rewrite the following Scala code: | /**
* CPSTextInterpreter - parses and interprets the CPSText DSL.
* Copyright (C) 2011 Max Leuthaeuser
*
* 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 Licen... |
Explain and rewrite the following Scala code: | package edu.gemini.phase2.template.factory.impl.gmos
import edu.gemini.pot.sp.ISPObservation
import edu.gemini.spModel.template.SpBlueprint
import edu.gemini.phase2.template.factory.impl.ObservationEditor
import edu.gemini.spModel.gemini.gmos.{SeqConfigGmosSouth, GmosSouthType, InstGmosSouth}
import edu.gemini.spModel... |
Explain and rewrite the following Scala code: | package com.wavesplatform.api.http.requests
import com.wavesplatform.account.PublicKey
import com.wavesplatform.lang.ValidationError
import com.wavesplatform.state.DataEntry
import com.wavesplatform.transaction.{DataTransaction, Proofs}
import play.api.libs.json.{Format, Json}
object DataRequest {
implicit val unsi... |
Explain and rewrite the following Scala code: | package dotty.tools.dotc
package transform
import core._
import TreeTransforms._
import dotty.tools.dotc.ast.tpd._
import dotty.tools.dotc.core.Contexts.Context
import dotty.tools.dotc.core.StdNames._
import Phases._
import ast._
import Trees._
import Flags._
import SymUtils._
import Symbols._
import SymDenotations._
... |
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: | /*
* The MIT License (MIT)
*
* Copyright (c) 2016 Algolia
* http://www.algolia.com/
*
* 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... |
Explain and rewrite the following Scala code: | package dnd5_dm_db
package model
sealed abstract class Size
case object Tiny extends Size
case object Small extends Size
case object Medium extends Size
case object Large extends Size
case object Huge extends Size
case object Gargantuan extends Size
object Size {
def fromString(str : String) : Size =
str match {
... |
Explain and rewrite the following Scala code: | object HighOrderFunctions {
def cube(a: Int) = a * a * a
def factorial(a: Int) = {
def factorialAcc(a: Int, acc: Int): Int = if(a == 1) acc else factorialAcc(a - 1, a * acc)
factorialAcc(a, 1)
}
def sum(list: List[Int]): Int = {
def sumAccumulator(list: List[Int], acc: Int): Int = if(list.isEmpt... |
Explain and rewrite the following Scala code: | package com.company
case class Brand(
brand_code:Int,
brand_name:String,
brand_variant:String,
adv_parent_code:Int,
adv_subsid_code:Int)
|
Explain and rewrite the following Scala code: | package lila.lobby
import chess.{ Mode, Clock, Speed }
import org.joda.time.DateTime
import ornicar.scalalib.Random
import play.api.libs.json._
import actorApi.LobbyUser
import lila.common.PimpedJson._
import lila.game.PerfPicker
import lila.rating.RatingRange
import lila.user.{ User, Perfs }
// realtime chess, vola... |
Explain and rewrite the following Scala code: | package org.nexbook.tools.fixordergenerator.utils
import scala.util.Random
/**
* Created by milczu on 16.12.14.
*/
object RandomUtils {
/**
* @param start inclusive
* @param end inclusive
*/
def random(start: Int, end: Int): Int = Random.nextInt(end - start + 1) + start
def weightedRandom[T](list: List... |
Explain and rewrite the following Scala code: | package org.scalacheck.ops.time
import java.time.{Clock, Duration, LocalTime}
import org.scalacheck.Gen
trait JavaLocalTimeGenerators extends AbstractTimeGenerators {
override type InstantType = LocalTime
override type DurationType = Duration
override type ParamsType = Clock
override val defaultParams: Cloc... |
Explain and rewrite the following Scala code: | package reactivemongo.api
object `package` {
type SerializationPackObject = SerializationPack with Singleton
} |
Explain and rewrite the following Scala code: | import util.Random
import java.io._
class Background(matrix: Array[Array[Double]], mask: Array[Array[Boolean]] = null, maskthresh: Double = 0.0,
bw: Int = 64, bh: Int = 64, fw: Int = 3, fh: Int = 3, fthresh: Double = 0.0) {
/**Macro definitions from sep.h*/
val SEP_TBYTE: Int = 11
val SEP_TINT: ... |
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 models
import anorm.{ RowParser, SQL }
import anorm.SqlParser.{ double, long, str }
import anorm.ResultSetParser
import anorm.SqlQuery
import anorm.~
import play.api.Play.current
import play.api.db.DB
case class SosFeatureDB(
identifier: String,
xmltext: String)
object SosFeatureDB {
... |
Explain and rewrite the following Scala code: | package uk.gov.gds.common.audit
import org.joda.time.DateTime
import org.joda.time.format.DateTimeFormat
case class AuditEvent(auditType: String,
uniqueTagIds: List[String],
tags: Map[String, String],
detail: Map[String, String],
... |
Explain and rewrite the following Scala code: | package com.twitter.util
import scala.collection.mutable
import org.specs.SpecificationWithJUnit
import com.twitter.conversions.time._
class PoolSpec extends SpecificationWithJUnit {
"SimplePool" should {
"with a simple queue of items" >> {
"it reseves items in FIFO order" in {
val queue = new mut... |
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 provingground.translation
import scala.util.Try
/**
* Abstraction (as a type class) of a language for mathematical expressions, i.e., of
*
* * methods for forming expressions,
* * some basic expressions such as true, false, numbers etc.
*
* Expression include functions and propositions.
* Howeve... |
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: | /*
* Copyright (C) 2017 LREN CHUV for Human Brain Project
*
* This program 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 version... |
Explain and rewrite the following Scala code: | /**
* Copyright 2015 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 agreed ... |
Explain and rewrite the following Scala code: | /**
* Copyright (C) 2016 Verizon. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law o... |
Explain and rewrite the following Scala code: | package me.fornever.githublo.github
import scala.collection.JavaConversions._
import org.eclipse.egit.github.core.service.IssueService
class IssueImporter(owner: String, repo: String) {
def loadIssues(): Stream[Issue] = {
val service = new IssueService()
val issues = service.getIssues(owner, repo, null)
... |
Explain and rewrite the following Scala code: | import java.io.{FileOutputStream, FileInputStream}
import scala.tools.asm.{ClassWriter, Opcodes, ClassReader}
import scala.tools.asm.tree.{InsnNode, ClassNode}
import scala.tools.nsc.backend.jvm.AsmUtils
import scala.tools.partest.DirectTest
import scala.jdk.CollectionConverters._
/**
* Test that the ICodeReader doe... |
Explain and rewrite the following Scala code: | // Copyright (C) 2014 Fehmi Can Saglam (@fehmicans) and contributors.
// 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 Licen... |
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: | package org.sisioh.aws4s.dynamodb.model
import com.amazonaws.services.dynamodbv2.model.{ AttributeValue, ConsumedCapacity, QueryResult }
import org.sisioh.aws4s.PimpedType
import scala.collection.JavaConverters._
object QueryResultFactory {
def create(): QueryResult = new QueryResult()
}
class RichQueryResult(v... |
Explain and rewrite the following Scala code: | package cpup.mc.oldenMagic.content.runes
import cpw.mods.fml.relauncher.{Side, SideOnly}
import net.minecraft.util.IIcon
import cpup.mc.oldenMagic.OldenMagicMod
import cpup.mc.lib.util.pos.BlockPos
import net.minecraft.entity.{EntityAgeable, Entity}
import cpup.mc.oldenMagic.api.oldenLanguage.runeParsing.TVerbRune
imp... |
Explain and rewrite the following Scala code: | package test
// Cats Xor, Scalaz \\/, scala.util.Either
sealed abstract class Xor[+A, +B] extends Product with Serializable
object Xor {
final case class Left[+A](a: A) extends (A Xor Nothing)
final case class Right[+B](b: B) extends (Nothing Xor B)
}
object TestXor {
import Xor._
def meh[F[_], A, B](fa: F[A]... |
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: | /*
* 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) 2011-2015 ScalaMock Contributors (https://github.com/paulbutcher/ScalaMock/graphs/contributors)
//
// 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, inc... |
Explain and rewrite the following Scala code: | package util
import org.eclipse.jgit.api.Git
import util.Directory._
import util.StringUtil._
import util.ControlUtil._
import scala.annotation.tailrec
import scala.collection.JavaConverters._
import org.eclipse.jgit.lib._
import org.eclipse.jgit.revwalk._
import org.eclipse.jgit.revwalk.filter._
import org.eclipse.jg... |
Explain and rewrite the following Scala code: | import sbt._
import sbt.Keys._
import sbtbuildinfo.Plugin._
import sbtrelease.Version
object SbtBuildInfo {
val shortVersion = SettingKey[String]("short-version")
def buildSettings(targetPackage: String = "") = buildInfoSettings ++ Seq(
sourceGenerators in Compile <+= buildInfo,
buildInfoPackage := target... |
Explain and rewrite the following Scala code: | /*
* Licensed to Metamarkets Group Inc. (Metamarkets) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. Metamarkets licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); ... |
Explain and rewrite the following Scala code: | package com.textteaser.summarizer
import net.codingwell.scalaguice.InjectorExtensions.ScalaInjector
import com.google.inject.Guice
import com.textteaser.summarizer.models.Keyword
import org.slf4j._
import scala.io.StdIn
object SimpleREPL extends App {
val config = new Config { override def lang = "ES" }
val guic... |
Explain and rewrite the following Scala code: | package com.amarjanica.discourse
package object api {
implicit class RichString(s: String) {
import BaseHttpClient._
def asEither[L, R](implicit mL: Manifest[L], mR: Manifest[R]): Either[L, R] = try {
Right(fromJson[R](s, mR.runtimeClass.asInstanceOf[Class[R]]))
} catch {
case e: Exception ... |
Explain and rewrite the following Scala code: | /***********************************************************************
* Copyright (c) 2013-2016 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 is ... |
Explain and rewrite the following Scala code: | package org.locationtech.geomesa.feature
import java.io._
import java.text.SimpleDateFormat
import java.util.UUID
import com.vividsolutions.jts.geom.{LineString, Point, Polygon}
import org.apache.avro.io.DecoderFactory
import org.geotools.data.DataUtilities
import org.geotools.filter.identity.FeatureIdImpl
import org... |
Explain and rewrite the following Scala code: | import collection.immutable.HashMap
class B[+T] {
def foo[Z >: T](x: Z): (B[T], Z) = new B[T] -> x
}
/*start*/((new B).foo(1), (new HashMap).+((1, 2)))/*end*/
//((B[Nothing], Int), HashMap[Int, Int]) |
Explain and rewrite the following Scala code: | /**
* Copyright 2015 Mohiva Organisation (license at mohiva dot com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless req... |
Explain and rewrite the following Scala code: | /*
* 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.lanyard.dist.cont
import org.lanyard.dist.Distribution
import org.lanyard.random.RNG
import org.lanyard.util.LogGamma
/** The Chi-squared distribution is a continuous probability
* distribution. It distributes the sum of squares of k independent
* standard normal random variables.
*
* @constructo... |
Explain and rewrite the following Scala code: | package eventstore
object SystemEventType {
val streamDeleted = "$streamDeleted"
val statsCollection = "$statsCollected"
val linkTo = "$>"
val metadata = "$metadata"
val userCreated = "$UserCreated"
val userUpdated = "$UserUpdated"
val passwordChanged = "$PasswordChanged"
} |
Explain and rewrite the following Scala code: | /*
* Licensed to Metamarkets Group Inc. (Metamarkets) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. Metamarkets licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); ... |
Explain and rewrite the following Scala code: | package com.criteo.dev.cluster.s3
import com.criteo.dev.cluster.{CliAction, Public}
import com.criteo.dev.cluster.aws.{AwsConstants, AwsUtilities}
import com.criteo.dev.cluster.config.GlobalConfig
import org.jclouds.s3.domain.CannedAccessPolicy
import org.jclouds.s3.options.PutBucketOptions
import org.slf4j.LoggerFact... |
Explain and rewrite the following Scala code: | //@
package xyz.hyperreal.bvm
import scala.collection.immutable.{ArraySeq, TreeMap}
import scala.collection.mutable
import scala.collection.mutable.{ArrayBuffer, ListBuffer}
import scala.util.parsing.input.Position
class Compiler(constants: Map[String, Any],
sysvars: Map[String, VM => Any],
... |
Explain and rewrite the following Scala code: | /*
Copyright 2015 - Thamir Qadah
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 wri... |
Explain and rewrite the following Scala code: | /*
* Copyright 2012 The SIRIS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applica... |
Explain and rewrite the following Scala code: | package com.lateralthoughts.points.controllers.handlers
import com.lateralthoughts.points.model._
import org.scalatra.{BadRequest, InternalServerError, NotFound, NotImplemented}
/**
* Converter from Application Error to HTML Error
*/
trait HandlingError {
def buildErrorResponse(error: ApplicationError) = error... |
Explain and rewrite the following Scala code: | package com.socrata.balboa.metrics.data.impl
import java.{util => ju}
import com.socrata.balboa.metrics.Metric.RecordType
import com.socrata.balboa.metrics.data.{DateRange, Period, QueryOptimizer}
import com.socrata.balboa.metrics.{Metric, Metrics, Timeslice}
import com.typesafe.scalalogging.StrictLogging
import sca... |
Explain and rewrite the following Scala code: | case class Matrix(matrix: String) {
lazy val rows: Vector[Vector[Int]] = matrix.lines.map(_.split(' ').map(_.toInt).toVector).toVector
lazy val cols: Vector[Vector[Int]] = rows.transpose
}
|
Explain and rewrite the following Scala code: | package com.fustigatedcat.heystk.engine.normalization
import java.io.ByteArrayInputStream
import java.util.zip.GZIPInputStream
import com.fustigatedcat.heystk.common.normalization.Normalization
import com.fustigatedcat.heystk.engine.queue.RabbitQueue
import org.apache.commons.codec.binary.Base64
import org.apache.com... |
Explain and rewrite the following Scala code: | package chat.tox.antox.av
import android.util.Log
object CallManager {
val TAG = "chat.tox.antox.av.CallManager"
}
class CallManager {
private var _calls: Map[Integer, Call] = Map[Integer, Call]()
def add(c: Call) = {
Log.d(CallManager.TAG, "Adding call")
_calls = _calls + (c.id -> c)
}
def get(i... |
Explain and rewrite the following Scala code: | package com.twitter.finatra.kafka.consumers
import com.twitter.app.GlobalFlag
/**
* [[GlobalFlag]] to enable/disable tracing for Kafka consumers. Disabled by default.
*/
object consumerTracingEnabled
extends GlobalFlag[Boolean](false, "Enable/disable tracing for Kafka consumers")
|
Explain and rewrite the following Scala code: | /*
* Copyright 2013-2021 JetBrains s.r.o.
*
* 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 com.thisisfranklin.crdt
case class Morphism() extends scala.annotation.StaticAnnotation
case class Monotone() extends scala.annotation.StaticAnnotation
|
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 com.twitter.finagle.redis
import _root_.java.lang.{Boolean => JBoolean, Double => JDouble, Long => JLong}
import com.twitter.finagle.redis.protocol._
import com.twitter.finagle.redis.util.{BufToString, BytesToString, NumberFormat, ReplyFormat}
import com.twitter.util.Future
import org.jboss.netty.buffer.Channe... |
Explain and rewrite the following Scala code: | package example
import java.net.URL
import java.io.{IOException, FileNotFoundException, FileOutputStream}
object Main extends App {
args match {
case Array() => println("An argument is required")
case arr => arr.foreach(download)
}
def download(urlStr: String) {
val url = new URL(urlStr)
val co... |
Explain and rewrite the following Scala code: | package views.html.report
import controllers.routes
import lila.api.Context
import lila.app.templating.Environment._
import lila.app.ui.ScalatagsTemplate._
import lila.report.Report.WithSuspect
import lila.user.Holder
object list {
def apply(
reports: List[lila.report.Report.WithSuspect],
filter: Stri... |
Explain and rewrite the following Scala code: | package org.bitcoins.chain.blockchain
/** A base class for various types of block chain exceptions */
sealed abstract class ChainException(message: String)
extends RuntimeException(message)
/** [[org.bitcoins.chain.blockchain.ChainHandler]] cannot find a compact
* filter or header by its filter hash
*/
case c... |
Explain and rewrite the following Scala code: | package com.arcusys.valamis.ratings.model
/**
* Created by Igor Borisov on 19.10.15.
*/
case class Rating(score: Double, average: Double, total: Int) |
Explain and rewrite the following Scala code: | package me.zup.simpleEndpoint
import org.scalatest.FunSpec
import org.scalatest.Matchers
import spray.http._
import spray.json._
import StatusCodes._
import spray.httpx.SprayJsonSupport
import spray.testkit.ScalatestRouteTest
import spray.routing.HttpService
import me.zup.simpleEndpoint.AppConfig._
class EndpointSer... |
Explain and rewrite the following Scala code: | package com.sksamuel.elastic4s.mappings
import org.elasticsearch.common.xcontent.{XContentBuilder, XContentFactory}
import scala.collection.JavaConverters._
object CommonFieldBuilder {
def apply(field: FieldDefinition): XContentBuilder = {
val builder = XContentFactory.jsonBuilder()
builder.startObject()
... |
Explain and rewrite the following Scala code: | package me.rexim.issuestant.github
import io.circe._
import io.circe.generic.auto._
import io.circe.parser._
import io.circe.syntax._
import org.http4s._
import org.http4s.client._
import org.http4s.circe._
import org.http4s.util._
import scalaz._
import scalaz.stream._
import scalaz.concurrent._
object EtagItem {
... |
Explain and rewrite the following Scala code: | package stream
object SpecializedIterators {
// Specialized Function1
trait Fn1[@specialized I, @specialized O] {
def apply(a : I) : O
}
// Specialized Function2
trait Fn2[@specialized I1, @specialized I2, @specialized O] {
def apply(a1 : I1, a2 : I2) : O
}
// Specialized iterator
trait SIter... |
Explain and rewrite the following Scala code: | // Copyright 2012 Foursquare Labs Inc. All Rights Reserved.
package io.fsq.spindle.runtime
object BitFieldHelpers {
def getValue(bitfield: Int, bitIndex: Int): Boolean = {
/** We only allow 16 values because half the bits are used for
* "isSet" semantics.
*/
assert(bitIndex < 16)
((1 << bit... |
Explain and rewrite the following Scala code: | /*
* Copyright 2021 ACINQ SAS
*
* 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: | package com.airtonjal.poc.stream.storm
import backtype.storm.metric.api.{MeanReducer, ReducedMetric, CountMetric}
import backtype.storm.task.{TopologyContext, OutputCollector}
import backtype.storm.topology.OutputFieldsDeclarer
import backtype.storm.topology.base.BaseRichBolt
import backtype.storm.tuple.{Fields, Value... |
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.marsupial.wombat.service
import android.graphics.Bitmap
import com.marsupial.wombat.framework.Server
/**
* Downloads and caches image on request
*/
object ImageServer {
/**
* Downloads or fetches the image from the URL.
*
* Reply: Image
*/
case class DispatchImage(url: 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: | import sbt._
import sbt.Keys._
object LiftNgBuild extends Build {
val liftVersion = SettingKey[String]("liftVersion", "Full version number of the Lift Web Framework")
val liftEdition = SettingKey[String]("liftEdition", "Lift Edition (short version number to append to artifact name)")
val copyJs = resourceGe... |
Explain and rewrite the following Scala code: | /***********************************************************************
* Copyright (c) 2013-2016 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 is ... |
Explain and rewrite the following Scala code: | package net.francesbagual.tdc.monads.in.practice.monad
import net.francesbagual.tdc.monads.in.practice.main.User
object Authorization {
def apply[T](user:User)(f: User => T):Authorization[T] =
if(user.age > 18) Authorized(user, f) else NotAuthorized(user)
}
trait Authorization[T] {
def getOrElse(default:T):... |
Explain and rewrite the following Scala code: | package com.googlecode.kanbanik.commands
import com.googlecode.kanbanik.builders.TaskBuilder
import com.googlecode.kanbanik.exceptions.MidAirCollisionException
import com.googlecode.kanbanik.messages.ServerMessages
import com.googlecode.kanbanik.model.{User, Workflowitem, Board}
import com.googlecode.kanbanik.security... |
Explain and rewrite the following Scala code: | package org.jetbrains.plugins.scala
package lang
package parser
package parsing
package types
import org.jetbrains.plugins.scala.lang.lexer.ScalaTokenTypes
import org.jetbrains.plugins.scala.lang.parser.parsing.builder.ScalaPsiBuilder
import org.jetbrains.plugins.scala.lang.parser.util.ParserUtils
/**
* @author Ale... |
Explain and rewrite the following Scala code: | package us.stivers.blue.codec
import scalax.util.{Try,Success,Failure}
import org.specs2._
import org.scalacheck._
import specification.gen._
class ParameterCodecSpec extends Specification with ScalaCheck { def is =
"Boolean" ^
"encode" ! encode[Boolean] ^
"decode" ! decode[Boolean] ^
end ^
"Do... |
Explain and rewrite the following Scala code: | package edu.depauw.scales.graphics
import Base._
trait Segment {
def render(ctx: GraphicsContext): Unit
}
case class PointSegment(x: Double, y: Double) extends Segment {
def render(ctx: GraphicsContext): Unit = ctx.moveTo(x, y)
}
case class LineSegment(x: Double, y: Double) extends Segment {
def render(ctx: G... |
Explain and rewrite the following Scala code: | import sbt._
import sbt.Keys._
object TFArtifactsBuild extends Build {
val org = "org.tensorframes"
val namePrefix = "javacpp"
val v = "0.0.1-1.2SNAP"
val commonSettings = Seq(
organization := org,
version := v,
publishArtifact in packageDoc := false,
publishArtifact ... |
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: | /*
* @author Philip Stutz
*
* Copyright 2013 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: | /*
* 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 sbt.inc
// stolen from Josh
object StronglyConnected
{
def apply[N](nodes: Iterable[N])(dependencies: N => Iterable[N]): Set[Set[N]] =
{
val stack = new collection.mutable.Stack[N]
val onStack = new collection.mutable.HashSet[N]
val scc = new collection.mutable.ArrayBuffer[Set[N]]
val index = new col... |
Explain and rewrite the following Scala code: | package org.jetbrains.plugins.scala
package lang.refactoring.memberPullUp
import com.intellij.openapi.project.Project
import com.intellij.psi.codeStyle.CodeStyleManager
import com.intellij.psi.{PsiDocumentManager, PsiElement}
import com.intellij.refactoring.{BaseRefactoringProcessor, RefactoringBundle}
import com.inte... |
Explain and rewrite the following Scala code: | package de.hpi.asg.breezetestgen.testgeneration.constraintsolving
class Variable(val name: String, val bitCount: Int, val isSigned: Boolean) {
private val domainSize: Int = math.pow(2, bitCount).toInt
val minValue: Int = if (isSigned) -domainSize/2 else 0
val maxValue: Int = if (isSigned) domainSize/2 - 1 else... |
Explain and rewrite the following Scala code: | package models
import org.virtuslab.unicorn.LongUnicornPlay._
//import org.virtuslab.unicorn.LongUnicornPlay.driver.simple._
import ExtendedPostgresDriver.simple._
import play.api.libs.json.Json
case class SongId(id: Long) extends BaseId
object SongId extends IdCompanion[SongId]
case class Song(id: Option[SongId] = ... |
Explain and rewrite the following Scala code: | package debop4s.core.io.model
import debop4s.core.utils.Hashs
trait Entity[@miniboxed T] {
def id: T
override def equals(obj: Any): Boolean = {
obj != null &&
getClass == obj.getClass &&
this.hashCode == obj.hashCode()
}
}
case class PersonEntity(override val id: Long,
name... |
Explain and rewrite the following Scala code: | /*
* This file is part of Kiama.
*
* Copyright (C) 2014-2015 Anthony M Sloane, Macquarie University.
*
* Kiama is free software: you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or ... |
Explain and rewrite the following Scala code: | package org.jetbrains.plugins.scala
package debugger
import java.util
import java.util.Collections
import com.intellij.debugger.engine._
import com.intellij.debugger.requests.ClassPrepareRequestor
import com.intellij.debugger.{MultiRequestPositionManager, NoDataException, PositionManager, SourcePosition}
import com.i... |
Explain and rewrite the following Scala code: | /**
* Copyright (C) 2013 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 prog... |
Explain and rewrite the following Scala code: | package net.danielkza.http2
package object util extends Implicits
|
Explain and rewrite the following Scala code: | package mesosphere.marathon.api.v2
import java.net.URI
import javax.inject.{ Inject, Named }
import javax.servlet.http.HttpServletRequest
import javax.ws.rs._
import javax.ws.rs.core.{ Context, MediaType, Response }
import akka.event.EventStream
import com.codahale.metrics.annotation.Timed
import mesosphere.marathon.... |
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: | /*
* This file is part of CoAnSys project.
* Copyright (c) 2012-2015 ICM-UW
*
* CoAnSys 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... |
Explain and rewrite the following Scala code: | package poker.core.handanalyzer
import poker.core.{Hand, HandStatus, HandType, Kickers}
/** Any hand will match */
final class HighCardAnalyzer extends HandAnalyzer {
override def doAnalyze(hand: Hand): HandStatus = {
HandStatus(HandType.HighCard, Kickers(hand.cards))
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.