instruction
stringclasses
1 value
output
stringlengths
5
1M
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 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:
/* * Copyright 2021 HM Revenue & Customs * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or a...
Explain and rewrite the following Scala code:
/* * Copyright 2011 Hui Wen Han, 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:
class latitude { def foo(`test`: String, `cest`: Int) {} def foo(`test`: Int, `cest`: String) {} /* line: 2 */foo(cest = 123, test = "text") }
Explain and rewrite the following Scala code:
package org.apress.prospark import java.nio.charset.StandardCharsets import org.apache.spark.SparkConf import org.apache.spark.SparkContext import org.apache.spark.streaming.Seconds import org.apache.spark.streaming.StreamingContext import org.eclipse.paho.client.mqttv3.MqttClient import org.eclipse.paho.client.mqttv...
Explain and rewrite the following Scala code:
package com.ximalaya.ratel.interfaces /** * Created by think on 2017/7/22. */ trait RpcTrait { val version:Long }
Explain and rewrite the following Scala code:
class foo(val bar: String) extends annotation.StaticAnnotation object Api { // foo in ann must have a different name // otherwise, we get bitten by https://issues.scala-lang.org/browse/SI-5544 @foo({def fooInAnn = macro Impls.foo; fooInAnn}) def foo = println("it works") }
Explain and rewrite the following Scala code:
package lesst import java.net.URL import java.nio.charset.Charset trait Input[T] { def filename: String def src: String } /** Typeclass interface for compiler input */ @annotation.implicitNotFound( msg = "Compiler InputSource[T] type class instance for type ${T} not found") trait InputSource[T] { def apply(t...
Explain and rewrite the following Scala code:
/* * Copyright (c) 2012-16 Miles Sabin * * 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 scavlink.link.parameter import scavlink.link.parameter.types.ParameterResultSet import scavlink.link.{MockVehicle, SentPacket} import scavlink.message.common.{ParamRequestList, ParamRequestRead, ParamSet, ParamValue} import scavlink.message.enums.MavParamType import scavlink.message._ import akka.actor.Actor.R...
Explain and rewrite the following Scala code:
/* * EmptyExpandedImpl.scala * (LucreSwing) * * Copyright (c) 2014-2021 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.lucre.sw...
Explain and rewrite the following Scala code:
package com.github.mmolimar.ksql.jdbc.resultset import java.sql.{ResultSetMetaData, Types} import com.github.mmolimar.ksql.jdbc.Exceptions._ import com.github.mmolimar.ksql.jdbc.implicits.toIndexedMap import com.github.mmolimar.ksql.jdbc.{HeaderField, InvalidColumn} import io.confluent.ksql.schema.ksql.{SqlBaseType =...
Explain and rewrite the following Scala code:
/* * Copyright 2012-2017 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...
Explain and rewrite the following Scala code:
package mountainrangepvp.core class Noise { def noise(in: Int): Float = { val inAbs = if (in < 0) Integer.MAX_VALUE + in else in val inSplat = (inAbs >> 13) ^ inAbs val intNoise = (inSplat * (inSplat * inSplat * 60493 + 19990303) + 1376312589) & 0x7fffffff val doubleNoise = 1.0 - (in...
Explain and rewrite the following Scala code:
package org.jetbrains.plugins.scala.lang.psi.impl.base.types import com.intellij.lang.ASTNode import com.intellij.openapi.progress.ProgressManager import com.intellij.psi._ import com.intellij.psi.util.PsiTreeUtil.getContextOfType import org.jetbrains.plugins.scala.extensions._ import org.jetbrains.plugins.scala.lang....
Explain and rewrite the following Scala code:
/* * Copyright 2016 rdbc contributors * * 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.openurp.edu.eams.teach.grade.service.stat import java.util.Comparator import org.beangle.commons.collection.Collections import org.beangle.commons.collection.Collections import org.openurp.edu.base.Student import org.openurp.edu.teach.grade.CourseGrade import org.openurp.edu.teach.grade.domain.GradeFilter ...
Explain and rewrite the following Scala code:
package org.opencommercesearch.api.models /* * Licensed to OpenCommerceSearch under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. OpenCommerceSearch licenses this * file to you under the Apache License, Version...
Explain and rewrite the following Scala code:
/** * Copyright (c) 2007-2011 Eric Torreborre <etorreborre@yahoo.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 * the rights ...
Explain and rewrite the following Scala code:
package org.scalaide.ui.internal.editor import java.util.ResourceBundle import scala.collection.mutable.ArrayBuffer import org.eclipse.core.runtime.IProgressMonitor import org.eclipse.jdt.core.dom.CompilationUnit import org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor import org.eclipse.jdt.internal.ui.j...
Explain and rewrite the following Scala code:
package com.nulabinc.backlog.r2b.mapping.core import com.nulabinc.backlog.migration.common.domain.mappings.{ ValidatedPriorityMapping, ValidatedStatusMapping, ValidatedUserMapping } import com.nulabinc.backlog.r2b.domain.mappings.{ RedminePriorityMappingItem, RedmineStatusMappingItem, RedmineUserMappingIte...
Explain and rewrite the following Scala code:
package contege import scala.collection.JavaConversions._ import scala.collection.mutable.Set import scala.collection.mutable.Map import java.util.ArrayList import java.io.BufferedReader import java.io.FileReader import contege.seqgen.TypeManager class SUTParser(fileName: String, typeManager: TypeManager) { priv...
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 sp.virtcom import akka.actor._ import sp.domain.{ID, SPValue, HierarchyRoot, SPAttributes} import sp.services.AddHierarchies import sp.system._ import sp.system.{ServiceLauncher, SPService} import sp.system.messages._ import sp.virtcom.modeledCases._ import sp.domain.Logic._ /** * To create manufacturing ope...
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 eu.timepit.refined package internal import scala.reflect.macros.blackbox import scala.util.{Success, Try} object MacroUtils { def eval[T](c: blackbox.Context)(t: c.Expr[T]): T = { val expr = c.Expr[T](c.untypecheck(t.tree)) // Try evaluating expr twice before failing, see // https://github.com...
Explain and rewrite the following Scala code:
package dtos.report.row /** * The Class CongTyKhoiLuongRow. * * @author Nguyen Duc Dung * @since 4/18/14 5:53 PM * */ class CongTyKhoiLuongRow { }
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 cs220.actors import akka.actor.Actor import akka.actor.{ActorRef, ActorLogging} import scala.util.matching.Regex /** * The `ParseActor` handles the parsing of HTML documents. Its * primary goal is to extract out the links and words contained * in an HTML document. */ class ParseActor(pq: ActorRef) extends...
Explain and rewrite the following Scala code:
package cromwell.backend.standard import cromwell.backend.BackendInitializationData import cromwell.backend.io.{JobPaths, WorkflowPaths} class StandardInitializationData ( val workflowPaths: WorkflowPaths, val runtimeAttributesBuilder: StandardValidatedRuntimeAttributesBuilder, val standardExpressionFunctionsCl...
Explain and rewrite the following Scala code:
package services import domain.{Category, Article} import play.api.Logger import play.api.Play.current import play.api.cache.Cache import play.api.libs.json.{JsArray, JsResultException, JsValue} import play.api.libs.ws._ import scala.collection.mutable import scala.concurrent.Await import scala.concurrent.duration._ ...
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:
/* * (c) Copyright 2016 Hewlett Packard Enterprise Development LP * * 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 b...
Explain and rewrite the following Scala code:
package safe import breeze.math.Complex import org.scalatest.matchers.{ Matcher, MatchResult } trait SafeVectorMatchers { def equalWithTolerance(right: SafeVector[Double], tolerance: Double) = Matcher { (left: SafeVector[Double]) => { if (right.length != left.length) MatchResult(false, "lengths were no...
Explain and rewrite the following Scala code:
package controllers.filters import javax.inject.Inject import play.api.mvc.{EssentialAction,EssentialFilter,RequestHeader} import scala.concurrent.ExecutionContext /** Adds Access-Control-Allow-Origin headers to successful /api/ responses. */ class CorsFilter @Inject() (implicit ec: ExecutionContext) extends Essent...
Explain and rewrite the following Scala code:
package tscfg.example final case class ScalaMultilinesCfg( a : java.lang.String, b : java.lang.String, c : java.lang.String, d : java.lang.String ) object ScalaMultilinesCfg { def apply(c: com.typesafe.config.Config): ScalaMultilinesCfg = { val $tsCfgValidator: $TsCfgValidator = new $TsCfgValidator() ...
Explain and rewrite the following Scala code:
package endpoints.xhr.thenable import endpoints.xhr import scala.scalajs.js /** * Implements [[xhr.Endpoints]] by using JavaScript promises. */ trait Endpoints extends xhr.Endpoints { /** Maps a `Result` to a [[js.Thenable]] */ type Result[A] = js.Thenable[A] def endpoint[A, B](request: Request[A], respo...
Explain and rewrite the following Scala code:
package com.sksamuel.elastic4s.http.search.aggs import com.sksamuel.elastic4s.json.XContentBuilder import com.sksamuel.elastic4s.json.XContentFactory import com.sksamuel.elastic4s.searches.aggs.NestedAggregation object NestedAggregationBuilder { def apply(agg: NestedAggregation): XContentBuilder = { val builder...
Explain and rewrite the following Scala code:
/** * BinarySearchSpec.scala --- Properties-based testing of binary search * * Copyright (C) 2014 Aaron S. Hawley * * 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...
Explain and rewrite the following Scala code:
package net.janvsmachine.fpinscala sealed trait Either[+E, +A] { def map[B](f: A => B): Either[E, B] def flatMap[EE >: E, B](f: A => Either[EE, B]): Either[EE, B] def orElse[EE >: E, B >: A](b: => Either[EE, B]): Either[EE, B] def map2[EE >: E, B, C](b: Either[EE, B])(f: (A, B) => C): Either[EE, C] } case cla...
Explain and rewrite the following Scala code:
/* * Copyright (C) 2017. RandomCoder <randomcoder@randomcoding.co.uk> * * 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 la...
Explain and rewrite the following Scala code:
package io.eels.component.hive import java.io.File import io.eels.component.hive.partition.DynamicPartitionStrategy import io.eels.datastream.DataStream import io.eels.schema.{Field, Partition, StructType} import org.scalatest.{BeforeAndAfterAll, FunSuite, Matchers} import scala.util.Try class HiveDynamicPartitionT...
Explain and rewrite the following Scala code:
package com.geteit.rcouch.views import play.api.libs.iteratee.Enumerator import com.geteit.rcouch.actors.ViewActor.QueryCommand import com.geteit.rcouch.{BucketClient, CouchbaseClient} import scala.concurrent.{Future, ExecutionContext} import scala.collection.mutable import akka.actor.{Props, ActorRef, Actor} import c...
Explain and rewrite the following Scala code:
package com.lyrx.text /** * Created by extawe on 12/13/16. */ case class Link(ref:String,text:String,description:String) { }
Explain and rewrite the following Scala code:
import scala.reflect.runtime.universe._ import scala.reflect.runtime.{currentMirror => cm} import scala.reflect.{classTag, ClassTag} class B1 { override def toString = "B1"; def foo = 1 } private class B2 { override def toString = "B2"; def foo = 2 } object B3 { override def toString = "B3"; def foo = 3 } private obje...
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:
/* * 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 2014 Treode, 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 to...
Explain and rewrite the following Scala code:
/** * Bolt * statements/UpdateSelect * * Copyright (c) 2017 Osamu Takahashi * * This software is released under the MIT License. * http://opensource.org/licenses/mit-license.php * * @author Osamu Takahashi */ package com.sopranoworks.bolt.statements import com.google.cloud.spanner.{Mutation, Transa...
Explain and rewrite the following Scala code:
package org.cloudio.morpheus.tutor.chat.frag.step1 import java.util.Locale import org.morpheus._ import Morpheus._ /** * A plain mutable entity, no behavior. * * Created by zslajchrt on 04/05/15. */ @fragment trait Contact { var firstName: String = _ var lastName: String = _ var male: Boolean = _ var na...
Explain and rewrite the following Scala code:
package epic.sequences import epic.models.NerSelector import epic.util.ProcessTextMain /** * Simple class that reads in a bunch of files and parses them. Output is dumped to standard out. * @author dlwh * banana */ object SegmentText extends ProcessTextMain[SemiCRF[Any, String], Segmentation[Any, String]] { ...
Explain and rewrite the following Scala code:
/* * Copyright 2006-2011 WorldWide Conferencing, 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 applica...
Explain and rewrite the following Scala code:
package amphip.data import scalaz.std.option.optionSyntax._ import org.junit.Assert._ import org.junit.Test import amphip.base._ import amphip.dsl._ import amphip.model.ast.{ ConstraintStat, DLTEConstraintStat, DGTEConstraintStat, ObjectiveStat, Minimize, Maximize } import amphip.data.ModelData._ class TestEval { ...
Explain and rewrite the following Scala code:
/* * Copyright 2018 Google Inc. 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 appli...
Explain and rewrite the following Scala code:
package slick.memory import scala.collection.compat._ import scala.collection.mutable.{Builder, HashMap} import slick.SlickException import slick.ast._ import slick.ast.TypeUtil._ import slick.basic.{FixedBasicAction, FixedBasicStreamingAction} import slick.compiler._ import slick.dbio._ import slick.relational.{Rel...
Explain and rewrite the following Scala code:
package _99Problems.WorkingWithLists /** * Duplicate the elements of a list a given number of times. */ object P15 { def duplicateN[T](times: Int, list: List[T]): List[T] = list match { case x :: xs => List.fill(times)(x) ++ duplicateN(times, xs) case Nil => Nil } }
Explain and rewrite the following Scala code:
// scalac: -Yrangepos import language.experimental.macros import scala.reflect.macros.blackbox.Context object Macro { def apply(a: Any): Any = macro impl def impl(c: Context)(a: c.Tree): c.Tree = { c.untypecheck(a) } }
Explain and rewrite the following Scala code:
package object models { import models.persistence.PersistenceCompanion import scala.language.implicitConversions implicit def makeReference[T <: ModelObj](x: T)(implicit resolver: PersistenceCompanion[T]): Reference[T] = Reference(x.myId) }
Explain and rewrite the following Scala code:
package com.airbnb.aerosolve.training import com.typesafe.config.Config import org.slf4j.{Logger, LoggerFactory} import org.apache.spark.rdd.RDD import scala.util.Random /* * A logistic regression trainer for generating Platt's scaling weights (slope and offset) * The objective function to minimize is the negative log...
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 to i...
Explain and rewrite the following Scala code:
package net.methvin.scalacache import javax.inject.{Inject, Singleton} import play.api.cache.CacheApi import play.api.inject.{Binding, Module} import play.api.{Configuration, Environment} import play.cache.{CacheApi => JavaCacheApi, DefaultCacheApi => DefaultJavaCacheApi} import scala.concurrent.duration._ import sc...
Explain and rewrite the following Scala code:
package ca.innovativemedicine.vcf sealed trait VcfValue case class VcfInteger(value: Int) extends VcfValue case class VcfFloat(value: Double) extends VcfValue case class VcfCharacter(value: Char) extends VcfValue case class VcfString(value: String) extends VcfValue case object VcfFlag extends VcfValue // VCF needs to...
Explain and rewrite the following Scala code:
/************************************************************************* * * * This file is part of the 20n/act project. * * 20n/act enables DNA prediction for synthetic biology/bioengineering. * * Copyright (C) 201...
Explain and rewrite the following Scala code:
package edu.gemini.pit.ui.view.partner import edu.gemini.pit.model.Model import edu.gemini.pit.ui.util.gface.SimpleListViewer import edu.gemini.shared.gui.textComponent.TextRenderer import swing.BorderPanel.Position._ import swing.event.SelectionChanged import swing._ import Swing._ import scalaz._ import Scalaz._ imp...
Explain and rewrite the following Scala code:
package io.buoyant.telemetry import com.twitter.finagle.Stack import com.twitter.finagle.util.LoadService import io.buoyant.config.Parser import org.scalatest._ class TracelogInitializerTest extends FunSuite { test("io.l5d.tracelog telemeter loads") { val yaml = """|kind: io.l5d.tracelog |sample...
Explain and rewrite the following Scala code:
package dk.tennis.compare.rating.multiskill.model.perfdiff import dk.bayes.math.gaussian.Gaussian import dk.bayes.math.gaussian.MultivariateGaussian case class PerfDiff(perfDiff: Gaussian, gameSkills: MultivariateGaussian) { def getP1Skill(): Gaussian = gameSkills.marginal(0) def getP2Skill(): Gaussian = gameSk...
Explain and rewrite the following Scala code:
package com.mygdx.game.net import com.twitter.chill.{KryoPool, ScalaKryoInstantiator} import _root_.priv.sp.{Card, House, HouseSingleton} import com.esotericsoftware.kryo.io.{Input, Output} import com.esotericsoftware.kryo.{Kryo, Serializer} object GameKryoInstantiator { val kryo = KryoPool.withByteArra...
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 * "Licens...
Explain and rewrite the following Scala code:
package im.tox.antox.data import java.sql.Timestamp import java.text.SimpleDateFormat import java.util import java.util.{Date, TimeZone} import android.content.{ContentValues, Context} import android.database.Cursor import android.database.sqlite.{SQLiteDatabase, SQLiteOpenHelper} import android.preference.Preference...
Explain and rewrite the following Scala code:
package scaffvis.client.components.common import scaffvis.shared.model._ import scala.util.Try /** * Common formatter for use in ListBoxes, Tooltip, etc. */ object Formatter { val scaffoldHeading: Scaffold => String = { case s: SmilesScaffold => s"SMILES: ${s.smiles}" case s: RingCountScaffold => s"Ri...
Explain and rewrite the following Scala code:
/* * FILE: ImageWrapperUDT.scala * Copyright (c) 2015 - 2019 GeoSpark Development Team * * 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...
Explain and rewrite the following Scala code:
package xfp.fixedpoint import xfp.utils.{BigRational => Rational} import Rational._ case class RationalInterval(xlo: Rational, xhi: Rational) { private val zero = Rational(0.0) def this(aa: RationalForm) = this(aa.interval._1, aa.interval._2) def this(aa: FixedForm) = this(aa.qInterval._1, aa.qInterval._2) d...
Explain and rewrite the following Scala code:
/* * Copyright 2006-2011 WorldWide Conferencing, 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 applica...
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 (C) 2014 - 2019 Dennis Vriend <https://github.com/dnvriend> * Copyright (C) 2019 - 2021 Lightbend Inc. <https://www.lightbend.com> */ package akka.persistence.jdbc.serialization import akka.NotUsed import akka.persistence.jdbc.util.TrySeq import akka.persistence.journal.Tagged import akka.persistenc...
Explain and rewrite the following Scala code:
package ch.dyn.nawak.graphs trait SpanningTree[T] extends IGraph[T] { }
Explain and rewrite the following Scala code:
package org.gradle.sample import org.apache.commons.collections.list.GrowthList /** * Defines the traits of one who is named. */ trait Named { def names: List[String] def importedList: GrowthList }
Explain and rewrite the following Scala code:
package com.lynbrookrobotics.potassium.commons.drivetrain.twoSided case class TwoSided[Signal](left: Signal, right: Signal)
Explain and rewrite the following Scala code:
/* * Copyright 2011-2021 Asakusa Framework Team. * * 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:
/* * 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 scala.quoted.staging.repl import dotty.BootstrappedOnlyTests import dotty.tools.scripts import dotty.tools.repl.ReplTest import dotty.tools.vulpix.TestConfiguration import org.junit.Test import org.junit.experimental.categories.Category /** Runs all tests contained in `staging/test-resources/repl-staging` */ ...
Explain and rewrite the following Scala code:
package org.jetbrains.plugins.scala package codeInspection.collections import org.jetbrains.plugins.scala.codeInspection.InspectionBundle import org.jetbrains.plugins.scala.codeInspection.collections.OperationOnCollectionsUtil._ import scala.Some import org.jetbrains.plugins.scala.lang.psi.api.toplevel.typedef.ScMembe...
Explain and rewrite the following Scala code:
package io.buoyant.telemetry import com.twitter.finagle.Stack import java.util.concurrent.ConcurrentHashMap import java.util.concurrent.atomic.AtomicReference import scala.annotation.tailrec import scala.collection.JavaConverters._ trait MetricsTree { def children: Map[String, MetricsTree] def resolve(scope: Seq[...
Explain and rewrite the following Scala code:
package google4s.request import http.client.request.{CompletionEvaluation, HttpRequest} import http.client.response.HttpResponse import play.api.libs.json.JsSuccess object GoogleEmptyNextLinkCompletionEvaluation extends CompletionEvaluation { override def apply(request: HttpRequest, response: HttpResponse): Boolean...
Explain and rewrite the following Scala code:
package com.twitter.finagle.client import com.twitter.conversions.DurationOps._ import com.twitter.finagle.Stack.Params import com.twitter.finagle._ import com.twitter.finagle.context.BackupRequest import com.twitter.finagle.service.{ReqRep, ResponseClass, ResponseClassifier, Retries, RetryBudget} import com.twitter.f...
Explain and rewrite the following Scala code:
package breeze.stats package distributions import breeze.linalg.Counter import breeze.numerics._ import breeze.optimize.DiffFunction /* Copyright 2009 David Hall, Daniel Ramage Licensed 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:
/** * Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com> */ package akka.testkit import language.reflectiveCalls import language.postfixOps import org.scalatest.WordSpec import org.scalatest.Matchers import akka.actor._ // @note IMPLEMENT IN SCALA.JS import com.typesafe.config.ConfigFactory // @note IM...
Explain and rewrite the following Scala code:
package mesosphere.marathon.upgrade import akka.actor.Props import akka.testkit.TestActorRef import mesosphere.marathon.core.task.Task import mesosphere.marathon.core.task.tracker.TaskTracker import mesosphere.marathon.event.MesosStatusUpdateEvent import mesosphere.marathon.state.{ AppDefinition, PathId } import mesos...
Explain and rewrite the following Scala code:
/* * Copyright 2019 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 nars.logic.language import java.util._ import nars.io.Symbols import nars.storage.Memory import Conjunction._ //remove if not needed import scala.collection.JavaConversions._ import CompoundTerm._ object Conjunction { /** * Try to make a new compound from a list of components. Called by StringParser. ...
Explain and rewrite the following Scala code:
package com.szadowsz.spark.ml.feature import org.apache.spark.annotation.DeveloperApi import org.apache.spark.ml.Transformer import org.apache.spark.ml.param.shared.HasInputCol import org.apache.spark.ml.param.{Param, ParamMap} import org.apache.spark.sql.functions._ import org.apache.spark.sql.types.StructType import...
Explain and rewrite the following Scala code:
package no.penger package crud import com.typesafe.scalalogging.LazyLogging import org.scalactic.TypeCheckedTripleEquals import org.scalatest.FunSuite import scala.slick.driver.H2Driver /** * Here we wire up a test version of crud wired to use 'String' instead of 'NodeSeq'. * so it's a bit easier to test, and try a...
Explain and rewrite the following Scala code:
/* sbt -- Simple Build Tool * Copyright 2010 Mark Harrah */ package sbt package inc import xsbti.api.Source import xsbti.DependencyContext._ import java.io.File /** * The merge/groupBy functionality requires understanding of the concepts of internalizing/externalizing dependencies: * * Say we have source files ...
Explain and rewrite the following Scala code:
package org.http4s package parser import cats.implicits._ import java.nio.charset.Charset import org.http4s.{Query => Q} import org.http4s.internal.parboiled2._ import org.http4s.internal.parboiled2.CharPredicate.{Alpha, Digit, HexDigit} import org.http4s.internal.parboiled2.support.HNil import org.http4s.syntax.strin...
Explain and rewrite the following Scala code:
package org.scalaide.extensions package autoedits import org.eclipse.jface.text.IDocument import org.eclipse.jface.text.IRegion import org.scalaide.core.text.Add import org.scalaide.core.text.Replace import org.scalaide.util.eclipse.RegionUtils._ import scalariform.lexer._ object SurroundBlockSetting extends AutoEdi...
Explain and rewrite the following Scala code:
package scorex.settings import java.io.File import java.net.InetSocketAddress import play.api.libs.json.{JsObject, Json} import scorex.crypto.encode.Base58 import scorex.crypto.hash.CryptographicHash.Digest import scorex.utils.ScorexLogging import scala.concurrent.duration._ import scala.util.{Random, Try} /** * S...
Explain and rewrite the following Scala code:
package com.rasterfoundry.datamodel import cats.syntax.either._ import io.circe._ import java.security.InvalidParameterException sealed abstract class ExportStatus(val repr: String) { override def toString = repr /** Order possible statuses to support ingest workflow * * These values are used to filter ...
Explain and rewrite the following Scala code:
package edu.gemini.pit.launcher import java.io.File import java.util.Locale import edu.gemini.ags.client.impl.AgsHttpClient import edu.gemini.model.p1.immutable.Semester import edu.gemini.pit.model.Model import edu.gemini.pit.ui.ShellAdvisor import edu.gemini.pit.ui.robot.AgsRobot import edu.gemini.ui.workspace.impl....
Explain and rewrite the following Scala code:
package controllers.digest import org.apache.commons.codec.binary.Base64 abstract class Digest { def generateDigestFromByteArray(byteArr: Array[Byte]): Array[Byte] def generateBase64DigestByteArrayFromByteArray(byteArr: Array[Byte]): Array[Byte] = Base64.encodeBase64(byteArr) def generateBase64DigestFromByteArr...