instruction
stringclasses
1 value
output
stringlengths
5
1M
Explain and rewrite the following Scala code:
// Copyright (C) 2016 IBM Corp. All Rights Reserved. // 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 ob...
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 fuds.restriction object AuthorisationWhiteListParser { def parse(lines: List[String]): AuthorisationWhiteList = ExplicitAuthorisationWhiteList(lines.map(_.trim).filterNot(_.isEmpty).map { line => val split = line.split(":") if (split.size != 2) throw new IllegalArgumentException("Cannot parse...
Explain and rewrite the following Scala code:
package scalariform.utils trait CaseClassReflector extends Product { def getFields: List[(String, Any)] = { val names = getClass.getDeclaredFields map { _.getName } names.toList zip productIterator.toList } private def getFieldsOld: List[(String, Any)] = { var fieldValueToName: Map[Any, String] = M...
Explain and rewrite the following Scala code:
/* * The MIT License (MIT) * <p> * Copyright (c) 2017-2020 * <p> * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use,...
Explain and rewrite the following Scala code:
f compose identity[A] == f identity[B] _ compose f == f
Explain and rewrite the following Scala code:
package com.stratio.connector.sparksql.parquet import com.stratio.connector.sparksql.core.Provider case object Parquet extends Provider { override val manifest: String = "HDFSDataStore.xml" override val name: String = "hdfs" val dataSource = "org.apache.spark.sql.parquet" }
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:
/* * Copyright 2013 Twitter 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:
package net.kwas.impatient.ch6 import org.scalatest._ class ColorSpec extends FlatSpec with Matchers { "Color" should "have interesting hex-based ids" in { println( for (x <- Color.values) yield (x, x.id.toHexString) ) } }
Explain and rewrite the following Scala code:
package org.aja.tantra.examples.concurrency.threads import java.net.{Socket, ServerSocket} import java.util.concurrent.{Executors, ExecutorService} import java.util.Date /** * Created by mageswaran on 27/3/16. */ class NetworkServiceE(port: Int, poolSize: Int) extends Runnable { val serverSocket = new ServerSock...
Explain and rewrite the following Scala code:
/* * Copyright (C) Lightbend Inc. <https://www.lightbend.com> */ package com.lightbend.lagom.internal.scaladsl.broker.kafka import java.util.concurrent.atomic.AtomicInteger import akka.Done import akka.actor.ActorSystem import akka.kafka.ConsumerSettings import akka.kafka.Subscriptions import akka.kafka.scaladsl.C...
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 edu.berkeley.cs.amplab.mlmatrix import org.scalatest.{BeforeAndAfterEach, Suite} import org.apache.spark.SparkContext // TODO: delete this file and use the version from Spark once SPARK-750 is fixed. /** Manages a local `sc` {@link SparkContext} variable, correctly stopping it after each test. */ trait Loca...
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 scala.reflect.runtime.{ universe => ru } object Test extends App { trait FormTrait { val runtimeMirror = ru.runtimeMirror(this.getClass.getClassLoader) val instanceMirror = runtimeMirror.reflect(this) val members = instanceMirror.symbol.typeSignature.members def fields = members.filter(_.ty...
Explain and rewrite the following Scala code:
/* * Copyright 2014 http4s.org * * 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 com.stovokor.editor.builder import com.stovokor.editor.model.repository.SectorRepository import com.stovokor.util.SectorUpdated import com.stovokor.util.EventBus import com.stovokor.editor.model.repository.BorderRepository import com.stovokor.editor.factory.BorderFactory import com.stovokor.editor.model.Line i...
Explain and rewrite the following Scala code:
package com.bryghts.kissmx.components import scala.reflect.macros.Context import java.util trait GenericExtractor extends Types with Expressions with BaseTypesExtractors with OptionExtractor with CollectionExtracto...
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.ausdigital.apecconnect.invoice.services import javax.inject.Inject import com.google.inject.Singleton import org.ausdigital.apecconnect.db.services.SimpleRecordService import org.ausdigital.apecconnect.invoice.dao.InvoiceDao import org.ausdigital.apecconnect.invoice.model.Invoice.InvoiceData import scala...
Explain and rewrite the following Scala code:
trait RNG { def nextInt: (Int, RNG) // Should generate a random `Int`. We'll later define other functions in terms of `nextInt`. } object RNG { // NB - this was called SimpleRNG in the book text case class Simple(seed: Long) extends RNG { def nextInt: (Int, RNG) = { val newSeed = (seed * 0x5DEECE66DL...
Explain and rewrite the following Scala code:
package ml.combust.mleap.core.feature import ml.combust.mleap.core.Model import ml.combust.mleap.core.types.{BasicType, ListType, StructType, TensorType} import org.apache.spark.ml.linalg.mleap.BLAS import org.apache.spark.ml.linalg.{DenseVector, SparseVector, Vector, Vectors} /** * Created by hollinwilkins on 12/2...
Explain and rewrite the following Scala code:
/* * RunningWindowProduct.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...
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:
/* * Code Pulse: A real-time code coverage testing tool. For more information * see http://code-pulse.com * * Copyright (C) 2014 Applied Visions - http://securedecisions.avi.com * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. ...
Explain and rewrite the following Scala code:
package dotty.tools package dotc import core.Contexts.Context /* To do: */ object Main extends Driver { override def newCompiler(implicit ctx: Context): Compiler = new Compiler }
Explain and rewrite the following Scala code:
package io.getquill.examples import com.zaxxer.hikari.HikariDataSource import io.getquill.context.ZioJdbc._ import io.getquill.util.LoadConfig import io.getquill.{ JdbcContextConfig, Literal, PostgresZioJdbcContext } import zio.console.putStrLn import zio.Runtime object PlainAppDataSource { object MyPostgresContex...
Explain and rewrite the following Scala code:
package rovak.steamkit.util.stream import com.google.protobuf.{InvalidProtocolBufferException, CodedInputStream} import java.io.InputStream import java.nio.ByteBuffer object BinaryReader { val LongMaxValue = 0xFFFFFFFFFFFFFFFFL } /** * Binary Reader * * @param reader inputstream * @param len length */ class B...
Explain and rewrite the following Scala code:
/* * DebugPromise.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.graph ...
Explain and rewrite the following Scala code:
/* * Copyright 2015-2016 IBM Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agree...
Explain and rewrite the following Scala code:
/* Title: Pure/General/url.scala Author: Makarius Basic URL operations. */ package isabelle import java.io.{File => JFile} import java.nio.file.{Paths, FileSystemNotFoundException} import java.net.{URI, URISyntaxException, URL, MalformedURLException, URLDecoder, URLEncoder} import java.util.zip.GZIPIn...
Explain and rewrite the following Scala code:
/* * Copyright (C) 2012 The Regents of The University California. * 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/LICENS...
Explain and rewrite the following Scala code:
package com.strava.service import akka.actor.ActorSystem import com.strava.Configuration import com.strava.domain.Activity import org.scalatest.Ignore import org.scalatest.concurrent.Eventually.eventually import org.scalatest.time.{Second, Span} import scala.concurrent.ExecutionContext.Implicits.global class StravaS...
Explain and rewrite the following Scala code:
/* * Copyright 2017 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.bazaarvoice.sswf class Rememberer { var toRemember: String = _ def remember(s: String): Unit = { toRemember = s } }
Explain and rewrite the following Scala code:
import scala.pickling._ import scala.pickling.Defaults._ import scala.pickling.binary._ import org.evactor.model.events.DataEvent import scala.util.Random import java.io._ import scala.reflect.runtime.{universe => ru} object EvactorPicklingBench extends scala.pickling.testing.PicklingBenchmark { val time: Int = Sys...
Explain and rewrite the following Scala code:
/* NSC -- new Scala compiler * Copyright 2006-2013 LAMP/EPFL * @author Paul Phillips */ package scala package tools package util import java.net.URL import scala.tools.reflect.WrappedProperties.AccessControl import scala.tools.nsc.Settings import scala.tools.nsc.util.ClassPath import scala.reflect.io.{Directory, ...
Explain and rewrite the following Scala code:
package us.stivers.blue.route import scala.collection.immutable.{Set,SetProxy} /** * Set of Routes. * Provides a low priority operator '|', for concatenating Routes. */ trait RouteSet extends Set[Route] with SetProxy[Route] { def routes: Set[Route] def self: Set[Route] = routes def |(route: Route): RouteSet ...
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 Nest Labs Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing...
Explain and rewrite the following Scala code:
package scala.meta package internal package tokenizers import scala.annotation.switch import java.lang.{ Character => JCharacter } import scala.language.postfixOps /** Contains constants and classifier methods for characters */ object Chars { // Be very careful touching these. // Apparently trivial changes to th...
Explain and rewrite the following Scala code:
package justin.db.vectorclocks import justin.db.vectorclocks.VectorClockComparator.VectorClockRelation import justin.db.vectorclocks.VectorClockOps._ import org.scalatest.{FlatSpec, Matchers} class VectorClockComparatorTest extends FlatSpec with Matchers { behavior of "Vector Clock's comparator" private val com...
Explain and rewrite the following Scala code:
package util import com.github.nscala_time.time.Imports._ import org.scalatest.FunSuite class MFGDateUtilSuite extends FunSuite { import MFGDateUtil._ test("monthHead") { assert(monthHead(new DateTime(2016, 1, 3, 10, 5)) === new DateTime(2016, 1, 1, 0, 0, 0, 0)) assert(monthHead(new DateTime(2016, 2, 1, ...
Explain and rewrite the following Scala code:
package org.scalaprops.ui import org.scalaprops.ui.editors._ import org.scalaprops.utils.ClassUtils import org.scalaprops.{Bean, Property} /** * */ object DefaultEditorFactory { private val STRING = classOf[String].getName private val BOOL = classOf[java.lang.Boolean].getName private val BYTE = classOf[java...
Explain and rewrite the following Scala code:
package monocle.catssupport import cats.data.{NonEmptyList, State} import cats.functor.Profunctor import cats.kernel.Semigroup import cats.{Applicative, Eq, Functor, Monoid, Unapply} import scala.util.control.NonFatal class Disjunction(val unwrap: Boolean) extends AnyVal object Disjunction { implicit val disjun...
Explain and rewrite the following Scala code:
trait Foo(x: Int) { // error def name: String = "hello" def f: Int = x } trait Bar { this: Foo => val title = "Mr." val message = "hello, " + name println(title) println(f) } class Qux extends Bar with Foo(3) class Qux2 extends Foo(3) with Bar
Explain and rewrite the following Scala code:
package konstructs.metric import akka.actor.ActorRef case class MetricConfig(interval: Int, listeners: Seq[ActorRef])
Explain and rewrite the following Scala code:
package scala.virtualization.lms package epfl package test3 import test1._ import test2._ trait MatchProg { this: Matching with Extractors => case class Success(x: Int) object SuccessR { def apply(x: Rep[Int]): Rep[Success] = construct(classOf[Success], Success.apply, x) def unapply(x: Rep[Success]...
Explain and rewrite the following Scala code:
sealed trait Foo case class Bar(s: String) object Test { def shouldError(foo: Foo): String = foo match { case bar: Bar => bar.s } }
Explain and rewrite the following Scala code:
package com.rasterfoundry.http4s import com.rasterfoundry.database.UserDao import com.rasterfoundry.datamodel.User import cats.data.OptionT import cats.effect.IO import com.guizmaii.scalajwt.{ConfigurableJwtValidator, JwtToken} import com.nimbusds.jose.jwk.source.{JWKSource, RemoteJWKSet} import com.nimbusds.jose.pro...
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 org.abhijitsarkar.akka.k8s.watcher.web import java.time.temporal.ChronoUnit.SECONDS import java.util.UUID import java.util.concurrent.{ConcurrentHashMap => JavaConcurrentMap} import akka.actor.{Actor, ActorLogging, ActorRef} import com.softwaremill.tagging.@@ import org.abhijitsarkar.akka.k8s.watcher.domain._...
Explain and rewrite the following Scala code:
package org.aprsdroid.app import _root_.android.content.{BroadcastReceiver, Context, Intent, IntentFilter} import _root_.android.graphics.PorterDuff import _root_.android.view.View.OnClickListener import _root_.android.view.{ContextMenu, Menu, MenuItem, View, Window} import _root_.android.widget.Button class MainList...
Explain and rewrite the following Scala code:
package com.teamisotope.techexpansion.world import java.util.Random import net.minecraft.world.World import net.minecraft.world.chunk.{IChunkGenerator, IChunkProvider} import net.minecraft.world.gen.feature.WorldGenerator import net.minecraftforge.fml.common.IWorldGenerator import scala.collection.mutable.ArrayBuffe...
Explain and rewrite the following Scala code:
/* Title: Pure/PIDE/markup_tree.scala Module: PIDE Author: Fabian Immler, TU Munich Author: Makarius Markup trees over nested / non-overlapping text ranges. */ package isabelle import scala.collection.immutable.SortedMap import scala.collection.mutable import scala.annotation.tailrec ...
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 scodec.bits import org.scalacheck.{ Arbitrary, Gen } import Arbitrary.arbitrary import java.io.ByteArrayOutputStream import org.scalatest.Matchers._ import Arbitraries._ class ByteVectorTest extends BitsSuite { test("hashCode/equals") { forAll (bytesWithIndex) { case (b, m) => (b.take(m) ++ b.dr...
Explain and rewrite the following Scala code:
package com.twitter.finatra.kafkastreams.integration.wordcount_in_memory import com.twitter.conversions.DurationOps._ import com.twitter.finatra.kafka.serde.ScalaSerdes import com.twitter.finatra.kafkastreams.test.KafkaStreamsFeatureTest import com.twitter.inject.server.EmbeddedTwitterServer import org.apache.kafka.co...
Explain and rewrite the following Scala code:
package ${package} object App extends Application { println( "Hello World!" ); }
Explain and rewrite the following Scala code:
package org.shubinmountain.king import com.badlogic.gdx._ import graphics._ import g2d._ import glutils._ import ShapeRenderer.ShapeType class GameScreen(model: Model) extends Screen { private val width = Gdx.graphics.getWidth private val height = Gdx.graphics.getHeight v...
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 import javax.inject._ import forms.RequestFormData import play.api._ import play.api.mvc._ import play.api.Play.current import play.api.i18n.Messages.Implicits._ import scala.concurrent.ExecutionContext.Implicits.global import repositories.impl.ScheduleRepository import services.Counter @Singleto...
Explain and rewrite the following Scala code:
import scala.concurrent.{ Await, ExecutionContext, Future, Promise } import scala.concurrent.duration._ import akka.actor.{ Actor, ActorRef, ActorSystem, Props } import reactivemongo.bson.BSONDocument import reactivemongo.core.actors.{ PrimaryAvailable, RegisterMonitor, SetAvailable } import reactivemongo.cor...
Explain and rewrite the following Scala code:
package vep.app.production.theater import scalikejdbc.WrappedResultSet import spray.json.RootJsonFormat import vep.framework.utils.JsonProtocol case class Theater( id: String, name: String, address: String, content: String, seats: Seq[Seat] ) object Theater { import JsonProtocol._ implicit val theater...
Explain and rewrite the following Scala code:
/* * La Trobe University - Distributed Deep Learning System * Copyright 2016 Matthias Langer (t3l@threelights.de) * * 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.apa...
Explain and rewrite the following Scala code:
import scala.quoted.* object Macro { def impl[A : Type](using Quotes): Unit = { import quotes.reflect.* val tpe = TypeRepr.of[A].asType.asInstanceOf[Type[_ <: AnyRef]] '{ (a: ${tpe}) => ???} // error } }
Explain and rewrite the following Scala code:
package mesosphere.marathon.upgrade import akka.actor.{ Actor, ActorLogging, Cancellable } import akka.event.EventStream import mesosphere.marathon.TaskUpgradeCanceledException import mesosphere.marathon.event.MesosStatusUpdateEvent import mesosphere.marathon.state.PathId import mesosphere.marathon.tasks.TaskTracker i...
Explain and rewrite the following Scala code:
package com.ing.baker.recipe package object scaladsl { val recipeInstanceId: Ingredient[String] = new Ingredient[String](common.recipeInstanceIdName) }
Explain and rewrite the following Scala code:
package caseclasses /** * Created by Pascal.Munerot on 08/07/2014. */ trait NamedObject2 { val id: Int val name: 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:
/* * 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:
package im.tox.antox.utils object Options { var ipv6Enabled: Boolean = true var udpEnabled: Boolean = false var proxyEnabled: Boolean = false }
Explain and rewrite the following Scala code:
/** * 编写一段程序,引入java.lang.System类,从user.name系统属性读取用户名, * 从Console对象读取一个密码, * 如果密码不是"secret",则在标准错误流中打印一个消息; * 如果密码是"secret",则在标准输出流中打印一个问候消息。 * 不要使用任何其他引入,也不要使用任何限定词(带句点的那种) */ object Q9 extends App{ import java.lang.System._ var password = Console.readLine() if (password equals "secret") System.out.pri...
Explain and rewrite the following Scala code:
package dhg.ccg.rule import dhg.util._ import dhg.ccg.cat._ import dhg.ccg.parse._ import dhg.ccg.parse.pcfg._ import scalaz._ import Scalaz._ import dhg.ccg.tagdict.TagDictionary object CcgRuleNoFeat { val binaryRules = Vector[BinaryCcgRule]( FA, BA, // FCnf, // BCnf, // BXnf, //...
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 ohnosequences.db.rna16s import java.io.File case object output { def sequences(localFolder: File): File = new File(localFolder, "db.rna16.fa") def mappings(localFolder: File): File = new File(localFolder, "mappings") }
Explain and rewrite the following Scala code:
package org.jetbrains.plugins.scala.debugger /** * @author Nikolay.Tropin */ private[debugger] object BytecodeUtil { import org.jetbrains.plugins.scala.decompiler.DecompilerUtil.Opcodes._ private val oneByteCodes = Map( istore_0 -> iload_0, istore_1 -> iload_1, istore_2 -> iload_2, istore_3 -> i...
Explain and rewrite the following Scala code:
package org.jetbrains.plugins.scala package codeInsight.intention.expression import com.intellij.codeInsight.intention.PsiElementBaseIntentionAction import com.intellij.openapi.editor.Editor import com.intellij.openapi.project.Project import com.intellij.psi.PsiElement import com.intellij.psi.util.PsiTreeUtil import o...
Explain and rewrite the following Scala code:
/* * Copyright (c) 2015 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, 1/3/15 1:04 PM */ package base.entity.kv import base.common.service.{ Service, ServiceCompanion } impor...
Explain and rewrite the following Scala code:
/* * ****************************************************************************** * Copyright 2012-2013 SpotRight * * 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 * * ...
Explain and rewrite the following Scala code:
package com.karumi.shot.screenshots import java.io.File import com.karumi.shot.domain.{ Config, DifferentImageDimensions, DifferentScreenshots, Dimension, Screenshot, ScreenshotNotFound, ScreenshotsComparisionResult } import com.karumi.shot.domain.model.{Folder, ScreenshotsSuite} import com.sksamuel.scr...
Explain and rewrite the following Scala code:
// // ProgressMonitor.scala -- Scala trait ProgressMonitor and object NullProgressMonitor // Project OrcScala // // Created by jthywiss on Aug 5, 2010. // // Copyright (c) 2016 The University of Texas at Austin. All rights reserved. // // Use and redistribution of this file is governed by the license terms in // the LI...
Explain and rewrite the following Scala code:
package learning class AuthorTrackers(repository: RepositoryTracker) { private val trackers = scala.collection.mutable.Map[String, AuthorTracker]() def get(username: String) = synchronized { trackers.get(username) match { case Some(tracker) => tracker case None => val tracker = new AuthorT...
Explain and rewrite the following Scala code:
/* * Copyright 2014–2020 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 org.ferrit.dao.cassandra import java.util.Date import org.joda.time.DateTime import com.datastax.driver.core.{Session, PreparedStatement, BoundStatement, BatchStatement} import com.datastax.driver.core.{Row, ResultSet} import org.ferrit.core.model.FetchLogEntry import org.ferrit.dao.FetchLogEntryDAO import org...
Explain and rewrite the following Scala code:
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\\ * @ @ * * # # # # (c) 2017 CAB * * # # # # # # ...
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 Arash Fard, Usman Nisar, Ayushi Jain, Aravind Kalimurthy, John Miller * @version 1.3 * @date Thu Nov 25 11:28:31 EDT 2013 * @see LICENSE (MIT style license file). * * Strict Simulation Using Mutable Sets */ pa...
Explain and rewrite the following Scala code:
/* sbt -- Simple Build Tool * Copyright 2008, 2009, 2010 Mark Harrah */ package sbt import java.io.File import sbt.internal.inc.AnalyzingCompiler import sbt.util.Logger import xsbti.compile.{ Inputs, Compilers } import scala.util.Try final class Console(compiler: AnalyzingCompiler) { /** Starts an interactive ...
Explain and rewrite the following Scala code:
class Boopy { private val s = new Schnuck def observer : PartialFunction[ Any, Unit ] = s.observer private class Schnuck extends javax.swing.AbstractListModel[AnyRef] { model => val observer : PartialFunction[ Any, Unit ] = { case "Boopy" => fireIntervalAdded( model, 0, 1 ) } def getSize = 0 ...
Explain and rewrite the following Scala code:
/* * Copyright 2008 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 applicable la...
Explain and rewrite the following Scala code:
package BlnService import akka.actor.ActorSystem import org.apache.ignite.Ignition import org.apache.ignite.cache.CacheAtomicityMode import org.apache.ignite.cache.query.ScanQuery import org.apache.ignite.configuration.{CacheConfiguration, IgniteConfiguration} import org.apache.ignite.lang.IgniteBiPredicate import sc...
Explain and rewrite the following Scala code:
package org.bitcoins.spvnode.serializers.messages.data import org.bitcoins.core.protocol.transaction.Transaction import org.bitcoins.core.serializers.RawBitcoinSerializer import org.bitcoins.spvnode.messages.TransactionMessage import org.bitcoins.spvnode.messages.data.TransactionMessage /** * Created by chris on 6/...
Explain and rewrite the following Scala code:
/* * Copyright 2014–2018 SlamData Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agr...
Explain and rewrite the following Scala code:
/******************************************************************************* Copyright (c) 2013-2014, S-Core, KAIST. All rights reserved. Use is subject to license terms. This distribution may include materials developed by third parties. *********************************************************...
Explain and rewrite the following Scala code:
/* * Happy Melly Teller * Copyright (C) 2013 - 2014, Happy Melly http://www.happymelly.com * * This file is part of the Happy Melly Teller. * * Happy Melly Teller 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 Fo...
Explain and rewrite the following Scala code:
package controllers import play.modules.reactivemongo.MongoController import play.modules.reactivemongo.json.collection.JSONCollection import scala.concurrent.Future import reactivemongo.api.Cursor import play.api.libs.concurrent.Execution.Implicits.defaultContext import org.slf4j.{LoggerFactory, Logger} import javax....
Explain and rewrite the following Scala code:
package com.github.aselab.activerecord.squeryl import com.github.aselab.activerecord.reflections._ object Implicits { implicit def fieldToExpression(field: FieldInfo) = new ExpressionConversion(field) }
Explain and rewrite the following Scala code:
import cats.effect.IO import org.http4s.HttpRoutes import org.http4s.dsl.io._ object Services { val helloWorldService = HttpRoutes.of[IO] { case GET -> Root / "hello" / name => Ok(s"Hello, $name.") } }